Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions tests/core/go_proto_library_import_public/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
load("@io_bazel_rules_go//go:def.bzl", "go_test")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")

proto_library(
name = "dog_proto",
srcs = ["dog.proto"],
deps = ["//tests/core/go_proto_library_import_public/old_dir:dog_collar_proto"],
)

go_proto_library(
name = "dog_go_proto",
importpath = "github.com/bazelbuild/rules_go/tests/core/go_proto_library_import_public/dog_go_proto",
proto = ":dog_proto",
deps = ["//tests/core/go_proto_library_import_public/old_dir:dog_collar_go_proto"],
)

go_test(
name = "import_public_test",
srcs = ["import_public_test.go"],
deps = [
":dog_go_proto",
],
)
10 changes: 10 additions & 0 deletions tests/core/go_proto_library_import_public/dog.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
syntax = "proto3";

package foo.bar;

import "tests/core/go_proto_library_import_public/old_dir/dog_collar.proto";

message Dog {
string name = 1;
DogCollar collar = 2;
}
29 changes: 29 additions & 0 deletions tests/core/go_proto_library_import_public/import_public_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* Copyright 2025 The Bazel Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package import_public_test

import (
"testing"

dog "github.com/bazelbuild/rules_go/tests/core/go_proto_library_import_public/dog"
)

func pet(interface{}) {}

func TestDog(t *testing.T) {
// just make sure type exists
pet(dog.Dog{Name: "fido"})
}
15 changes: 15 additions & 0 deletions tests/core/go_proto_library_import_public/new_dir/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")

proto_library(
name = "dog_collar_proto",
srcs = ["dog_collar.proto"],
visibility = ["//visibility:public"],
)

go_proto_library(
name = "dog_collar_go_proto",
importpath = "github.com/bazelbuild/rules_go/tests/core/go_proto_library_import_public/new_dir/dog_collar_go_proto",
proto = ":dog_collar_proto",
visibility = ["//visibility:public"],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
syntax = "proto3";

package foo.bar;

message DogCollar {
string name = 1;
string phone_number = 2;
}
18 changes: 18 additions & 0 deletions tests/core/go_proto_library_import_public/old_dir/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")

proto_library(
name = "dog_collar_proto",
srcs = ["dog_collar.proto"],
visibility = ["//visibility:public"],
exports = ["//tests/core/go_proto_library_import_public/new_dir:dog_collar_proto"],
deps = ["//tests/core/go_proto_library_import_public/new_dir:dog_collar_proto"],
)

go_proto_library(
name = "dog_collar_go_proto",
importpath = "github.com/bazelbuild/rules_go/tests/core/go_proto_library_import_public/old_dir/dog_collar_go_proto",
proto = ":dog_collar_proto",
visibility = ["//visibility:public"],
deps = ["//tests/core/go_proto_library_import_public/new_dir:dog_collar_go_proto"],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
syntax = "proto3";

package foo.bar;

import public "tests/core/go_proto_library_import_public/new_dir/dog_collar.proto";