Skip to content

Commit

Permalink
refactor: enable ineffassign linter (#2500)
Browse files Browse the repository at this point in the history
This change enables the ineffassign linter and fixes the only complaint
by refactoring the select state filter.

Part of #2503
Depends on #2499

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/.github/CONTRIBUTING.md#developer-workflow)
followed
  • Loading branch information
phillebaba committed May 20, 2024
1 parent 0481d43 commit e7f6ae0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/pkg/cluster/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ func MergeZarfState(oldState *types.ZarfState, initOptions types.ZarfInitOptions
// TODO: Replace use of reflections with explicit setting
newState.RegistryInfo = helpers.MergeNonZero(newState.RegistryInfo, initOptions.RegistryInfo)
// Set the state of the internal registry if it has changed
// TODO: Internal registry should be a function of the address and not a property.
if newState.RegistryInfo.Address == fmt.Sprintf("%s:%d", helpers.IPV4Localhost, newState.RegistryInfo.NodePort) {
newState.RegistryInfo.InternalRegistry = true
} else {
Expand All @@ -290,6 +291,7 @@ func MergeZarfState(oldState *types.ZarfState, initOptions types.ZarfInitOptions
newState.GitServer = helpers.MergeNonZero(newState.GitServer, initOptions.GitServer)

// Set the state of the internal git server if it has changed
// TODO: Internal server should be a function of the address and not a property.
if newState.GitServer.Address == types.ZarfInClusterGitServiceURL {
newState.GitServer.InternalServer = true
} else {
Expand All @@ -313,6 +315,7 @@ func MergeZarfState(oldState *types.ZarfState, initOptions types.ZarfInitOptions
newState.ArtifactServer = helpers.MergeNonZero(newState.ArtifactServer, initOptions.ArtifactServer)

// Set the state of the internal artifact server if it has changed
// TODO: Internal server should be a function of the address and not a property.
if newState.ArtifactServer.Address == types.ZarfInClusterArtifactServiceURL {
newState.ArtifactServer.InternalServer = true
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/pkg/cluster/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func TestMergeZarfStateArtifact(t *testing.T) {
oldArtifactServer: types.ArtifactServerInfo{
PushToken: "foobar",
Address: types.ZarfInClusterArtifactServiceURL,
InternalServer: false,
InternalServer: true,
},
expectedArtifactServer: types.ArtifactServerInfo{
PushToken: "foobar",
Expand Down

0 comments on commit e7f6ae0

Please sign in to comment.