mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-21 14:11:56 +00:00
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
This commit is contained in:
parent
f5f21c213c
commit
3f576fc4ca
@ -6,6 +6,7 @@ linters:
|
|||||||
- bidichk
|
- bidichk
|
||||||
- gofmt
|
- gofmt
|
||||||
- goimports
|
- goimports
|
||||||
|
- govet
|
||||||
- misspell
|
- misspell
|
||||||
- revive
|
- revive
|
||||||
|
|
||||||
@ -35,6 +36,48 @@ linters-settings:
|
|||||||
|
|
||||||
goimports:
|
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:
|
misspell:
|
||||||
|
|
||||||
revive:
|
revive:
|
||||||
|
3
Makefile
3
Makefile
@ -9,6 +9,9 @@ vet: ## Run go vet
|
|||||||
tidy: ## Run go mod tidy
|
tidy: ## Run go mod tidy
|
||||||
./tool/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
|
updatedeps: ## Update depaware deps
|
||||||
# depaware (via x/tools/go/packages) shells back to "go", so make sure the "go"
|
# depaware (via x/tools/go/packages) shells back to "go", so make sure the "go"
|
||||||
# it finds in its $$PATH is the right one.
|
# it finds in its $$PATH is the right one.
|
||||||
|
@ -1328,7 +1328,9 @@ func TestParseNLArgs(t *testing.T) {
|
|||||||
for _, tc := range tcs {
|
for _, tc := range tcs {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
keys, disablements, err := parseNLArgs(tc.input, tc.parseKeys, tc.parseDisablements)
|
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)
|
t.Fatalf("parseNLArgs(%v).err = %v, want %v", tc.input, err, tc.wantErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ import (
|
|||||||
|
|
||||||
func TestGetSerialNumberMac(t *testing.T) {
|
func TestGetSerialNumberMac(t *testing.T) {
|
||||||
// Do not run this test on CI, it can only be ran on macOS
|
// 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() {
|
if cibuild.On() {
|
||||||
t.Skip()
|
t.Skip()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user