diff --git a/.golangci.yaml b/.golangci.yaml index 75778c0888..a8812d1976 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -5,6 +5,7 @@ linters: enable: - gosimple - govet + - ineffassign - staticcheck - unused - revive diff --git a/src/pkg/packager/filters/select.go b/src/pkg/packager/filters/select.go index 457643a3c6..2927fb827c 100644 --- a/src/pkg/packager/filters/select.go +++ b/src/pkg/packager/filters/select.go @@ -26,26 +26,16 @@ type selectStateFilter struct { // Apply applies the filter. func (f *selectStateFilter) Apply(pkg types.ZarfPackage) ([]types.ZarfComponent, error) { isPartial := len(f.requestedComponents) > 0 && f.requestedComponents[0] != "" - result := []types.ZarfComponent{} - for _, component := range pkg.Components { - selectState := unknown - + selectState := included if isPartial { selectState, _ = includedOrExcluded(component.Name, f.requestedComponents) - - if selectState == excluded { - continue - } - } else { - selectState = included } - - if selectState == included { - result = append(result, component) + if selectState != included { + continue } + result = append(result, component) } - return result, nil }