jmhodges / bazel_gomock

Code to create Go mocks for bazel targets using mockgen
MIT License
58 stars 30 forks source link

Fix source mode to not trigger go modules #23

Closed robbertvanginkel closed 4 years ago

robbertvanginkel commented 4 years ago

Fixes https://github.com/jmhodges/bazel_gomock/issues/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 pr removes the _go_tool_run_shell_stdout, which was only called from one place. Seemed better to remove the passthrough as compared having to fiddle gopath around to prefix the source flag. Seems like _go_tool_run_shell_stdout used to be used in more than one place but isn't anymore

jmhodges commented 4 years ago

Thanks!