Skip to content

Commit

Permalink
Bump golangci-lint to 1.56.0
Browse files Browse the repository at this point in the history
This adds support for Go 1.22.

Required fixes:
* compare strings with "" instead of checking their length
* various wsl cuddling fixes

Signed-off-by: Stephen Kitt <[email protected]>
  • Loading branch information
skitt committed Feb 7, 2024
1 parent 7dc13d5 commit 976a347
Show file tree
Hide file tree
Showing 7 changed files with 163 additions and 197 deletions.
2 changes: 2 additions & 0 deletions test/e2e/framework/clusterglobalegressip.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func AwaitAllocatedEgressIPs(client dynamic.ResourceInterface, name string) []st
if apierrors.IsNotFound(err) {
return nil, nil //nolint:nilnil // We want to repeat but let the checker known that nothing was found.
}

return resGip, err
},
func(result interface{}) (bool, string, error) {
Expand All @@ -60,6 +61,7 @@ func AwaitAllocatedEgressIPs(client dynamic.ResourceInterface, name string) []st
if len(globalIPs) == 0 {
return false, fmt.Sprintf("Egress IP resource %q exists but allocatedIPs not available yet", name), nil
}

return true, "", nil
})

Expand Down
5 changes: 4 additions & 1 deletion test/e2e/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func BeforeSuite() {
By("Creating kubernetes clients")

if len(RestConfigs) == 0 {
if len(TestContext.KubeConfig) > 0 {
if TestContext.KubeConfig != "" {
Expect(TestContext.KubeConfigs).To(BeEmpty(),
"Either KubeConfig or KubeConfigs must be specified but not both")

Expand All @@ -182,6 +182,7 @@ func BeforeSuite() {
} else if len(TestContext.KubeConfigs) > 0 {
Expect(TestContext.KubeConfigs).To(HaveLen(len(TestContext.ClusterIDs)),
"One ClusterID must be provided for each item in the KubeConfigs")

for _, kubeConfig := range TestContext.KubeConfigs {
RestConfigs = append(RestConfigs, createRestConfig(kubeConfig, ""))
}
Expand Down Expand Up @@ -570,6 +571,7 @@ func AwaitResultOrError(opMsg string, doOperation DoOperationFunc, checkResult C
if IsTransientError(err, opMsg) {
return false, nil
}

return false, err
}

Expand All @@ -584,6 +586,7 @@ func AwaitResultOrError(opMsg string, doOperation DoOperationFunc, checkResult C
}

lastMsg = msg

return false, nil
})

Expand Down
6 changes: 6 additions & 0 deletions test/e2e/framework/gateways.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ func (f *Framework) AwaitGatewayWithStatus(cluster ClusterIndex, name, status st

gw := result.(*unstructured.Unstructured)
haStatus := NestedString(gw.Object, "status", "haStatus")

if haStatus != status {
return false, fmt.Sprintf("gateway %q exists but has wrong status %q, expected %q", gw.GetName(), haStatus, status), nil
}

return true, "", nil
})

Expand Down Expand Up @@ -105,6 +107,7 @@ func (f *Framework) AwaitGatewayRemoved(cluster ClusterIndex, name string) {
if apierrors.IsNotFound(err) {
return true, nil
}

return false, err
},
func(result interface{}) (bool, string, error) {
Expand All @@ -130,6 +133,7 @@ func (f *Framework) AwaitGatewayFullyConnected(cluster ClusterIndex, name string

gw := result.(*unstructured.Unstructured)
haStatus := NestedString(gw.Object, "status", "haStatus")

if haStatus != "active" {
return false, fmt.Sprintf("Gateway %q exists but not active yet",
gw.GetName()), nil
Expand All @@ -143,6 +147,7 @@ func (f *Framework) AwaitGatewayFullyConnected(cluster ClusterIndex, name string
for _, o := range connections {
conn := o.(map[string]interface{})
status, _, _ := unstructured.NestedString(conn, "status")

if status != "connected" {
return false, fmt.Sprintf("Gateway %q is active but cluster %q is not connected: Status: %q, Message: %q",
name, NestedString(conn, "endpoint", "cluster_id"), status, NestedString(conn, "statusMessage")), nil
Expand Down Expand Up @@ -186,6 +191,7 @@ func (f *Framework) DeleteGateway(cluster ClusterIndex, name string) {
if apierrors.IsNotFound(err) {
return nil, nil //nolint:nilnil // We want to repeat but let the checker known that nothing was found.
}

return nil, err
}, NoopCheckResult)
}
Expand Down
3 changes: 3 additions & 0 deletions test/e2e/framework/globalingressips.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func (f *Framework) AwaitGlobalIngressIP(cluster ClusterIndex, name, namespace s
if apierrors.IsNotFound(err) {
return nil, nil //nolint:nilnil // We want to repeat but let the checker known that nothing was found.
}

return resGip, err
},
func(result interface{}) (bool, string, error) {
Expand All @@ -56,6 +57,7 @@ func (f *Framework) AwaitGlobalIngressIP(cluster ClusterIndex, name, namespace s
return false, fmt.Sprintf("GlobalIngress %q exists but allocatedIP not available yet",
name), nil
}

return true, "", nil
})

Expand All @@ -73,6 +75,7 @@ func (f *Framework) AwaitGlobalIngressIPRemoved(cluster ClusterIndex, name, name
if apierrors.IsNotFound(err) {
return true, nil
}

return false, err
},
func(result interface{}) (bool, string, error) {
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/framework/pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ func (f *Framework) AwaitRouteAgentPodOnNode(cluster ClusterIndex, nodeName stri
}, func(result interface{}) (bool, string, error) {
pods := result.(*v1.PodList)
var podNodes []string

for i := range pods.Items {
pod := &pods.Items[i]
if pod.Spec.NodeName == nodeName {
Expand All @@ -152,6 +153,7 @@ func (f *Framework) AwaitRouteAgentPodOnNode(cluster ClusterIndex, nodeName stri
}

found = pod

return true, "", nil
}

Expand Down
88 changes: 45 additions & 43 deletions tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.21

require (
github.com/docker/buildx v0.12.1
github.com/golangci/golangci-lint v1.55.2
github.com/golangci/golangci-lint v1.56.0
github.com/mikefarah/yq/v4 v4.40.5
github.com/psampaz/go-mod-outdated v0.9.0
helm.sh/helm/v3 v3.14.0
Expand All @@ -19,11 +19,11 @@ require (
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
github.com/Antonboom/errname v0.1.12 // indirect
github.com/Antonboom/nilnil v0.1.7 // indirect
github.com/Antonboom/testifylint v0.2.3 // indirect
github.com/Antonboom/testifylint v1.1.0 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/BurntSushi/toml v1.3.2 // indirect
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect
github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0 // indirect
github.com/GaijinEntertainment/go-exhaustruct/v3 v3.2.0 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
Expand All @@ -33,10 +33,10 @@ require (
github.com/Masterminds/vcs v1.13.3 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/Microsoft/hcsshim v0.11.4 // indirect
github.com/OpenPeeDeeP/depguard/v2 v2.1.0 // indirect
github.com/OpenPeeDeeP/depguard/v2 v2.2.0 // indirect
github.com/a8m/envsubst v1.4.2 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/alecthomas/go-check-sumtype v0.1.3 // indirect
github.com/alecthomas/go-check-sumtype v0.1.4 // indirect
github.com/alecthomas/participle/v2 v2.1.1 // indirect
github.com/alessio/shellescape v1.4.1 // indirect
github.com/alexkohler/nakedret/v2 v2.0.2 // indirect
Expand All @@ -62,12 +62,12 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/bkielbasa/cyclop v1.2.1 // indirect
github.com/blizzy78/varnamelen v0.8.0 // indirect
github.com/bombsimon/wsl/v3 v3.4.0 // indirect
github.com/bombsimon/wsl/v4 v4.2.0 // indirect
github.com/breml/bidichk v0.2.7 // indirect
github.com/breml/errchkjson v0.3.6 // indirect
github.com/butuzov/ireturn v0.2.2 // indirect
github.com/butuzov/ireturn v0.3.0 // indirect
github.com/butuzov/mirror v1.1.0 // indirect
github.com/catenacyber/perfsprint v0.2.0 // indirect
github.com/catenacyber/perfsprint v0.6.0 // indirect
github.com/ccojocar/zxcvbn-go v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
Expand All @@ -85,7 +85,7 @@ require (
github.com/creack/pty v1.1.20 // indirect
github.com/curioswitch/go-reassign v0.2.0 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/daixiang0/gci v0.11.2 // indirect
github.com/daixiang0/gci v0.12.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/denis-tingaikin/go-header v0.4.3 // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
Expand All @@ -103,7 +103,7 @@ require (
github.com/elliotchance/orderedmap v1.5.1 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/esimonov/ifshort v1.0.4 // indirect
github.com/ettle/strcase v0.1.1 // indirect
github.com/ettle/strcase v0.2.0 // indirect
github.com/evanphx/json-patch v5.7.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
Expand All @@ -114,8 +114,8 @@ require (
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fvbommel/sortorder v1.1.0 // indirect
github.com/fzipp/gocyclo v0.6.0 // indirect
github.com/ghostiam/protogetter v0.2.3 // indirect
github.com/go-critic/go-critic v0.9.0 // indirect
github.com/ghostiam/protogetter v0.3.4 // indirect
github.com/go-critic/go-critic v0.11.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-gorp/gorp/v3 v3.1.0 // indirect
github.com/go-logr/logr v1.3.0 // indirect
Expand All @@ -130,6 +130,7 @@ require (
github.com/go-toolsmith/astp v1.1.0 // indirect
github.com/go-toolsmith/strparse v1.1.0 // indirect
github.com/go-toolsmith/typep v1.1.0 // indirect
github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1 // indirect
github.com/go-xmlfmt/xmlfmt v1.1.2 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/goccy/go-json v0.10.2 // indirect
Expand All @@ -153,8 +154,8 @@ require (
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/gordonklaus/ineffassign v0.1.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/gostaticanalysis/analysisutil v0.7.1 // indirect
Expand All @@ -177,10 +178,11 @@ require (
github.com/imdario/mergo v0.3.16 // indirect
github.com/in-toto/in-toto-golang v0.5.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jgautheron/goconst v1.6.0 // indirect
github.com/jgautheron/goconst v1.7.0 // indirect
github.com/jingyugao/rowserrcheck v1.1.1 // indirect
github.com/jinzhu/copier v0.4.0 // indirect
github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect
github.com/jjti/go-spancheck v0.5.2 // indirect
github.com/jmoiron/sqlx v1.3.5 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
Expand All @@ -190,7 +192,7 @@ require (
github.com/kkHAIKE/contextcheck v1.1.4 // indirect
github.com/klauspost/compress v1.16.3 // indirect
github.com/kulti/thelper v0.6.3 // indirect
github.com/kunwardeep/paralleltest v1.0.8 // indirect
github.com/kunwardeep/paralleltest v1.0.9 // indirect
github.com/kyoh86/exportloopref v0.1.11 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
Expand All @@ -200,7 +202,7 @@ require (
github.com/lib/pq v1.10.9 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/lufeee/execinquery v1.2.1 // indirect
github.com/macabu/inamedparam v0.1.2 // indirect
github.com/macabu/inamedparam v0.1.3 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/maratori/testableexamples v1.0.0 // indirect
Expand All @@ -212,7 +214,7 @@ require (
github.com/mattn/go-shellwords v1.0.12 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mbilski/exhaustivestruct v1.2.0 // indirect
github.com/mgechev/revive v1.3.4 // indirect
github.com/mgechev/revive v1.3.6 // indirect
github.com/miekg/pkcs11 v1.1.1 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
Expand All @@ -235,9 +237,9 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/nakabonne/nestif v0.3.1 // indirect
github.com/nishanths/exhaustive v0.11.0 // indirect
github.com/nishanths/exhaustive v0.12.0 // indirect
github.com/nishanths/predeclared v0.2.2 // indirect
github.com/nunnatsa/ginkgolinter v0.14.1 // indirect
github.com/nunnatsa/ginkgolinter v0.15.2 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc5 // indirect
Expand All @@ -247,7 +249,7 @@ require (
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/polyfloyd/go-errorlint v1.4.5 // indirect
github.com/polyfloyd/go-errorlint v1.4.8 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
Expand Down Expand Up @@ -276,7 +278,7 @@ require (
github.com/sivchari/tenv v1.7.1 // indirect
github.com/sonatard/noctx v0.0.2 // indirect
github.com/sourcegraph/go-diff v0.7.0 // indirect
github.com/spf13/afero v1.9.2 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/cobra v1.8.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
Expand All @@ -289,7 +291,7 @@ require (
github.com/subosito/gotenv v1.4.1 // indirect
github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect
github.com/tdakkota/asciicheck v0.2.0 // indirect
github.com/tetafro/godot v1.4.15 // indirect
github.com/tetafro/godot v1.4.16 // indirect
github.com/theupdateframework/notary v0.7.0 // indirect
github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 // indirect
github.com/timonwong/loggercheck v0.9.4 // indirect
Expand All @@ -299,7 +301,7 @@ require (
github.com/tonistiigi/units v0.0.0-20180711220420-6950e57a87ea // indirect
github.com/tonistiigi/vt100 v0.0.0-20230623042737-f9a4f7ef6531 // indirect
github.com/ultraware/funlen v0.1.0 // indirect
github.com/ultraware/whitespace v0.0.5 // indirect
github.com/ultraware/whitespace v0.1.0 // indirect
github.com/uudashr/gocognit v1.1.2 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
Expand All @@ -308,11 +310,12 @@ require (
github.com/xlab/treeprint v1.2.0 // indirect
github.com/yagipy/maintidx v1.0.0 // indirect
github.com/yeya24/promlinter v0.2.0 // indirect
github.com/ykadowak/zerologlint v0.1.3 // indirect
github.com/ykadowak/zerologlint v0.1.5 // indirect
github.com/yuin/gopher-lua v1.1.1 // indirect
github.com/zclconf/go-cty v1.14.1 // indirect
gitlab.com/bosi/decorder v0.4.1 // indirect
go-simpler.org/sloglint v0.1.2 // indirect
go-simpler.org/musttag v0.8.0 // indirect
go-simpler.org/sloglint v0.4.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.44.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 // indirect
Expand All @@ -325,27 +328,26 @@ require (
go.opentelemetry.io/otel/trace v1.20.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
go.tmz.dev/musttag v0.7.2 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // indirect
golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/oauth2 v0.11.0 // indirect
golang.org/x/sync v0.4.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc // indirect
golang.org/x/exp/typeparams v0.0.0-20231219180239-dc181d75b848 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/oauth2 v0.15.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.17.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
Expand All @@ -365,10 +367,10 @@ require (
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
k8s.io/kubectl v0.29.0 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
mvdan.cc/gofumpt v0.5.0 // indirect
mvdan.cc/gofumpt v0.6.0 // indirect
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect
mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d // indirect
mvdan.cc/unparam v0.0.0-20240104100049-c549a3470d14 // indirect
oras.land/oras-go v1.2.4 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 // indirect
Expand Down
Loading

0 comments on commit 976a347

Please sign in to comment.