-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
cmd/go: go mod init should be able to specify go/toolchain version #61299
Comments
|
|
I agree that both of these do work but that don't seem like the best user experience imo. If this is the desired experience I feel like it should be documented in |
It feels unintuitive for |
So I don't think |
I could see this being true for trying to keep it as simple as possible. Just feels odd that I can not get the state I want things in with a single command. Using
If there were a flag I would not consider this a side-effect but an explicit handling of what the user wants. |
|
Whoops! I obviously did not read https://go.dev/doc/toolchain closely enough. I had tried a similar command but had left out the |
What version of Go are you using (
go version
)?What did you do?
Programmatically create a new module with a specified go version and toolchain.
What did you expect to see?
Something like:
go1.21rc2 mod init -go=1.19 -toolchain=1.19 example.com/foo
What did you see instead?
No new flags.
Context
As someone who creates a lot of module programmatically it would be nice if these things could be specified from the command line as they affect how the module can be used. I could post process these files but that seems like something that should be able to be specified up front.
In particular the go version seem very important to be able to specify given its new constraints it applies in 1.21+.
The text was updated successfully, but these errors were encountered: