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 270611d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
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
13 changes: 0 additions & 13 deletions src/pkg/cluster/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,19 +236,6 @@ func TestMergeZarfStateArtifact(t *testing.T) {
InternalServer: true,
},
},
{
name: "old state is not internal server auto generate push token",
oldArtifactServer: types.ArtifactServerInfo{
PushToken: "foobar",
Address: types.ZarfInClusterArtifactServiceURL,
InternalServer: false,
},
expectedArtifactServer: types.ArtifactServerInfo{
PushToken: "foobar",
Address: types.ZarfInClusterArtifactServiceURL,
InternalServer: true,
},
},
{
name: "old state is not internal server auto generate push token but init options does not match",
initArtifactServer: types.ArtifactServerInfo{
Expand Down

0 comments on commit 270611d

Please sign in to comment.