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/analyzer/BUILD.bazel b/build/analysis/staticcheck/analyzer/BUILD.bazel
new file mode 100644
index 0000000..be9afe8
--- /dev/null
+++ b/build/analysis/staticcheck/analyzer/BUILD.bazel
@@ -0,0 +1,27 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+load("//build/analysis/staticcheck:analyzers.bzl", "ANALYZER_NAMES")
+
+[
+    go_library(
+        name = analyzer,
+        srcs = ["analyzer.go"],
+        importpath = "source.monogon.dev/build/analysis/staticcheck/analyzer/" + analyzer,
+        visibility = ["//visibility:public"],
+        x_defs = {
+            "name": analyzer,
+        },
+        deps = ["//build/analysis/staticcheck:staticcheck_lib"],
+    )
+    for analyzer in ANALYZER_NAMES
+]
+
+go_library(
+    name = "analyzer",
+    srcs = ["analyzer.go"],
+    importpath = "source.monogon.dev/build/analysis/staticcheck/analyzer",
+    # Gazelle generated target that doesn't do anything,
+    # disable via incompatible.
+    target_compatible_with = ["@platforms//:incompatible"],
+    visibility = ["//visibility:private"],
+    deps = ["//build/analysis/staticcheck:staticcheck_lib"],
+)
diff --git a/build/analysis/staticcheck/analyzer/analyzer.go b/build/analysis/staticcheck/analyzer/analyzer.go
new file mode 100644
index 0000000..b082533
--- /dev/null
+++ b/build/analysis/staticcheck/analyzer/analyzer.go
@@ -0,0 +1,21 @@
+// Copyright The Monogon Project Authors.
+// SPDX-License-Identifier: Apache-2.0
+
+package staticcheck
+
+import (
+	"fmt"
+
+	"source.monogon.dev/build/analysis/staticcheck"
+)
+
+var (
+	name     string
+	Analyzer = staticcheck.Analyzers[name]
+)
+
+func init() {
+	if Analyzer == nil {
+		panic(fmt.Sprintf("staticcheck analyzer %q not found", name))
+	}
+}