ci: run 'go vet' in golangci-lint; fix errors in tests

Updates #cleanup

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: Ice78fc907bad24c1de749a1595e212ef2db4b8bb
pull/10507/head
Andrew Dunham 5 months ago
parent f5f21c213c
commit 3f576fc4ca

@ -6,6 +6,7 @@ linters:
- bidichk
- gofmt
- goimports
- govet
- misspell
- revive
@ -35,6 +36,48 @@ linters-settings:
goimports:
govet:
# Matches what we use in corp as of 2023-12-07
enable:
- asmdecl
- assign
- atomic
- bools
- buildtag
- cgocall
- copylocks
- deepequalerrors
- errorsas
- framepointer
- httpresponse
- ifaceassert
- loopclosure
- lostcancel
- nilfunc
- nilness
- printf
- reflectvaluecompare
- shift
- sigchanyzer
- sortslice
- stdmethods
- stringintconv
- structtag
- testinggoroutine
- tests
- unmarshal
- unreachable
- unsafeptr
- unusedresult
settings:
printf:
# List of print function names to check (in addition to default)
funcs:
- github.com/tailscale/tailscale/types/logger.Discard
# NOTE(andrew-d): this doesn't currently work because the printf
# analyzer doesn't support type declarations
#- github.com/tailscale/tailscale/types/logger.Logf
misspell:
revive:

@ -9,6 +9,9 @@ vet: ## Run go vet
tidy: ## Run go mod tidy
./tool/go mod tidy
lint: ## Run golangci-lint
./tool/go run github.com/golangci/golangci-lint/cmd/golangci-lint run
updatedeps: ## Update depaware deps
# depaware (via x/tools/go/packages) shells back to "go", so make sure the "go"
# it finds in its $$PATH is the right one.

@ -1328,7 +1328,9 @@ func TestParseNLArgs(t *testing.T) {
for _, tc := range tcs {
t.Run(tc.name, func(t *testing.T) {
keys, disablements, err := parseNLArgs(tc.input, tc.parseKeys, tc.parseDisablements)
if !reflect.DeepEqual(err, tc.wantErr) {
if (tc.wantErr == nil && err != nil) ||
(tc.wantErr != nil && err == nil) ||
(tc.wantErr != nil && err != nil && tc.wantErr.Error() != err.Error()) {
t.Fatalf("parseNLArgs(%v).err = %v, want %v", tc.input, err, tc.wantErr)
}

@ -15,7 +15,7 @@ import (
func TestGetSerialNumberMac(t *testing.T) {
// Do not run this test on CI, it can only be ran on macOS
// and we currenty only use Linux runners.
// and we currently only use Linux runners.
if cibuild.On() {
t.Skip()
}

Loading…
Cancel
Save