-
Notifications
You must be signed in to change notification settings - Fork 623
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Idea: use go run
in generate line
#160
Comments
Leaving this feature as opt-in for backward compatibility. Relates: google#160, google#106
This probably should be blocked until golang/go#33468 is resolved. Also, we can detect case when binary is started with |
Go modules is pretty much the default now, so that part should not be blocking anymore. |
I want to raise this again – go modules is the way to go by now. |
With Go 1.16 having |
Change the go:generate command to use the full go run ... command to ensure the version specified in the current go module is used instead of the global binary. fix google#160
Sounds good, I created #268 |
@zombiezen This is something we've been looking for too, to simplify our When this gets merged to master, we'd be happy to test this out and provide feedback before the next stable release. |
Note that Also just simply changing from |
That's negligible:
Good point. However, I think either way the new default should be to use go generate, so that new users can make immediate use of it. Users who explicitly want the old behaviour should not upgrade, or set the option explicitly should they update. |
Change the go:generate command to use the full go run ... command to ensure the version specified in the current go module is used instead of the global binary. Fixes #160
An idea suggested by @steebchen is to use
//go:generate go run github.com/google/wire/cmd/wire
as the automatically inserted generate line for Wire output. This would have the advantage of always using a version of the code generator that's the same as the library being used, at the cost of perhaps some running time.EDIT (Hit send too early) I don't think we want to make this change until Go Modules is the default, thus I'm marking this issue blocked.
The text was updated successfully, but these errors were encountered: