Skip to content

Commit

Permalink
golint fixes (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
lingrino authored Sep 6, 2024
1 parent 4f3cce7 commit 43a2fcb
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ linters:
- bodyclose
- containedctx
- contextcheck
- copyloopvar
- durationcheck
- errcheck
- errname
- errorlint
- exhaustive
- exportloopref
- forcetypeassert
- funlen
- gochecknoglobals
Expand All @@ -24,7 +24,6 @@ linters:
- godot
- gofmt
- goimports
- gomnd
- goprintffuncname
- gosec
- gosimple
Expand All @@ -34,6 +33,7 @@ linters:
- maintidx
- makezero
- misspell
- mnd
- nakedret
- nestif
- nilerr
Expand Down Expand Up @@ -93,7 +93,7 @@ issues:
linters:
- wrapcheck # errors are wrapped in other functions
- gocognit # the main function can have bigger complexity
- nestif # the main function can have bigger complexity
- nestif # the main function can have bigger complexity
- funlen # the main function can have bigger complexity
- gocyclo # the main function can have bigger complexity
- path: pkg/aws/nodegroups.go
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/loomhq/eks-ng-ami-updater

go 1.21
go 1.23

require github.com/rs/zerolog v1.33.0

Expand Down
2 changes: 1 addition & 1 deletion pkg/aws/ami.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func IsLastAmiOldEnough(skipNewerThan uint, nodegroup NodeGroup, today time.Time
return false, fmt.Errorf("region: %s, cluster: %s, nodegroup: %s : %w", nodegroup.Region, nodegroup.ClusterName, nodegroup.ClusterName, err)
}

hoursToSkip := -24 * time.Duration(skipNewerThan) * time.Hour
hoursToSkip := -24 * time.Duration(skipNewerThan) * time.Hour //nolint:gosec // no overflow risk
criticalDay := today.Add(hoursToSkip).UTC()

logWithContext.Debug().Time("criticalDay", criticalDay).Uint("skipNewerThan", skipNewerThan).
Expand Down
2 changes: 0 additions & 2 deletions pkg/aws/ami_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,6 @@ func TestIsLastAmiOldEnough(t *testing.T) {
}

for _, test := range tests {
test := test

fmt.Printf("test: %s\n", test.name)
awsSsm := testSsm{
OutputGetParameter: &test.mockedOutputGetParameterSsm,
Expand Down
2 changes: 0 additions & 2 deletions pkg/aws/clusters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ func TestGetClusters(t *testing.T) {
}

for _, test := range tests {
test := test

fmt.Printf("test: %s\n", test.name)
awsEks := testEks{OutputListClusters: &test.mockedOutput}

Expand Down
2 changes: 0 additions & 2 deletions pkg/aws/nodegroups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ func TestGetNodegroupsFromCluster(t *testing.T) {
}

for _, test := range tests {
test := test

fmt.Printf("test: %s\n", test.name)
awsEks := testEks{OutputListNodegroups: &test.mockedOutput}

Expand Down
2 changes: 0 additions & 2 deletions pkg/aws/regions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ func TestGetRegionsToCheck(t *testing.T) {
}

for _, test := range tests {
test := test

fmt.Printf("test: %s\n", test.name)
awsEc2 := testEc2{OutputRegions: &test.mockedOutput}
regionsVar := test.regionsVar
Expand Down
1 change: 0 additions & 1 deletion pkg/updater/updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ func UpdateAmi(dryrun bool, skipNewerThanDays uint, regionsVar, nodegroupsVar []
}

for _, nodegroup := range nodegroups {
nodegroup := nodegroup
errorGroup.Go(func() error {
return aws.AmiUpdate(nodegroup.Region, nodegroup.ClusterName, nodegroup.NodegroupName, dryrun, ctx)
})
Expand Down

0 comments on commit 43a2fcb

Please sign in to comment.