cmd/vet: add static vet checker that runs jsontags (#17778)

This starts running the jsontags vet checker on the module.
All existing findings are adding to an allowlist.

Updates tailscale/corp#791

Signed-off-by: Joe Tsai <joetsai@digital-static.net>
This commit is contained in:
Joe Tsai
2025-11-05 16:17:49 -08:00
committed by GitHub
parent 446752687c
commit 5b40f0bc54
6 changed files with 380 additions and 3 deletions
+24
View File
@@ -0,0 +1,24 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
// Package vet is a tool to statically check Go source code.
package main
import (
_ "embed"
"golang.org/x/tools/go/analysis/unitchecker"
"tailscale.com/cmd/vet/jsontags"
)
//go:embed jsontags_allowlist
var jsontagsAllowlistSource string
func init() {
jsontags.RegisterAllowlist(jsontags.ParseAllowlist(jsontagsAllowlistSource))
jsontags.RegisterPureIsZeroMethods(jsontags.PureIsZeroMethodsInTailscaleModule)
}
func main() {
unitchecker.Main(jsontags.Analyzer)
}