.github/workflows: run go vet checks outside golangci-lint

This patch adds a `go vet` step in test.yml that runs a subset of
analyzers against the entire tailscale/tailscale codebase, unlike
golangci-lint.yml which only flags changed lines when linting pull
requests.

This patch also adds `go vet` checks for platform-specific code.

Since running in both golangci-lint.yml and test.yml results in
duplicate work, this patch moves the govet configuration from
.golangci.yml to the `go vet` step in test.yml.

Unfortunately, there are a few analyzers supported by golangci-lint
that are not available from `go vet`.

Fixes: #22645

Change-Id: Ib5227f8c2363e0ac616c3c0f7e74135b5e49017e
Signed-off-by: Simon Law <[email protected]>
This commit is contained in:
Simon Law committed 2026-11-25 00:59:03 -05:00
1 parent 012baddc17
commit 075e3bcd7c
2 files changed
+49 -47

No files matched your search

+49 -12
View File
@@ -778,11 +778,11 @@ jobs:
grep -q TestLicenseHeaders *.go || (echo "Expected a test named TestLicenseHeaders"; exit 1)
./tool/go test -v -run=TestLicenseHeaders
staticcheck:
lint:
runs-on: ubuntu-24.04
timeout-minutes: 30
needs: gomod-cache
name: staticcheck (${{ matrix.name }})
name: lint (${{ matrix.name }})
strategy:
fail-fast: false # don't abort the entire matrix if one element fails
matrix:
@@ -827,14 +827,51 @@ jobs:
path: gomodcache
key: ${{ needs.gomod-cache.outputs.cache-key }}
enableCrossOsArchive: true
- name: run staticcheck (${{ matrix.name }})
- name: Download ./tool/go
working-directory: src
run: |
export GOROOT=$(./tool/go env GOROOT)
./tool/go run -exec \
"env GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }}" \
honnef.co/go/tools/cmd/staticcheck -- \
$(./tool/go run ./tool/listpkgs --ignore-3p --goos=${{ matrix.goos }} --goarch=${{ matrix.goarch }} ${{ matrix.flags }} ./...)
run: ./tool/go version
- parallel:
- name: run go vet (${{ matrix.name }})
working-directory: src
run: |
env GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} \
./tool/go vet \
-asmdecl \
-assign \
-atomic \
-bools \
-buildtag \
-cgocall \
-copylocks \
-errorsas \
-framepointer \
-httpresponse \
-ifaceassert \
-loopclosure \
-lostcancel \
-nilfunc \
-printf \
-printf.funcs=tailscale.com/types/logger.Discard \
-shift \
-sigchanyzer \
-stdmethods \
-stringintconv \
-structtag \
-testinggoroutine \
-tests \
-unmarshal \
-unreachable \
-unsafeptr \
-unusedresult \
$(./tool/go run ./tool/listpkgs --ignore-3p --goos=${{ matrix.goos }} --goarch=${{ matrix.goarch }} ${{ matrix.flags }} ./...)
- name: run staticcheck (${{ matrix.name }})
working-directory: src
run: |
export GOROOT=$(./tool/go env GOROOT)
./tool/go run -exec \
"env GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }}" \
honnef.co/go/tools/cmd/staticcheck -- \
$(./tool/go run ./tool/listpkgs --ignore-3p --goos=${{ matrix.goos }} --goarch=${{ matrix.goarch }} ${{ matrix.flags }} ./...)
notify_slack:
if: always()
@@ -852,7 +889,7 @@ jobs:
- go_generate
- make_tidy
- licenses
- staticcheck
- lint
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
@@ -937,7 +974,7 @@ jobs:
- go_generate
- make_tidy
- licenses
- staticcheck
- lint
steps:
- name: Decide if change is okay to merge
if: github.event_name != 'push'
@@ -962,7 +999,7 @@ jobs:
- go_generate
- make_tidy
- licenses
- staticcheck
- lint
steps:
- name: Decide if change is okay to merge
if: github.event_name != 'push'
-35
View File
@@ -19,47 +19,12 @@ linters:
alias:
- pkg: github.com/tailscale/gliderssh
alias: gliderssh
# Matches what we use in corp as of 2023-12-07
govet:
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
revive:
enable-all-rules: false
rules: