staticcheck不希望地扫描直接目录树之外的代码。
如何让 staticcheck 仅扫描直接目录树,并忽略内部内容,例如: /usr/local/go/src/runtime/internal/sys/
?
我在staticcheck.io上搜索了文档,但没有找到任何关于这种行为的信息。
例子:
$ find . -name "*.go"
./main.go
./exporter/gather.go
./exporter/metrics.go
./exporter/structs.go
./exporter/http.go
./exporter/prometheus.go
./config/config.go
./bitbucket-exporter_test.go
$ staticcheck ./...
/usr/local/go/src/runtime/internal/sys/arch.go:24:7: other declaration of PtrSize (compile)
/usr/local/go/src/runtime/internal/sys/arch.go:27:7: other declaration of StackGuardMultiplier (compile)
/usr/local/go/src/runtime/internal/sys/stubs.go:9:7: PtrSize redeclared in this block (compile)
/usr/local/go/src/runtime/internal/sys/stubs.go:10:24: undeclared name: Uintreg (compile)
/usr/local/go/src/runtime/internal/sys/stubs.go:16:7: StackGuardMultiplier redeclared in this block (compile)
$ staticcheck -version
staticcheck 2021.1 (v0.2.0)
$ go version
go version go1.17.4 linux/amd64
12345678_0001
相关分类