forked from bazelbuild/rules_go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expand locations in
x_defs
values (bazelbuild#3473)
Allows embedding rlocationpaths into binaries to allow them to find dependencies at runtime even when run from other tools, meaning that `args` and `env` can't be used for this purpose.
- Loading branch information
Showing
5 changed files
with
67 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package x_defs_lib | ||
|
||
var LibGo = "not set" |
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,34 @@ | ||
package x_defs_lib_test | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/bazelbuild/rules_go/go/runfiles" | ||
|
||
"github.com/bazelbuild/rules_go/tests/core/go_test/x_defs/x_defs_lib" | ||
) | ||
|
||
var BinGo = "not set" | ||
|
||
func TestLibGoPath(t *testing.T) { | ||
libGoPath, err := runfiles.Rlocation(x_defs_lib.LibGo) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
_, err = os.Stat(libGoPath) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
} | ||
|
||
func TestBinGoPath(t *testing.T) { | ||
binGoPath, err := runfiles.Rlocation(BinGo) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
_, err = os.Stat(binGoPath) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
} |