Skip to content

Commit 7f8a71c

Browse files
committed
Update for golangci-lint 2.0
1 parent 7b03748 commit 7f8a71c

File tree

364 files changed

+1047
-812
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

364 files changed

+1047
-812
lines changed

Diff for: .gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.go text eol=lf

Diff for: .github/workflows/go.yml

-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ jobs:
1313
with:
1414
go-version-file: go.mod
1515
- uses: golangci/golangci-lint-action@v7
16-
if: ${{ matrix.os == 'windows-2019' }}
17-
- uses: golangci/golangci-lint-action@v7
18-
if: ${{ matrix.os != 'windows-2019' }}
19-
with:
20-
args: --enable goimports
2116

2217
test-unit: # <- name
2318
strategy:

Diff for: .golangci.yml

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
# https://golangci-lint.run/usage/configuration/
2-
run:
3-
timeout: 5m # 1m default times out on github-action runners
1+
version: "2"
42

5-
output:
6-
# Sort results by: filepath, line and column.
7-
sort-results: true
3+
linters:
4+
default: standard
5+
6+
settings:
7+
errcheck:
8+
check-blank: true # assignment to blank identifier: `_ := someFunc()`.
9+
10+
formatters:
11+
enable:
12+
- goimports

Diff for: agent/action/action_suite_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ package action_test
22

33
import (
44
"runtime"
5+
"testing"
56

67
. "github.com/onsi/ginkgo/v2"
78
. "github.com/onsi/gomega"
8-
9-
"testing"
109
)
1110

1211
const Windows = runtime.GOOS == "windows"

Diff for: agent/action/add_persistent_disk.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ package action
33
import (
44
"errors"
55

6-
boshsettings "github.com/cloudfoundry/bosh-agent/v2/settings"
76
bosherr "github.com/cloudfoundry/bosh-utils/errors"
7+
8+
boshsettings "github.com/cloudfoundry/bosh-agent/v2/settings"
89
)
910

1011
type AddPersistentDiskAction struct {

Diff for: agent/action/add_persistent_disk_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package action
22

33
import (
4-
"github.com/cloudfoundry/bosh-agent/v2/settings"
5-
fakesettings "github.com/cloudfoundry/bosh-agent/v2/settings/fakes"
64
. "github.com/onsi/ginkgo/v2"
75
. "github.com/onsi/gomega"
86
"github.com/pkg/errors"
7+
8+
"github.com/cloudfoundry/bosh-agent/v2/settings"
9+
fakesettings "github.com/cloudfoundry/bosh-agent/v2/settings/fakes"
910
)
1011

1112
var _ = Describe("AddPersistentDiskAction", func() {

Diff for: agent/action/apply.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ import (
55
"os"
66
"path"
77

8+
bosherr "github.com/cloudfoundry/bosh-utils/errors"
9+
810
boshappl "github.com/cloudfoundry/bosh-agent/v2/agent/applier"
911
boshas "github.com/cloudfoundry/bosh-agent/v2/agent/applier/applyspec"
1012
boshsettings "github.com/cloudfoundry/bosh-agent/v2/settings"
11-
bosherr "github.com/cloudfoundry/bosh-utils/errors"
1213

13-
"github.com/cloudfoundry/bosh-agent/v2/settings/directories"
1414
boshsys "github.com/cloudfoundry/bosh-utils/system"
15+
16+
"github.com/cloudfoundry/bosh-agent/v2/settings/directories"
1517
)
1618

1719
const (

Diff for: agent/action/apply_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ import (
77
. "github.com/onsi/ginkgo/v2"
88
. "github.com/onsi/gomega"
99

10+
boshsys "github.com/cloudfoundry/bosh-utils/system"
11+
fakesys "github.com/cloudfoundry/bosh-utils/system/fakes"
12+
1013
"github.com/cloudfoundry/bosh-agent/v2/agent/action"
1114
boshas "github.com/cloudfoundry/bosh-agent/v2/agent/applier/applyspec"
1215
fakeas "github.com/cloudfoundry/bosh-agent/v2/agent/applier/applyspec/fakes"
1316
fakeappl "github.com/cloudfoundry/bosh-agent/v2/agent/applier/fakes"
1417
boshsettings "github.com/cloudfoundry/bosh-agent/v2/settings"
1518
boshdir "github.com/cloudfoundry/bosh-agent/v2/settings/directories"
1619
fakesettings "github.com/cloudfoundry/bosh-agent/v2/settings/fakes"
17-
boshsys "github.com/cloudfoundry/bosh-utils/system"
18-
fakesys "github.com/cloudfoundry/bosh-utils/system/fakes"
1920
)
2021

2122
var _ = Describe("ApplyAction", func() {

Diff for: agent/action/cancel_task.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ package action
33
import (
44
"errors"
55

6-
boshtask "github.com/cloudfoundry/bosh-agent/v2/agent/task"
76
bosherr "github.com/cloudfoundry/bosh-utils/errors"
7+
8+
boshtask "github.com/cloudfoundry/bosh-agent/v2/agent/task"
89
)
910

1011
type CancelTaskAction struct {

Diff for: agent/action/compile_package.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ package action
33
import (
44
"errors"
55

6-
boshmodels "github.com/cloudfoundry/bosh-agent/v2/agent/applier/models"
7-
boshcomp "github.com/cloudfoundry/bosh-agent/v2/agent/compiler"
86
boshcrypto "github.com/cloudfoundry/bosh-utils/crypto"
97
bosherr "github.com/cloudfoundry/bosh-utils/errors"
8+
9+
boshmodels "github.com/cloudfoundry/bosh-agent/v2/agent/applier/models"
10+
boshcomp "github.com/cloudfoundry/bosh-agent/v2/agent/compiler"
1011
)
1112

1213
type CompilePackageAction struct {

Diff for: agent/action/compile_package_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ import (
77
. "github.com/onsi/ginkgo/v2"
88
. "github.com/onsi/gomega"
99

10+
boshcrypto "github.com/cloudfoundry/bosh-utils/crypto"
11+
1012
boshaction "github.com/cloudfoundry/bosh-agent/v2/agent/action"
1113
boshmodels "github.com/cloudfoundry/bosh-agent/v2/agent/applier/models"
1214
boshcomp "github.com/cloudfoundry/bosh-agent/v2/agent/compiler"
1315
fakecomp "github.com/cloudfoundry/bosh-agent/v2/agent/compiler/fakes"
14-
boshcrypto "github.com/cloudfoundry/bosh-utils/crypto"
1516
)
1617

1718
func getCompileActionArguments() (blobID string, multiDigest boshcrypto.MultipleDigest, name, version string, deps boshcomp.Dependencies) {

Diff for: agent/action/compile_package_with_signed_url.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ package action
33
import (
44
"errors"
55

6-
boshmodels "github.com/cloudfoundry/bosh-agent/v2/agent/applier/models"
7-
boshcomp "github.com/cloudfoundry/bosh-agent/v2/agent/compiler"
86
boshcrypto "github.com/cloudfoundry/bosh-utils/crypto"
97
bosherr "github.com/cloudfoundry/bosh-utils/errors"
8+
9+
boshmodels "github.com/cloudfoundry/bosh-agent/v2/agent/applier/models"
10+
boshcomp "github.com/cloudfoundry/bosh-agent/v2/agent/compiler"
1011
)
1112

1213
type CompilePackageWithSignedURLRequest struct {

Diff for: agent/action/compile_package_with_signed_url_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ import (
77
. "github.com/onsi/ginkgo/v2"
88
. "github.com/onsi/gomega"
99

10+
boshcrypto "github.com/cloudfoundry/bosh-utils/crypto"
11+
1012
boshaction "github.com/cloudfoundry/bosh-agent/v2/agent/action"
1113
boshmodels "github.com/cloudfoundry/bosh-agent/v2/agent/applier/models"
1214
boshcomp "github.com/cloudfoundry/bosh-agent/v2/agent/compiler"
1315
fakecomp "github.com/cloudfoundry/bosh-agent/v2/agent/compiler/fakes"
14-
boshcrypto "github.com/cloudfoundry/bosh-utils/crypto"
1516
)
1617

1718
func getCompileWithSignedURLActionArguments() boshaction.CompilePackageWithSignedURLRequest {

Diff for: agent/action/concrete_factory.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package action
22

33
import (
4+
bosherr "github.com/cloudfoundry/bosh-utils/errors"
5+
boshlog "github.com/cloudfoundry/bosh-utils/logger"
6+
47
boshappl "github.com/cloudfoundry/bosh-agent/v2/agent/applier"
58
boshas "github.com/cloudfoundry/bosh-agent/v2/agent/applier/applyspec"
69
boshagentblob "github.com/cloudfoundry/bosh-agent/v2/agent/blobstore"
@@ -13,8 +16,6 @@ import (
1316
boshnotif "github.com/cloudfoundry/bosh-agent/v2/notification"
1417
boshplatform "github.com/cloudfoundry/bosh-agent/v2/platform"
1518
boshsettings "github.com/cloudfoundry/bosh-agent/v2/settings"
16-
bosherr "github.com/cloudfoundry/bosh-utils/errors"
17-
boshlog "github.com/cloudfoundry/bosh-utils/logger"
1819
)
1920

2021
type concreteFactory struct {

Diff for: agent/action/delete_arp_entries.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func (a DeleteARPEntriesAction) IsLoggable() bool {
3535
func (a DeleteARPEntriesAction) Run(args DeleteARPEntriesActionArgs) (interface{}, error) {
3636
addresses := args.Ips
3737
for _, address := range addresses {
38-
_ = a.platform.DeleteARPEntryWithIP(address)
38+
_ = a.platform.DeleteARPEntryWithIP(address) //nolint:errcheck
3939
}
4040

4141
return map[string]interface{}{}, nil

Diff for: agent/action/drain.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ package action
33
import (
44
"errors"
55

6+
bosherr "github.com/cloudfoundry/bosh-utils/errors"
7+
boshlog "github.com/cloudfoundry/bosh-utils/logger"
8+
69
boshas "github.com/cloudfoundry/bosh-agent/v2/agent/applier/applyspec"
710
boshscript "github.com/cloudfoundry/bosh-agent/v2/agent/script"
811
boshdrain "github.com/cloudfoundry/bosh-agent/v2/agent/script/drain"
912
boshjobsuper "github.com/cloudfoundry/bosh-agent/v2/jobsupervisor"
1013
boshnotif "github.com/cloudfoundry/bosh-agent/v2/notification"
11-
bosherr "github.com/cloudfoundry/bosh-utils/errors"
12-
boshlog "github.com/cloudfoundry/bosh-utils/logger"
1314
)
1415

1516
type DrainAction struct {

Diff for: agent/action/drain_test.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import (
66
. "github.com/onsi/ginkgo/v2"
77
. "github.com/onsi/gomega"
88

9+
"github.com/cloudfoundry/bosh-utils/crypto"
10+
boshlog "github.com/cloudfoundry/bosh-utils/logger"
11+
912
"github.com/cloudfoundry/bosh-agent/v2/agent/action"
1013
boshas "github.com/cloudfoundry/bosh-agent/v2/agent/applier/applyspec"
1114
fakeas "github.com/cloudfoundry/bosh-agent/v2/agent/applier/applyspec/fakes"
@@ -14,8 +17,6 @@ import (
1417
"github.com/cloudfoundry/bosh-agent/v2/agent/script/scriptfakes"
1518
fakejobsuper "github.com/cloudfoundry/bosh-agent/v2/jobsupervisor/fakes"
1619
fakenotif "github.com/cloudfoundry/bosh-agent/v2/notification/fakes"
17-
"github.com/cloudfoundry/bosh-utils/crypto"
18-
boshlog "github.com/cloudfoundry/bosh-utils/logger"
1920
)
2021

2122
var _ = Describe("DrainAction", func() {
@@ -131,7 +132,7 @@ var _ = Describe("DrainAction", func() {
131132
jobScriptProvider.NewDrainScriptStub = func(jobName string, params boshdrain.ScriptParams) boshscript.CancellableScript {
132133
Expect(params).To(Equal(boshdrain.NewUpdateParams(currentSpec, newSpec)))
133134

134-
if jobName == "foo" {
135+
if jobName == "foo" { //nolint:staticcheck
135136
return fooScript
136137
} else if jobName == "bar" {
137138
return barScript
@@ -244,7 +245,7 @@ var _ = Describe("DrainAction", func() {
244245
jobScriptProvider.NewDrainScriptStub = func(jobName string, params boshdrain.ScriptParams) boshscript.CancellableScript {
245246
Expect(params).To(Equal(boshdrain.NewShutdownParams(currentSpec, nil)))
246247

247-
if jobName == "foo" {
248+
if jobName == "foo" { //nolint:staticcheck
248249
return fooScript
249250
} else if jobName == "bar" {
250251
return barScript
@@ -325,12 +326,12 @@ var _ = Describe("DrainAction", func() {
325326
})
326327

327328
It("does not unmonitor services ", func() {
328-
_, _ = act()
329+
_, _ = act() //nolint:errcheck
329330
Expect(jobSupervisor.Unmonitored).To(BeFalse())
330331
})
331332

332333
It("does not notify of job shutdown", func() {
333-
_, _ = act()
334+
_, _ = act() //nolint:errcheck
334335
Expect(notifier.NotifiedShutdown).To(BeFalse())
335336
})
336337
})

Diff for: agent/action/fakes/fake_factory.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func (f *FakeFactory) Create(method string) (boshaction.Action, error) {
2626
if action := f.registeredActions[method]; action != nil {
2727
return action, nil
2828
}
29-
return nil, errors.New("Action not found")
29+
return nil, errors.New("Action not found") //nolint:staticcheck
3030
}
3131

3232
func (f *FakeFactory) RegisterAction(method string, action *TestAction) {

Diff for: agent/action/fetch_logs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func (a FetchLogsAction) Run(logTypes string, filters []string) (value map[strin
4343
}
4444

4545
defer func() {
46-
_ = a.logsTarProvider.CleanUp(tarball)
46+
_ = a.logsTarProvider.CleanUp(tarball) //nolint:errcheck
4747
}()
4848

4949
blobID, multidigestSha, err := a.blobstore.Write("", tarball, nil)

Diff for: agent/action/fetch_logs_with_signed_url.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (a FetchLogsWithSignedURLAction) Run(request FetchLogsWithSignedURLRequest)
5353
}
5454

5555
defer func() {
56-
_ = a.logsTarProvider.CleanUp(tarball)
56+
_ = a.logsTarProvider.CleanUp(tarball) //nolint:errcheck
5757
}()
5858

5959
_, digest, err := a.blobDelegator.Write(request.SignedURL, tarball, request.BlobstoreHeaders)

Diff for: agent/action/fetch_logs_with_signed_url_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ package action_test
33
import (
44
"errors"
55

6-
fakelogstarprovider "github.com/cloudfoundry/bosh-agent/v2/agent/logstarprovider/logstarproviderfakes"
76
. "github.com/onsi/ginkgo/v2"
87
. "github.com/onsi/gomega"
98

9+
fakelogstarprovider "github.com/cloudfoundry/bosh-agent/v2/agent/logstarprovider/logstarproviderfakes"
10+
1011
boshassert "github.com/cloudfoundry/bosh-utils/assert"
1112
boshcrypto "github.com/cloudfoundry/bosh-utils/crypto"
1213

Diff for: agent/action/get_state.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ package action
33
import (
44
"errors"
55

6+
bosherr "github.com/cloudfoundry/bosh-utils/errors"
7+
68
boshas "github.com/cloudfoundry/bosh-agent/v2/agent/applier/applyspec"
79
boshjobsuper "github.com/cloudfoundry/bosh-agent/v2/jobsupervisor"
810
boshvitals "github.com/cloudfoundry/bosh-agent/v2/platform/vitals"
911
boshsettings "github.com/cloudfoundry/bosh-agent/v2/settings"
10-
bosherr "github.com/cloudfoundry/bosh-utils/errors"
1112
)
1213

1314
type GetStateAction struct {

Diff for: agent/action/get_state_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import (
66
. "github.com/onsi/ginkgo/v2"
77
. "github.com/onsi/gomega"
88

9+
boshassert "github.com/cloudfoundry/bosh-utils/assert"
10+
911
"github.com/cloudfoundry/bosh-agent/v2/agent/action"
1012
boshas "github.com/cloudfoundry/bosh-agent/v2/agent/applier/applyspec"
1113
fakeas "github.com/cloudfoundry/bosh-agent/v2/agent/applier/applyspec/fakes"
@@ -15,7 +17,6 @@ import (
1517
"github.com/cloudfoundry/bosh-agent/v2/platform/vitals/vitalsfakes"
1618
boshsettings "github.com/cloudfoundry/bosh-agent/v2/settings"
1719
fakesettings "github.com/cloudfoundry/bosh-agent/v2/settings/fakes"
18-
boshassert "github.com/cloudfoundry/bosh-utils/assert"
1920
)
2021

2122
var _ = Describe("GetState", func() {

Diff for: agent/action/get_task.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ package action
33
import (
44
"errors"
55

6-
boshtask "github.com/cloudfoundry/bosh-agent/v2/agent/task"
76
bosherr "github.com/cloudfoundry/bosh-utils/errors"
7+
8+
boshtask "github.com/cloudfoundry/bosh-agent/v2/agent/task"
89
)
910

1011
type GetTaskAction struct {

Diff for: agent/action/get_task_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ import (
66
. "github.com/onsi/ginkgo/v2"
77
. "github.com/onsi/gomega"
88

9+
boshassert "github.com/cloudfoundry/bosh-utils/assert"
10+
911
"github.com/cloudfoundry/bosh-agent/v2/agent/action"
1012
boshtask "github.com/cloudfoundry/bosh-agent/v2/agent/task"
1113
faketask "github.com/cloudfoundry/bosh-agent/v2/agent/task/fakes"
12-
boshassert "github.com/cloudfoundry/bosh-utils/assert"
1314
)
1415

1516
var _ = Describe("GetTask", func() {

Diff for: agent/action/info.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package action
22

3-
import "errors"
3+
import (
4+
"errors"
5+
)
46

57
type InfoAction struct{}
68

Diff for: agent/action/list_disk.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ package action
33
import (
44
"errors"
55

6-
boshplatform "github.com/cloudfoundry/bosh-agent/v2/platform"
7-
boshsettings "github.com/cloudfoundry/bosh-agent/v2/settings"
86
bosherr "github.com/cloudfoundry/bosh-utils/errors"
97
boshlog "github.com/cloudfoundry/bosh-utils/logger"
8+
9+
boshplatform "github.com/cloudfoundry/bosh-agent/v2/platform"
10+
boshsettings "github.com/cloudfoundry/bosh-agent/v2/settings"
1011
)
1112

1213
type ListDiskAction struct {

0 commit comments

Comments
 (0)