Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: trim named returns in pkg #2950 #2979

Merged
merged 16 commits into from
Sep 10, 2024

Conversation

mkcp
Copy link
Contributor

@mkcp mkcp commented Sep 9, 2024

Description

This PR is intended to remove unnecessary named returns and clean up/refactor some nearby functions. Substantial refactors should also be accompanied by tests. This intentionally ignores packager directories to avoid too much churn alongside packager refactoring.

Run golangci-lint run --disable-all -E nonamedreturns --exclude-dirs='packager' ./src/pkg/... prior to these fixes to see the intended scope of fixes here. The remaining items outside of pkg #2950 will be fully addressed in another PR. This one was starting to sprawl.

Related Issue

Partially fixes #2950

Checklist before merging

@mkcp mkcp self-assigned this Sep 9, 2024
Copy link

netlify bot commented Sep 9, 2024

Deploy Preview for zarf-docs canceled.

Name Link
🔨 Latest commit c4b138d
🔍 Latest deploy log https://app.netlify.com/sites/zarf-docs/deploys/66e08513cd2bf40008f6b821

Copy link

codecov bot commented Sep 9, 2024

Codecov Report

Attention: Patch coverage is 30.49645% with 98 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pkg/utils/cosign.go 0.00% 34 Missing ⚠️
src/pkg/layout/component.go 0.00% 13 Missing ⚠️
src/pkg/zoci/fetch.go 0.00% 11 Missing ⚠️
src/pkg/interactive/prompt.go 0.00% 10 Missing ⚠️
src/pkg/layout/sbom.go 12.50% 7 Missing ⚠️
src/pkg/interactive/components.go 0.00% 6 Missing ⚠️
src/pkg/cluster/zarf.go 0.00% 5 Missing ⚠️
src/pkg/layout/package.go 0.00% 4 Missing ⚠️
src/pkg/zoci/pull.go 0.00% 4 Missing ⚠️
src/pkg/transform/image.go 83.33% 1 Missing and 1 partial ⚠️
... and 1 more
Files with missing lines Coverage Δ
src/pkg/cluster/state.go 63.10% <100.00%> (+0.19%) ⬆️
src/pkg/lint/validate.go 92.00% <100.00%> (-0.07%) ⬇️
src/pkg/message/pausable.go 100.00% <100.00%> (ø)
src/pkg/utils/bytes.go 52.94% <100.00%> (+52.94%) ⬆️
src/pkg/utils/network.go 63.15% <100.00%> (+2.14%) ⬆️
src/pkg/transform/image.go 95.12% <83.33%> (+0.12%) ⬆️
src/pkg/variables/variables.go 78.57% <0.00%> (ø)
src/pkg/layout/package.go 36.26% <0.00%> (-0.41%) ⬇️
src/pkg/zoci/pull.go 0.00% <0.00%> (ø)
src/pkg/cluster/zarf.go 19.17% <0.00%> (-0.09%) ⬇️
... and 6 more

... and 1 file with indirect coverage changes

Signed-off-by: Kit Patella <kit@defenseunicorns.com>
Signed-off-by: Kit Patella <kit@defenseunicorns.com>
…ck explicit empty struct until needed

Signed-off-by: Kit Patella <kit@defenseunicorns.com>
…ne error handling explicit

Signed-off-by: Kit Patella <kit@defenseunicorns.com>
Signed-off-by: Kit Patella <kit@defenseunicorns.com>
Signed-off-by: Kit Patella <kit@defenseunicorns.com>
Signed-off-by: Kit Patella <kit@defenseunicorns.com>
… date

Signed-off-by: Kit Patella <kit@defenseunicorns.com>
@mkcp mkcp force-pushed the mkcp/2950-trim-named-returns branch from 6c66256 to bc93e12 Compare September 9, 2024 19:22
@mkcp mkcp changed the title WIP: Trim named returns refactor: Trim named returns Sep 9, 2024
@mkcp mkcp changed the title refactor: Trim named returns refactor: trim named returns Sep 9, 2024
…error, and clean up fn signatures

Signed-off-by: Kit Patella <kit@defenseunicorns.com>
…ble err

Signed-off-by: Kit Patella <kit@defenseunicorns.com>
Signed-off-by: Kit Patella <kit@defenseunicorns.com>
Signed-off-by: Kit Patella <kit@defenseunicorns.com>
Signed-off-by: Kit Patella <kit@defenseunicorns.com>
…ecessary named returns

Signed-off-by: Kit Patella <kit@defenseunicorns.com>
Signed-off-by: Kit Patella <kit@defenseunicorns.com>
@mkcp mkcp marked this pull request as ready for review September 10, 2024 00:13
@mkcp mkcp requested review from a team as code owners September 10, 2024 00:13
@mkcp mkcp changed the title refactor: trim named returns refactor: trim named returns in pkg Sep 10, 2024
src/pkg/cluster/zarf.go Outdated Show resolved Hide resolved
src/pkg/zoci/fetch.go Show resolved Hide resolved
@mkcp mkcp changed the title refactor: trim named returns in pkg refactor: trim named returns in pkg #2950 Sep 10, 2024
…geSecretNeedsWait

