Teach Gazelle about k8s import paths in @kubernetes
This prevents "gazelle update" from attempting to add its
go_repository equivalent to the auto-generated BUILD file.
We still need to keep the entries in Go.mod and Gazelle
will generate unused go_repository rules for them, because
`go mod tidy` would break otherwise (and we cannot use a
replace directive or a symlink, because replacing requires
a Go.mod file, which the Kubernetes repo does not have,
and symlinks are not a thing for external dependencies).
This was broken in master since D271.
Test Plan:
Ran `scripts/gazelle.sh`, `bazel build :gopath`,
and then the script again. This previously broke and now works.
X-Origin-Diff: phab/D310
GitOrigin-RevId: 79c1b2836e86df6baddbc1a1dd770e6c0dd84133
diff --git a/BUILD b/BUILD
index ba234e7..9431197 100644
--- a/BUILD
+++ b/BUILD
@@ -5,6 +5,8 @@
# gazelle:exclude core/generated
# gazelle:exclude tools.go
# gazelle:exclude core/cmd/kube-controlplane
+# gazelle:resolve go k8s.io/client-go/tools/clientcmd @kubernetes//staging/src/k8s.io/client-go/tools/clientcmd:go_default_library
+# gazelle:resolve go k8s.io/client-go/tools/clientcmd/api @kubernetes//staging/src/k8s.io/client-go/tools/clientcmd/api:go_default_library
gazelle(name = "gazelle")
# Shortcut for the Go SDK
diff --git a/core/scripts/BUILD b/core/scripts/BUILD
index c023ed4..2440119 100644
--- a/core/scripts/BUILD
+++ b/core/scripts/BUILD
@@ -1,11 +1,10 @@
-
sh_library(
name = "vm_deps",
data = [
"@//core:image",
"@//core:swtpm_data",
"@edk2//:firmware",
- ]
+ ],
)
sh_binary(
@@ -28,5 +27,8 @@
srcs = ["test_boot.sh"],
# expects wants a pty, which do not exist in the sandbox
tags = ["local"],
- deps = [":test_deps", ":vm_deps"],
+ deps = [
+ ":test_deps",
+ ":vm_deps",
+ ],
)