-
-
Notifications
You must be signed in to change notification settings - Fork 671
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
How to get GOROOT in 0.9.0 #1273
Comments
Are you looking for the GOROOT set in the host environment? There shouldn't be any way to get that value within the rules, since it may result in non-reproducible builds and would probably not be friendly to remote builds. We construct a GOROOT internally in Could you tell us more about what you're trying to do? We might be able to figure out another solution. |
Thanks for the response! I am trying to use the following gomock rule suggested here: I've added a go_context so I can get access to go.root, and changed lines 24-32 to be:
However, I get the following error If bazel is using the internally downloaded go SDK (I haven't set anything in the WORKSPACE around this), then I would assume that my external paths set in my bash profile shouldn't affect this either correct? In which case I am not sure why this rule is failing to find the @go_sdk. Thoughts on what might be the issue? |
@ianthehat would be a better person to answer this. I believe you'll need to define the I expect that adding |
Yup, doing just that, added a go_context_data attribute in order to get the go_context. What I suspect is that the go binary is missing in the sandbox, but not sure yet how to check if that's the case. |
Make sure to use the My favorite tool for sandbox debugging is just to run |
Has anyone got this working? I too have modified the gist to use |
@awh I ended up hard coding the path to my local go binary, which is terribly hacky but after getting the rule to work on a half dozen computers it failed to work on some other ones. I wasn't able to debug why it failed on some machines but not others (mix of macs and ubuntu). We filed a bug with Bazel as this seems to be an issue with Bazel but not sure. |
Closing some old issues. Note that These paths may be relative. Paths cannot be absolutized during analysis (we don't know where actions will execute). Take care when absolutizing paths in analysis; if machine-specific paths get baked into outputs, that breaks reproducibility. |
Now that GOROOT is not available in the toolchain under toolcain.paths.root.path what is the correct way to get the GOROOT?
Both go_context.go.short_path & go_context.root seems to return the root directory for bazel (external/go_sdk), but not your local root directory (/usr/local/go in my case).
Thoughts?
Also is there a better place to post questions?
The text was updated successfully, but these errors were encountered: