source mode: could not determine GOARCH and Go compiler #17
Comments
Hm, I suspect I'm not seeing this because I'm running the GNU bash (installed with homebrew) instead of the default BSD bash. |
Nope, that ain't it. Seems the code misunderstands how exporting would work. |
That error, however, doesn't seem likely to be caused by the empty GOARCH? I, of course, can't reproduce locally. What version of gomock are you using? Does any of this debugging info help? golang/go#30355 Could you post a reproduction for me? |
Just updated linzhp/bazel_examples.git to use latest Gazelle@39b19ce92c43c9915d69db5fa68b1772434df2e9, and mockgen 1.3.1. Still get the same error:
|
What happens if you try ec2e84d ? |
It needs more fixes than that. See #18 for all fixes needed. However, I think we should revert #16, see my comment on that thread |
Thanks! Mind rebasing on to HEAD now? |
Fixes jmhodges#17. Investigating a bit, golang's module mode seems to trigger when using source mode with a fake module file, resulting in downloading modules while doing codegen. This can be avoided by prefixing the path passed to `-source` with `$GOPATH`, so `go/packages` recognizes the source file as being in the GOPATH. This also removes the `_go_tool_run_shell_stdout`, which was only called from one place. Seemed better to remove as compared having to pass the gopath around to prefix the source flag.
Fixes #17. Investigating a bit, golang's module mode seems to trigger when using source mode with a fake module file, resulting in downloading modules while doing codegen. This can be avoided by prefixing the path passed to `-source` with `$GOPATH`, so `go/packages` recognizes the source file as being in the GOPATH. This also removes the `_go_tool_run_shell_stdout`, which was only called from one place. Seemed better to remove as compared having to pass the gopath around to prefix the source flag.
gomock
rule fails in source mode with error:Loading input failed: could not determine GOARCH and Go compiler
.Versions
OS: macOS 10.14.5
Go: 1.12.5
Bazel: 0.25.2
rules_go: 0.18.5
golang/mock: 1.3.1
jmhodges/bazel_gomock: e4a4d7d
Reproduce
Note
I notice that
GOARCH="" && source <(go env) && echo $GOARCH
will print out things likeamd64
on Linux, but it will print empty string on Mac. This line may not work on MacThe text was updated successfully, but these errors were encountered: