Skip to content

Commit 93ac2ea

Browse files
committed
Update for golangci-lint 2.0
1 parent 2c4e106 commit 93ac2ea

File tree

193 files changed

+594
-654
lines changed

Some content is hidden

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

193 files changed

+594
-654
lines changed

.golangci.yml

Lines changed: 8 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +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

53
linters:
6-
disable-all: true
7-
enable:
8-
# - bodyclose
9-
# - dogsled
10-
# - dupl
11-
- errcheck
12-
- errchkjson
13-
- errorlint
14-
# - funlen
15-
# - gocognit
16-
- goconst
17-
# - gocritic
18-
# - gocyclo
19-
- goimports
20-
- goprintffuncname
21-
- gosec
22-
- gosimple
23-
- govet
24-
- ineffassign
25-
- makezero
26-
# - misspell
27-
# - musttag
28-
- nakedret
29-
- noctx
30-
- nolintlint
31-
- reassign
32-
# - revive
33-
- staticcheck
34-
# - stylecheck
35-
- typecheck
36-
- unconvert
37-
# - unparam
38-
- unused
39-
# - whitespace
40-
41-
linters-settings:
42-
gosec:
43-
excludes:
44-
- G115 #Potential integer overflow when converting between integer types
45-
# misspell:
46-
# locale: US
47-
nolintlint:
48-
allow-unused: true # report any unused nolint directives
49-
require-explanation: false # don't require an explanation for nolint directives
50-
require-specific: true # require nolint directives to be specific about which linter is being skipped
4+
default: standard
515

52-
issues:
53-
exclude-dirs:
54-
- test/
55-
- ".*fakes.*"
56-
- ".*mocks.*"
57-
- integration/
58-
exclude-files:
59-
- ".*_test\\.go"
6+
settings:
7+
errcheck:
8+
check-blank: true # assignment to blank identifier: `_ := someFunc()`.
609

61-
output:
62-
# Sort results by: filepath, line and column.
63-
sort-results: true
10+
formatters:
11+
enable:
12+
- goimports

acceptance/config.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type Config struct {
1717
func NewConfig(fs boshsys.FileSystem) (*Config, error) {
1818
path := os.Getenv("BOSH_INIT_CONFIG_PATH")
1919
if path == "" {
20-
return &Config{}, errors.New("Must provide config file via BOSH_INIT_CONFIG_PATH environment variable")
20+
return &Config{}, errors.New("Must provide config file via BOSH_INIT_CONFIG_PATH environment variable") //nolint:staticcheck
2121
}
2222

2323
configContents, err := fs.ReadFile(path)
@@ -36,15 +36,15 @@ func NewConfig(fs boshsys.FileSystem) (*Config, error) {
3636

3737
func (c *Config) Validate() error {
3838
if c.StemcellPath == "" {
39-
return errors.New("Must provide 'stemcell_path' in config")
39+
return errors.New("Must provide 'stemcell_path' in config") //nolint:staticcheck
4040
}
4141

4242
if c.CPIReleasePath == "" {
43-
return errors.New("Must provide 'cpi_release_path' in config")
43+
return errors.New("Must provide 'cpi_release_path' in config") //nolint:staticcheck
4444
}
4545

4646
if c.DummyCompiledReleasePath == "" {
47-
return errors.New("Must provide 'dummy_compiled_release_path' in config")
47+
return errors.New("Must provide 'dummy_compiled_release_path' in config") //nolint:staticcheck
4848
}
4949

5050
return nil

acceptance/instance_ssh.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (s *instanceSSH) setupSSH() (boshsys.File, error) {
4646
success := false
4747
defer func() {
4848
if !success {
49-
_ = s.fileSystem.RemoveAll(sshConfigFile.Name())
49+
_ = s.fileSystem.RemoveAll(sshConfigFile.Name()) //nolint:errcheck
5050
}
5151
}()
5252

acceptance/lifecycle_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ var _ = Describe("bosh", func() {
109109
}
110110

111111
var deploy = func(manifestFile string, args ...string) string {
112-
fmt.Fprintf(GinkgoWriter, "\n--- DEPLOY ---\n")
112+
fmt.Fprintf(GinkgoWriter, "\n--- DEPLOY ---\n") //nolint:errcheck
113113

114114
stdout := &bytes.Buffer{}
115115
multiWriter := io.MultiWriter(stdout, GinkgoWriter)
@@ -126,7 +126,7 @@ var _ = Describe("bosh", func() {
126126
}
127127

128128
var deleteDeployment = func(manifest string, extraDeployArgs ...string) string {
129-
fmt.Fprintf(GinkgoWriter, "\n--- DELETE DEPLOYMENT ---\n")
129+
fmt.Fprintf(GinkgoWriter, "\n--- DELETE DEPLOYMENT ---\n") //nolint:errcheck
130130

131131
stdout := &bytes.Buffer{}
132132
multiWriter := io.MultiWriter(stdout, GinkgoWriter)
@@ -349,7 +349,7 @@ var _ = Describe("bosh", func() {
349349

350350
It("fails pinging the agent", func() {
351351
By("deploying with a bogus CA cert")
352-
fmt.Fprintf(GinkgoWriter, "\n--- DEPLOY ---\n")
352+
fmt.Fprintf(GinkgoWriter, "\n--- DEPLOY ---\n") //nolint:errcheck
353353

354354
stdoutBuffer := &bytes.Buffer{}
355355
multiWriter := io.MultiWriter(stdoutBuffer, GinkgoWriter)

acceptance/test_environment.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (e testEnvironment) Path(name string) string {
4040

4141
func (e testEnvironment) Copy(destName, srcPath string) error {
4242
if srcPath == "" {
43-
return fmt.Errorf("Cannot use an empty source file path '' for destination file '%s'", destName)
43+
return fmt.Errorf("Cannot use an empty source file path '' for destination file '%s'", destName) //nolint:staticcheck
4444
}
4545

4646
_, _, exitCode, err := e.cmdRunner.RunCommand(

bin/lint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export PATH=${go_bin_path}:${PATH}
1515

1616
golangci-lint version
1717

18-
linted_os_list=(linux)
18+
linted_os_list=(linux darwin)
1919

2020
for os in "${linted_os_list[@]}"; do
2121
echo "lint-ing with GOOS=${os}..."

cloud/errors.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ func (e cpiError) OkToRetry() bool {
5757
}
5858

5959
func mapsToNotImplementedError(method string, cmdError CmdError) bool {
60-
matched, _ := regexp.MatchString("^Invalid Method:", cmdError.Message)
60+
matched, _ := regexp.MatchString("^Invalid Method:", cmdError.Message) //nolint:errcheck
6161

6262
if cmdError.Type == "Bosh::Clouds::CloudError" && matched {
6363
return true
6464
}
6565

66-
matched, _ = regexp.MatchString("^Method is not known, got", cmdError.Message)
66+
matched, _ = regexp.MatchString("^Method is not known, got", cmdError.Message) //nolint:errcheck
6767

6868
if cmdError.Type == "InvalidCall" && matched {
6969
return true

cmd/add_blob.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
bosherr "github.com/cloudfoundry/bosh-utils/errors"
77
boshsys "github.com/cloudfoundry/bosh-utils/system"
88

9-
. "github.com/cloudfoundry/bosh-cli/v7/cmd/opts"
9+
. "github.com/cloudfoundry/bosh-cli/v7/cmd/opts" //nolint:staticcheck
1010
boshreldir "github.com/cloudfoundry/bosh-cli/v7/releasedir"
1111
boshui "github.com/cloudfoundry/bosh-cli/v7/ui"
1212
)
@@ -27,7 +27,7 @@ func (c AddBlobCmd) Run(opts AddBlobOpts) error {
2727
return bosherr.WrapErrorf(err, "Opening blob")
2828
}
2929

30-
defer file.Close()
30+
defer file.Close() //nolint:errcheck
3131

3232
blob, err := c.blobsDir.TrackBlob(opts.Args.BlobsPath, file)
3333
if err != nil {

cmd/alias_env.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package cmd
22

33
import (
44
cmdconf "github.com/cloudfoundry/bosh-cli/v7/cmd/config"
5-
. "github.com/cloudfoundry/bosh-cli/v7/cmd/opts"
5+
. "github.com/cloudfoundry/bosh-cli/v7/cmd/opts" //nolint:staticcheck
66
boshui "github.com/cloudfoundry/bosh-cli/v7/ui"
77
)
88

cmd/attach_disk.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package cmd
22

33
import (
4-
. "github.com/cloudfoundry/bosh-cli/v7/cmd/opts"
4+
. "github.com/cloudfoundry/bosh-cli/v7/cmd/opts" //nolint:staticcheck
55
boshdir "github.com/cloudfoundry/bosh-cli/v7/director"
66
)
77

0 commit comments

Comments
 (0)