Signed-off-by: Kit Patella <kit@defenseunicorns.com>
@AustinAbro321 AustinAbro321 added this pull request to the merge queue Sep 10, 2024
Merged via the queue into main with commit 6eeabf9 Sep 10, 2024
27 checks passed
@AustinAbro321 AustinAbro321 deleted the mkcp/2950-trim-named-returns branch September 10, 2024 18:33
mjnagel pushed a commit to defenseunicorns/uds-core that referenced this pull request Sep 20, 2024
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| ghcr.io/zarf-dev/packages/init | minor | `v0.39.0` -> `v0.40.1` |
| [zarf-dev/zarf](https://redirect.github.com/zarf-dev/zarf) | minor |
`v0.39.0` -> `v0.40.1` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>zarf-dev/zarf (zarf-dev/zarf)</summary>

###
[`v0.40.1`](https://redirect.github.com/zarf-dev/zarf/releases/tag/v0.40.1)

[Compare
Source](https://redirect.github.com/zarf-dev/zarf/compare/v0.40.0...v0.40.1)

#### What's Changed

- chore(deps): bump actions/create-github-app-token from 1.10.3 to
1.10.4 by [@&#8203;dependabot](https://redirect.github.com/dependabot)
in
[zarf-dev/zarf#2968
- fix: imported helm overrides by
[@&#8203;rjferguson21](https://redirect.github.com/rjferguson21) in
[zarf-dev/zarf#2967
- chore: only show config file if there is one by
[@&#8203;catsby](https://redirect.github.com/catsby) in
[zarf-dev/zarf#2985
- refactor: trim named returns in pkg
[#&#8203;2950](https://redirect.github.com/zarf-dev/zarf/issues/2950) by
[@&#8203;mkcp](https://redirect.github.com/mkcp) in
[zarf-dev/zarf#2979
- chore: finish removing named returns outside of package and extensions
[#&#8203;2950](https://redirect.github.com/zarf-dev/zarf/issues/2950) by
[@&#8203;mkcp](https://redirect.github.com/mkcp) in
[zarf-dev/zarf#2987
- chore: ensure we return zeroed value when returning errors by
[@&#8203;mkcp](https://redirect.github.com/mkcp) in
[zarf-dev/zarf#2988
- chore(deps): bump actions/create-github-app-token from 1.10.4 to
1.11.0 by [@&#8203;dependabot](https://redirect.github.com/dependabot)
in
[zarf-dev/zarf#2991
- refactor: break --insecure into separate flags by
[@&#8203;joonas](https://redirect.github.com/joonas) in
[zarf-dev/zarf#2936
- ci: stop codeql on merge queue by
[@&#8203;AustinAbro321](https://redirect.github.com/AustinAbro321) in
[zarf-dev/zarf#2934
- fix: add shasum flag and test for https pull by
[@&#8203;AustinAbro321](https://redirect.github.com/AustinAbro321) in
[zarf-dev/zarf#2998
- chore(deps): bump github/codeql-action from 3.26.6 to 3.26.7 by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[zarf-dev/zarf#2997
- refactor: pull command by
[@&#8203;phillebaba](https://redirect.github.com/phillebaba) in
[zarf-dev/zarf#2989
- docs: update dos-games refs by
[@&#8203;jasonwashburn](https://redirect.github.com/jasonwashburn) in
[zarf-dev/zarf#3004
- refactor: lint by
[@&#8203;phillebaba](https://redirect.github.com/phillebaba) in
[zarf-dev/zarf#3000
- refactor: mirror-resources by
[@&#8203;phillebaba](https://redirect.github.com/phillebaba) in
[zarf-dev/zarf#2975
- fix: gittributes to ignore image file endings by
[@&#8203;phillebaba](https://redirect.github.com/phillebaba) in
[zarf-dev/zarf#3012

#### New Contributors

- [@&#8203;rjferguson21](https://redirect.github.com/rjferguson21) made
their first contribution in
[zarf-dev/zarf#2967
- [@&#8203;catsby](https://redirect.github.com/catsby) made their first
contribution in
[zarf-dev/zarf#2985
- [@&#8203;mkcp](https://redirect.github.com/mkcp) made their first
contribution in
[zarf-dev/zarf#2979
- [@&#8203;joonas](https://redirect.github.com/joonas) made their first
contribution in
[zarf-dev/zarf#2936

**Full Changelog**:
zarf-dev/zarf@v0.39.0...v0.40.1

###
[`v0.40.0`](https://redirect.github.com/zarf-dev/zarf/compare/v0.39.0...v0.40.0)

[Compare
Source](https://redirect.github.com/zarf-dev/zarf/compare/v0.39.0...v0.40.0)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these
updates again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/defenseunicorns/uds-core).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC44MC4wIiwidXBkYXRlZEluVmVyIjoiMzguODAuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove use of named returns
2 participants