build/analysis: replace nogo staticcheck adapter
The upstream repo is not very active and requires us to override the rules_go
dependency name. By building our own adapter, we don't need it anymore.
Change-Id: I6e539881a23a1934d0bf6ebc2d79d02469bd4c6a
Reviewed-on: https://review.monogon.dev/c/monogon/+/4481
Tested-by: Jenkins CI
Reviewed-by: Leopold Schabel <leo@monogon.tech>
diff --git a/build/analysis/staticcheck/staticcheck.go b/build/analysis/staticcheck/staticcheck.go
new file mode 100644
index 0000000..02c5b10
--- /dev/null
+++ b/build/analysis/staticcheck/staticcheck.go
@@ -0,0 +1,32 @@
+// Copyright The Monogon Project Authors.
+// SPDX-License-Identifier: Apache-2.0
+
+package staticcheck
+
+import (
+ "golang.org/x/tools/go/analysis"
+ "honnef.co/go/tools/analysis/lint"
+ "honnef.co/go/tools/quickfix"
+ "honnef.co/go/tools/simple"
+ "honnef.co/go/tools/staticcheck"
+ "honnef.co/go/tools/stylecheck"
+ "honnef.co/go/tools/unused"
+)
+
+// Analyzers contains all staticcheck analyzer passes
+// Copied from https://github.com/sluongng/nogo-analyzer/ under Apache 2.0
+var Analyzers = func() map[string]*analysis.Analyzer {
+ m := make(map[string]*analysis.Analyzer)
+ for _, analyzers := range [][]*lint.Analyzer{
+ quickfix.Analyzers,
+ simple.Analyzers,
+ staticcheck.Analyzers,
+ stylecheck.Analyzers,
+ {unused.Analyzer},
+ } {
+ for _, a := range analyzers {
+ m[a.Analyzer.Name] = a.Analyzer
+ }
+ }
+ return m
+}()