-
-
Notifications
You must be signed in to change notification settings - Fork 666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Runfile in go/tools/bazel does not work with binaries #1728
Comments
I made an attempt to fix this bug but didn't get very far. But I can add some details to what should be a fix, based on what we did in https://github.com/bazelbuild/rules_nodejs. A macro should be used that wrapps the The This shell script should import the official runfiles loading script, which will declare the After using the runfiles loading script, it should call the real go binary with all arguments. The current runfiles resolver should pick up the now declared environment variables: |
I was talking to @laszlocsomor and it looks like the approach I suggested above is not the best one. Instead, it should be possible to implement the Go runfiles helper without having access to the This is what the C++ runfiles helper does: |
FYI, I have a Go implementation of the runfiles library that mimics the C++ runfiles library's semantics. If anyone is interested, or wanted to add it to |
@laszlocsomor The Go runfile handling library is currently at Do you think it makes sense to move runfiles functionality to My preference would be for Bazel to provide a more official specification on how programs should access runfiles. I couldn't find documentation for the environment variables or the manifest format. |
@jayconrod : That's a good argument about the soft dependency. Having the Go runfiles library in rules_go sounds better than having it in bazel_tools. There's no documentation on how to implement a runfiles library for a new language. I can explain stuff if anyone's interested and has concrete questions, but in any case the C++ and Java runfiles libraries are good examples of how it's done. |
* Refactored Runfile, FindBinary, and other functions. Everything now calls a single initialization function through sync.Once. * Added ListRunfiles. This will be used to re-create trees of runfiles, which will be needed for the new version of bazel_test. * Moved and rewrote tests in tests/core/runfiles. Fixes bazel-contrib#2031 Fixes bazel-contrib#1728
* Refactored Runfile, FindBinary, and other functions. Everything now calls a single initialization function through sync.Once. * Added ListRunfiles. This will be used to re-create trees of runfiles, which will be needed for the new version of bazel_test. * Moved and rewrote tests in tests/core/runfiles. Fixes bazel-contrib#2031 Fixes bazel-contrib#1728
* Refactored Runfile, FindBinary, and other functions. Everything now calls a single initialization function through sync.Once. * Added ListRunfiles. This will be used to re-create trees of runfiles, which will be needed for the new version of bazel_test. * Moved and rewrote tests in tests/core/runfiles. Fixes #2031 Fixes #1728
* Refactored Runfile, FindBinary, and other functions. Everything now calls a single initialization function through sync.Once. * Added ListRunfiles. This will be used to re-create trees of runfiles, which will be needed for the new version of bazel_test. * Moved and rewrote tests in tests/core/runfiles. Fixes #2031 Fixes #1728
* Refactored Runfile, FindBinary, and other functions. Everything now calls a single initialization function through sync.Once. * Added ListRunfiles. This will be used to re-create trees of runfiles, which will be needed for the new version of bazel_test. * Moved and rewrote tests in tests/core/runfiles. Fixes #2031 Fixes #1728
* Refactored Runfile, FindBinary, and other functions. Everything now calls a single initialization function through sync.Once. * Added ListRunfiles. This will be used to re-create trees of runfiles, which will be needed for the new version of bazel_test. * Moved and rewrote tests in tests/core/runfiles. Fixes #2031 Fixes #1728
Binaries can have their runfiles, but calling
bazel.Runfile(file)
will return an error about a missing TEST_SRCDIR variable.To reproduce follow:
You should see
The text was updated successfully, but these errors were encountered: