-
-
Notifications
You must be signed in to change notification settings - Fork 668
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
go_prefix is used to generate Go import paths from Bazel labels. Until now, it has been mandatory, since there's an implicit dependency from all go_library, go_binary, and go_test rules on //:go_prefix. With this change, that dependency is not present when the importpath attribute is specified. This means that if all of the Go rules in a repository specify importpath, there's no need to define a go_prefix rule in the repository root. Fixes #720 Related #721
- Loading branch information
Showing
8 changed files
with
74 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test") | ||
load("@io_bazel_rules_go//tests:bazel_tests.bzl", "bazel_test") | ||
|
||
bazel_test( | ||
name = "no_prefix", | ||
command = "build", | ||
target = "//:go_default_library //:go_default_xtest //:cmd", | ||
) | ||
|
||
go_library( | ||
name = "go_default_library", | ||
srcs = ["no_prefix.go"], | ||
importpath = "github.com/bazelbuild/rules_go/tests/no_prefix", | ||
) | ||
|
||
go_test( | ||
name = "go_default_xtest", | ||
srcs = ["no_prefix_test.go"], | ||
deps = [":go_default_library"], | ||
importpath = "github.com/bazelbuild/rules_go/tests/no_prefix_test", | ||
) | ||
|
||
go_binary( | ||
name = "cmd", | ||
srcs = ["cmd.go"], | ||
deps = [":go_default_library"], | ||
importpath = "github.com/bazelbuild/rules_go/tests/no_prefix/cmd", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package main | ||
|
||
import _ "github.com/bazelbuild/rules_go/tests/no_prefix" | ||
|
||
func main() { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package no_prefix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package no_prefix_test | ||
|
||
import _ "github.com/bazelbuild/rules_go/tests/no_prefix" |