Skip to content

Commit 44012cd

Browse files
committed
Update for golangci-lint 2.0
1 parent 4b5a77b commit 44012cd

Some content is hidden

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

78 files changed

+392
-376
lines changed

.github/workflows/go.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ jobs:
1818
with:
1919
go-version-file: go.mod
2020
- uses: golangci/golangci-lint-action@v7
21-
with:
22-
args: --enable goimports
2321

2422
test-unit:
2523
runs-on: ubuntu-latest

.golangci.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
# https://golangci-lint.run/usage/configuration/
2-
run:
3-
timeout: 4m # 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

acceptance-tests/actors/aws.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,17 @@ import (
44
"fmt"
55
"os"
66

7-
"github.com/cloudfoundry/bosh-bootloader/application"
8-
"github.com/cloudfoundry/bosh-bootloader/aws"
9-
"github.com/cloudfoundry/bosh-bootloader/storage"
10-
"github.com/cloudfoundry/bosh-bootloader/testhelpers"
11-
12-
. "github.com/onsi/gomega"
13-
147
awslib "github.com/aws/aws-sdk-go/aws"
15-
acceptance "github.com/cloudfoundry/bosh-bootloader/acceptance-tests"
16-
178
"github.com/aws/aws-sdk-go/aws/credentials"
189
"github.com/aws/aws-sdk-go/aws/session"
1910
"github.com/aws/aws-sdk-go/service/elb"
11+
"github.com/cloudfoundry/bosh-bootloader/acceptance-tests"
12+
. "github.com/onsi/gomega" //nolint:staticcheck
13+
14+
"github.com/cloudfoundry/bosh-bootloader/application"
15+
"github.com/cloudfoundry/bosh-bootloader/aws"
16+
"github.com/cloudfoundry/bosh-bootloader/storage"
17+
"github.com/cloudfoundry/bosh-bootloader/testhelpers"
2018
)
2119

2220
func NewAWSLBHelper(c acceptance.Config) awsLBHelper {

acceptance-tests/actors/azure.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import (
44
"context"
55
"fmt"
66

7-
"github.com/Azure/azure-sdk-for-go/sdk/azidentity" //nolint:staticcheck
8-
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork" //nolint:staticcheck
9-
acceptance "github.com/cloudfoundry/bosh-bootloader/acceptance-tests"
7+
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
8+
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork"
9+
"github.com/cloudfoundry/bosh-bootloader/acceptance-tests"
1010

11-
. "github.com/onsi/gomega"
11+
. "github.com/onsi/gomega" //nolint:staticcheck
1212
)
1313

1414
type azureLBHelper struct {

acceptance-tests/actors/bbl.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ import (
1010
"syscall"
1111
"time"
1212

13-
acceptance "github.com/cloudfoundry/bosh-bootloader/acceptance-tests"
1413
"github.com/kr/pty"
1514

15+
"github.com/cloudfoundry/bosh-bootloader/acceptance-tests"
16+
1617
"github.com/onsi/ginkgo/v2"
17-
. "github.com/onsi/gomega"
18+
. "github.com/onsi/gomega" //nolint:staticcheck
1819
"github.com/onsi/gomega/gbytes"
1920
"github.com/onsi/gomega/gexec"
2021
)
@@ -80,9 +81,9 @@ func (b BBL) Rotate() *gexec.Session {
8081

8182
func (b BBL) VerifySSH(session *gexec.Session, ptmx *os.File) {
8283
time.Sleep(5 * time.Second)
83-
fmt.Fprintln(ptmx, "whoami | rev")
84+
fmt.Fprintln(ptmx, "whoami | rev") //nolint:errcheck
8485
Eventually(session.Out, 10).Should(gbytes.Say("xobpmuj")) // jumpbox in reverse
85-
fmt.Fprintln(ptmx, "exit 0")
86+
fmt.Fprintln(ptmx, "exit 0") //nolint:errcheck
8687
Eventually(session, 5).Should(gexec.Exit(0))
8788
}
8889

@@ -185,7 +186,7 @@ func (b BBL) SaveDirectorCA() string {
185186

186187
file, err := os.CreateTemp("", "")
187188
Expect(err).NotTo(HaveOccurred())
188-
defer file.Close()
189+
defer file.Close() //nolint:errcheck
189190

190191
file.Write(stdout.Bytes()) //nolint:errcheck
191192

@@ -207,8 +208,8 @@ func (b BBL) StartSSHTunnel() *gexec.Session {
207208
for i := 0; i < len(printEnvLines); i++ {
208209
if strings.HasPrefix(printEnvLines[i], "ssh ") {
209210
sshCmd := strings.TrimPrefix(printEnvLines[i], "ssh ")
210-
sshCmd = strings.Replace(sshCmd, "$JUMPBOX_PRIVATE_KEY", getExport("JUMPBOX_PRIVATE_KEY", printEnvLines), -1)
211-
sshCmd = strings.Replace(sshCmd, "-f ", "", -1)
211+
sshCmd = strings.Replace(sshCmd, "$JUMPBOX_PRIVATE_KEY", getExport("JUMPBOX_PRIVATE_KEY", printEnvLines), -1) //nolint:staticcheck
212+
sshCmd = strings.Replace(sshCmd, "-f ", "", -1) //nolint:staticcheck
212213
sshArgs = strings.Split(sshCmd, " ")
213214
}
214215
}
@@ -280,7 +281,7 @@ func (b BBL) interactiveExecute(args []string, stdout io.Writer, stderr io.Write
280281

281282
ptmx, pts, err := pty.Open()
282283
Expect(err).NotTo(HaveOccurred())
283-
defer ptmx.Close()
284+
defer ptmx.Close() //nolint:errcheck
284285

285286
cmd.Stdin = pts
286287
cmd.Stdout = pts
@@ -295,7 +296,7 @@ func (b BBL) interactiveExecute(args []string, stdout io.Writer, stderr io.Write
295296
Expect(err).NotTo(HaveOccurred())
296297

297298
// Close our open reference to pts so that ptmx recieves EOF
298-
pts.Close()
299+
pts.Close() //nolint:errcheck
299300

300301
actions(session, ptmx)
301302

acceptance-tests/actors/gcp.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ import (
55
"encoding/json"
66
"os"
77

8-
"golang.org/x/oauth2/google"
9-
10-
acceptance "github.com/cloudfoundry/bosh-bootloader/acceptance-tests"
8+
"github.com/cloudfoundry/bosh-bootloader/acceptance-tests"
119
"github.com/cloudfoundry/bosh-bootloader/testhelpers"
12-
compute "google.golang.org/api/compute/v1"
13-
14-
. "github.com/onsi/gomega"
10+
. "github.com/onsi/gomega" //nolint:staticcheck
11+
"golang.org/x/oauth2/google"
12+
"google.golang.org/api/compute/v1"
1513
)
1614

1715
type gcpLBHelper struct {

acceptance-tests/actors/iaas_helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package actors
33
import (
44
"fmt"
55

6-
acceptance "github.com/cloudfoundry/bosh-bootloader/acceptance-tests"
6+
"github.com/cloudfoundry/bosh-bootloader/acceptance-tests"
77
)
88

99
type IAASLBHelper interface {

acceptance-tests/bbl/latest_error_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"os/exec"
66
"path/filepath"
77

8-
acceptance "github.com/cloudfoundry/bosh-bootloader/acceptance-tests"
8+
"github.com/cloudfoundry/bosh-bootloader/acceptance-tests"
99
"github.com/cloudfoundry/bosh-bootloader/storage"
1010
. "github.com/onsi/ginkgo/v2"
1111
. "github.com/onsi/gomega"

acceptance-tests/bbl/plan_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ import (
55
"path/filepath"
66
"strings"
77

8-
acceptance "github.com/cloudfoundry/bosh-bootloader/acceptance-tests"
9-
"github.com/cloudfoundry/bosh-bootloader/acceptance-tests/actors"
10-
"github.com/cloudfoundry/bosh-bootloader/storage"
118
. "github.com/onsi/ginkgo/v2"
129
. "github.com/onsi/gomega"
1310
"github.com/onsi/gomega/gbytes"
1411
"github.com/onsi/gomega/gexec"
12+
13+
"github.com/cloudfoundry/bosh-bootloader/acceptance-tests"
14+
"github.com/cloudfoundry/bosh-bootloader/acceptance-tests/actors"
15+
"github.com/cloudfoundry/bosh-bootloader/storage"
1516
)
1617

1718
var _ = Describe("plan", func() {
@@ -80,7 +81,7 @@ var _ = Describe("plan", func() {
8081
patchFileHandle, err = os.Create(patchFile)
8182
Expect(err).NotTo(HaveOccurred())
8283
})
83-
defer patchFileHandle.Close()
84+
defer patchFileHandle.Close() //nolint:errcheck
8485

8586
By("rerunning bbl plan", func() {
8687
session = bbl.Plan("--name", bbl.PredefinedEnvID())

acceptance-tests/bbl/print_env_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package acceptance_test
33
import (
44
"fmt"
55

6-
acceptance "github.com/cloudfoundry/bosh-bootloader/acceptance-tests"
6+
"github.com/cloudfoundry/bosh-bootloader/acceptance-tests"
77
"github.com/cloudfoundry/bosh-bootloader/acceptance-tests/actors"
88
. "github.com/onsi/ginkgo/v2"
99
. "github.com/onsi/gomega"

0 commit comments

Comments
 (0)