aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/build_rules
diff options
context:
space:
mode:
authorGravatar Han-Wen Nienhuys <hanwen@google.com>2016-01-20 11:43:31 +0000
committerGravatar Lukacs Berki <lberki@google.com>2016-01-20 14:10:00 +0000
commit17e419ec05880ac15c34186b67bc3c6f304772ff (patch)
tree1d33ccfbc2be4713b384383da4ccdf3e576e5224 /tools/build_rules
parentc4af8287cd92ba4fe30dddb6f6c3fc881fe470fa (diff)
Allow empty go_prefix.
Fixes #676. -- Change-Id: I7474d3e3071c99452b6e1835d6f70671f34b1fd9 Reviewed-on: https://bazel-review.googlesource.com/#/c/2693 MOS_MIGRATED_REVID=112564791
Diffstat (limited to 'tools/build_rules')
-rw-r--r--tools/build_rules/go/README.md4
-rw-r--r--tools/build_rules/go/def.bzl2
2 files changed, 4 insertions, 2 deletions
diff --git a/tools/build_rules/go/README.md b/tools/build_rules/go/README.md
index 347aee621a..b649fe0e33 100644
--- a/tools/build_rules/go/README.md
+++ b/tools/build_rules/go/README.md
@@ -39,7 +39,9 @@ They currently do not support (in order of importance):
go_repositories()
```
-* Add a `BUILD` file to the top of your workspace, containing
+* Add a `BUILD` file to the top of your workspace, declaring the name of your
+ workspace using `go_prefix`. It is strongly recommended that the prefix is not
+ empty.
```python
load("/tools/build_rules/go/def", "go_prefix")
diff --git a/tools/build_rules/go/def.bzl b/tools/build_rules/go/def.bzl
index 2563e9ebd8..fc611410be 100644
--- a/tools/build_rules/go/def.bzl
+++ b/tools/build_rules/go/def.bzl
@@ -49,7 +49,7 @@ def _go_prefix_impl(ctx):
def _go_prefix(ctx):
"""slash terminated go-prefix"""
prefix = ctx.attr.go_prefix.go_prefix
- if not prefix.endswith("/"):
+ if prefix != "" and not prefix.endswith("/"):
prefix = prefix + "/"
return prefix