Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gazelle doesn't chroot proto_library references #1219

Closed
mattmoor opened this issue Jan 5, 2018 · 6 comments
Closed

Gazelle doesn't chroot proto_library references #1219

mattmoor opened this issue Jan 5, 2018 · 6 comments

Comments

@mattmoor
Copy link

mattmoor commented Jan 5, 2018

Try to run Gazelle on this.

I am getting a bunch of errors that are tantamount to Gazelle not rewriting //k8s.io/... to //vendor/k8s.io/.....

@mattmoor
Copy link
Author

mattmoor commented Jan 5, 2018

Actually, it's worse than I thought, it seems to be generating the proto_library rules...

e.g. in vendor/k8s.io/api/admissionregistration/v1alpha1/BUILD I see (among other things):

+
+proto_library(
+    name = "v1alpha1_proto",
+    srcs = ["generated.proto"],
+    deps = [
+        "//k8s.io/apimachinery/pkg/apis/meta/v1:v1_proto",       <-- OOPS!
+        "//k8s.io/apimachinery/pkg/runtime:runtime_proto",
+        "//k8s.io/apimachinery/pkg/runtime/schema:schema_proto",
+        "//k8s.io/apimachinery/pkg/util/intstr:intstr_proto",
+    ],
+)
+
+go_proto_library(
+    name = "v1alpha1_go_proto",
+    importpath = "k8s.io/api/admissionregistration/v1alpha1",
+    proto = ":v1alpha1_proto",
+    deps = [
+        "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
+        "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
+        "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
+        "//vendor/k8s.io/apimachinery/pkg/util/intstr:go_default_library",
+    ],
+)

@mattmoor
Copy link
Author

mattmoor commented Jan 5, 2018

FYI I'm using this in BUILD:


load("@io_bazel_rules_go//go:def.bzl", "gazelle", "go_binary", "go_library", "go_prefix")

go_prefix("k8s.io/sample-controller")

gazelle(
    name = "gazelle",
    external = "vendored",
)

... and running bazel run //:gazelle per documentation.

@mattmoor
Copy link
Author

mattmoor commented Jan 5, 2018

This looks like the same thing I hit here, but in terms of vendor/ based deps.

@mattmoor
Copy link
Author

mattmoor commented Jan 5, 2018

This got me past this:

bazel run //:gazelle -- -proto=disable

@mattmoor mattmoor closed this as completed Jan 5, 2018
@mattmoor mattmoor reopened this Jan 5, 2018
@mattmoor
Copy link
Author

mattmoor commented Jan 5, 2018

I'm going to leave this open, it's silly to create these bad references.

@jayconrod
Copy link
Contributor

Discussed offline. We decided to disable proto rule generation by default in vendor.

Migrated to bazel-contrib/bazel-gazelle#77

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants