diff --git a/Makefile b/Makefile index 8ee86d1584..1a94d3a33b 100644 --- a/Makefile +++ b/Makefile @@ -428,7 +428,8 @@ lint/ts: lint/go: ./scripts/check_enterprise_imports.sh - go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.2 + linter_ver=$(shell egrep -o 'GOLANGCI_LINT_VERSION=\S+' dogfood/Dockerfile | cut -d '=' -f 2) + go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$$linter_ver golangci-lint run .PHONY: lint/go diff --git a/coderd/audit/request.go b/coderd/audit/request.go index eff3dbce81..c61db9ef83 100644 --- a/coderd/audit/request.go +++ b/coderd/audit/request.go @@ -361,9 +361,8 @@ func either[T Auditable, R any](old, new T, fn func(T) R, auditAction database.A // If the request action is a login or logout, we always want to audit it even if // there is no diff. See the comment in audit.InitRequest for more detail. return fn(old) - } else { - panic("both old and new are nil") } + panic("both old and new are nil") } func parseIP(ipStr string) pqtype.Inet { diff --git a/coderd/coderdtest/oidctest/idp.go b/coderd/coderdtest/oidctest/idp.go index 86be0b6621..20702be16a 100644 --- a/coderd/coderdtest/oidctest/idp.go +++ b/coderd/coderdtest/oidctest/idp.go @@ -987,6 +987,7 @@ func (f fakeRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { return f.roundTrip(req) } +//nolint:gosec // these are test credentials const testRSAPrivateKey = `-----BEGIN RSA PRIVATE KEY----- MIICXQIBAAKBgQDLets8+7M+iAQAqN/5BVyCIjhTQ4cmXulL+gm3v0oGMWzLupUS v8KPA+Tp7dgC/DZPfMLaNH1obBBhJ9DhS6RdS3AS3kzeFrdu8zFHLWF53DUBhS92 diff --git a/coderd/database/dbmem/dbmem.go b/coderd/database/dbmem/dbmem.go index b6536677c1..830dd05211 100644 --- a/coderd/database/dbmem/dbmem.go +++ b/coderd/database/dbmem/dbmem.go @@ -4679,9 +4679,8 @@ func (q *FakeQuerier) InsertAuditLog(_ context.Context, arg database.InsertAudit return -1 } else if a.Time.Equal(b.Time) { return 0 - } else { - return 1 } + return 1 }) return alog, nil diff --git a/coderd/metricscache/metricscache.go b/coderd/metricscache/metricscache.go index 94623a8c2b..e3ac274b1c 100644 --- a/coderd/metricscache/metricscache.go +++ b/coderd/metricscache/metricscache.go @@ -153,9 +153,8 @@ func convertDAUResponse[T dauRow](rows []T, tzOffset int) codersdk.DAUsResponse return -1 } else if a.Equal(b) { return 0 - } else { - return 1 } + return 1 }) var resp codersdk.DAUsResponse diff --git a/coderd/oauthpki/okidcpki_test.go b/coderd/oauthpki/okidcpki_test.go index ab6e3e3a08..144cb32901 100644 --- a/coderd/oauthpki/okidcpki_test.go +++ b/coderd/oauthpki/okidcpki_test.go @@ -25,6 +25,7 @@ import ( "github.com/coder/coder/v2/testutil" ) +//nolint:gosec // these are just for testing const ( testClientKey = `-----BEGIN RSA PRIVATE KEY----- MIIEpAIBAAKCAQEAnUryZEfn5kA8wuk9a7ogFuWbk3uPHEhioYuAg9m3/tIdqSqu diff --git a/coderd/util/slice/slice.go b/coderd/util/slice/slice.go index c366b04f91..8586aae770 100644 --- a/coderd/util/slice/slice.go +++ b/coderd/util/slice/slice.go @@ -79,9 +79,8 @@ func Ascending[T constraints.Ordered](a, b T) int { return -1 } else if a == b { return 0 - } else { - return 1 } + return 1 } func Descending[T constraints.Ordered](a, b T) int { diff --git a/dogfood/Dockerfile b/dogfood/Dockerfile index 17774d53da..89b9f4bbbd 100644 --- a/dogfood/Dockerfile +++ b/dogfood/Dockerfile @@ -224,7 +224,7 @@ RUN systemctl enable \ ARG CLOUD_SQL_PROXY_VERSION=2.2.0 \ DIVE_VERSION=0.10.0 \ DOCKER_GCR_VERSION=2.1.8 \ - GOLANGCI_LINT_VERSION=1.52.2 \ + GOLANGCI_LINT_VERSION=1.55.2 \ GRYPE_VERSION=0.61.1 \ HELM_VERSION=3.12.0 \ KUBE_LINTER_VERSION=0.6.3 \ diff --git a/tailnet/coordinator.go b/tailnet/coordinator.go index 2c67e5ff72..bd1441e3a3 100644 --- a/tailnet/coordinator.go +++ b/tailnet/coordinator.go @@ -239,9 +239,8 @@ func ServeMultiAgent(c CoordinatorV2, logger slog.Logger, id uuid.UUID) MultiAge // legacy IP. Agents with only the legacy IP aren't compatible // with single_tailnet and must be routed through wsconncache. return true - } else { - return false } + return false }, OnSubscribe: func(enq Queue, agent uuid.UUID) (*Node, error) { err := SendCtx(ctx, reqs, &proto.CoordinateRequest{AddTunnel: &proto.CoordinateRequest_Tunnel{Uuid: UUIDToByteSlice(agent)}})