Skip to content

Commit 197cd93

Browse files
authored
chore(Makefile): use linter version from dogfood Dockerfile (#11147)
* chore(Makefile): use golangci-lint version from dogfood Dockerfile * chore(dogfood/Dockerfile): update golangci-lint to latest version * chore(coderd): address linter complaints
1 parent d07fa9c commit 197cd93

File tree

9 files changed

+10
-12
lines changed

9 files changed

+10
-12
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,8 @@ lint/ts:
428428

429429
lint/go:
430430
./scripts/check_enterprise_imports.sh
431-
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.2
431+
linter_ver=$(shell egrep -o 'GOLANGCI_LINT_VERSION=\S+' dogfood/Dockerfile | cut -d '=' -f 2)
432+
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$$linter_ver
432433
golangci-lint run
433434
.PHONY: lint/go
434435

coderd/audit/request.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,8 @@ func either[T Auditable, R any](old, new T, fn func(T) R, auditAction database.A
361361
// If the request action is a login or logout, we always want to audit it even if
362362
// there is no diff. See the comment in audit.InitRequest for more detail.
363363
return fn(old)
364-
} else {
365-
panic("both old and new are nil")
366364
}
365+
panic("both old and new are nil")
367366
}
368367

369368
func parseIP(ipStr string) pqtype.Inet {

coderd/coderdtest/oidctest/idp.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,7 @@ func (f fakeRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
987987
return f.roundTrip(req)
988988
}
989989

990+
//nolint:gosec // these are test credentials
990991
const testRSAPrivateKey = `-----BEGIN RSA PRIVATE KEY-----
991992
MIICXQIBAAKBgQDLets8+7M+iAQAqN/5BVyCIjhTQ4cmXulL+gm3v0oGMWzLupUS
992993
v8KPA+Tp7dgC/DZPfMLaNH1obBBhJ9DhS6RdS3AS3kzeFrdu8zFHLWF53DUBhS92

coderd/database/dbmem/dbmem.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4679,9 +4679,8 @@ func (q *FakeQuerier) InsertAuditLog(_ context.Context, arg database.InsertAudit
46794679
return -1
46804680
} else if a.Time.Equal(b.Time) {
46814681
return 0
4682-
} else {
4683-
return 1
46844682
}
4683+
return 1
46854684
})
46864685

46874686
return alog, nil

coderd/metricscache/metricscache.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,8 @@ func convertDAUResponse[T dauRow](rows []T, tzOffset int) codersdk.DAUsResponse
153153
return -1
154154
} else if a.Equal(b) {
155155
return 0
156-
} else {
157-
return 1
158156
}
157+
return 1
159158
})
160159

161160
var resp codersdk.DAUsResponse

coderd/oauthpki/okidcpki_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"github.com/coder/coder/v2/testutil"
2626
)
2727

28+
//nolint:gosec // these are just for testing
2829
const (
2930
testClientKey = `-----BEGIN RSA PRIVATE KEY-----
3031
MIIEpAIBAAKCAQEAnUryZEfn5kA8wuk9a7ogFuWbk3uPHEhioYuAg9m3/tIdqSqu

coderd/util/slice/slice.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,8 @@ func Ascending[T constraints.Ordered](a, b T) int {
7979
return -1
8080
} else if a == b {
8181
return 0
82-
} else {
83-
return 1
8482
}
83+
return 1
8584
}
8685

8786
func Descending[T constraints.Ordered](a, b T) int {

dogfood/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ RUN systemctl enable \
224224
ARG CLOUD_SQL_PROXY_VERSION=2.2.0 \
225225
DIVE_VERSION=0.10.0 \
226226
DOCKER_GCR_VERSION=2.1.8 \
227-
GOLANGCI_LINT_VERSION=1.52.2 \
227+
GOLANGCI_LINT_VERSION=1.55.2 \
228228
GRYPE_VERSION=0.61.1 \
229229
HELM_VERSION=3.12.0 \
230230
KUBE_LINTER_VERSION=0.6.3 \

tailnet/coordinator.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,8 @@ func ServeMultiAgent(c CoordinatorV2, logger slog.Logger, id uuid.UUID) MultiAge
239239
// legacy IP. Agents with only the legacy IP aren't compatible
240240
// with single_tailnet and must be routed through wsconncache.
241241
return true
242-
} else {
243-
return false
244242
}
243+
return false
245244
},
246245
OnSubscribe: func(enq Queue, agent uuid.UUID) (*Node, error) {
247246
err := SendCtx(ctx, reqs, &proto.CoordinateRequest{AddTunnel: &proto.CoordinateRequest_Tunnel{Uuid: UUIDToByteSlice(agent)}})

0 commit comments

Comments
 (0)