Skip to content

Commit

Permalink
Reproduce gazelle proto repo name issue
Browse files Browse the repository at this point in the history
- First commit: change the repo name from my_rules_go to io_bazel_rules_go.

- Second commit: change the repo name to rules_go and run gazelle.

Reproduces bazel-contrib#1823
  • Loading branch information
jschaf committed Jun 7, 2024
1 parent 7d10bf7 commit c5d1a43
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 18 deletions.
4 changes: 2 additions & 2 deletions tests/bcr/go_mod/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ local_path_override(
)

bazel_dep(name = "protobuf", version = "23.1", repo_name = "my_protobuf")
bazel_dep(name = "rules_go", version = "0.42.0", repo_name = "my_rules_go")
bazel_dep(name = "rules_go", version = "0.42.0", repo_name = "io_bazel_rules_go")
bazel_dep(name = "rules_proto", version = "6.0.0-rc2", repo_name = "my_rules_proto")

go_sdk = use_extension("@my_rules_go//go:extensions.bzl", "go_sdk")
go_sdk = use_extension("@io_bazel_rules_go//go:extensions.bzl", "go_sdk")

# This bazel_dep provides the Go dependency github.com/cloudflare/circl, which requires custom
# patches beyond what Gazelle can generate.
Expand Down
26 changes: 13 additions & 13 deletions tests/bcr/go_mod/pkg/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@my_rules_go//go:def.bzl", "go_library", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "pkg",
Expand All @@ -9,37 +9,37 @@ go_library(
importpath = "github.com/bazelbuild/bazel-gazelle/tests/bcr/go_mod/pkg",
visibility = ["//visibility:public"],
deps = select({
"@my_rules_go//go/platform:aix": [
"@io_bazel_rules_go//go/platform:aix": [
"@org_golang_x_sys//unix",
],
"@my_rules_go//go/platform:android": [
"@io_bazel_rules_go//go/platform:android": [
"@org_golang_x_sys//unix",
],
"@my_rules_go//go/platform:darwin": [
"@io_bazel_rules_go//go/platform:darwin": [
"@org_golang_x_sys//unix",
],
"@my_rules_go//go/platform:dragonfly": [
"@io_bazel_rules_go//go/platform:dragonfly": [
"@org_golang_x_sys//unix",
],
"@my_rules_go//go/platform:freebsd": [
"@io_bazel_rules_go//go/platform:freebsd": [
"@org_golang_x_sys//unix",
],
"@my_rules_go//go/platform:illumos": [
"@io_bazel_rules_go//go/platform:illumos": [
"@org_golang_x_sys//unix",
],
"@my_rules_go//go/platform:ios": [
"@io_bazel_rules_go//go/platform:ios": [
"@org_golang_x_sys//unix",
],
"@my_rules_go//go/platform:linux": [
"@io_bazel_rules_go//go/platform:linux": [
"@org_golang_x_sys//unix",
],
"@my_rules_go//go/platform:netbsd": [
"@io_bazel_rules_go//go/platform:netbsd": [
"@org_golang_x_sys//unix",
],
"@my_rules_go//go/platform:openbsd": [
"@io_bazel_rules_go//go/platform:openbsd": [
"@org_golang_x_sys//unix",
],
"@my_rules_go//go/platform:solaris": [
"@io_bazel_rules_go//go/platform:solaris": [
"@org_golang_x_sys//unix",
],
"//conditions:default": [],
Expand All @@ -61,7 +61,7 @@ go_test(
"@com_github_google_go_jsonnet//:go-jsonnet",
"@com_github_google_safetext//yamltemplate",
"@com_github_stretchr_testify//require:go_default_library",
"@my_rules_go//go/runfiles",
"@io_bazel_rules_go//go/runfiles",
"@org_example_hello//:hello",
],
)
2 changes: 1 addition & 1 deletion tests/bcr/go_mod/pkg/data/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@my_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "data",
Expand Down
12 changes: 10 additions & 2 deletions tests/bcr/go_mod/proto/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@my_rules_go//go:def.bzl", "go_test")
load("@my_rules_go//proto:def.bzl", "go_proto_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@my_rules_proto//proto:defs.bzl", "proto_library")

proto_library(
Expand All @@ -22,10 +22,18 @@ go_proto_library(
go_test(
name = "proto_test",
srcs = ["foo_test.go"],
embed = [":proto"],
deps = [
":foo_go_proto",
"@org_golang_google_protobuf//types/known/sourcecontextpb",
"@org_golang_google_protobuf//types/known/timestamppb",
"@org_golang_google_protobuf//types/known/typepb",
],
)

go_library(
name = "proto",
srcs = ["placeholder.go"],
importpath = "github.com/bazelbuild/bazel-gazelle/tests/bcr/go_mod/proto",
visibility = ["//visibility:public"],
)
1 change: 1 addition & 0 deletions tests/bcr/go_mod/proto/foo.pb.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package proto
1 change: 1 addition & 0 deletions tests/bcr/go_mod/proto/placeholder.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package proto

0 comments on commit c5d1a43

Please sign in to comment.