Skip to content
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

Proposal: gimme module to get the Go version defined in go.mod #199

Open
brackendawson opened this issue Sep 13, 2021 · 1 comment · May be fixed by #200
Open

Proposal: gimme module to get the Go version defined in go.mod #199

brackendawson opened this issue Sep 13, 2021 · 1 comment · May be fixed by #200

Comments

@brackendawson
Copy link

brackendawson commented Sep 13, 2021

Since the go directive in a module's go.mod file is a statement of the minimum Go version required to compile the packages in the module, it would be prudent to test that version of Go to ensure that nobody unknowingly introduces a language feature from a newer Go version.

Right now to do this you must list that Go version in your .travis.yml and keep it in sync with the version in your go.mod, which I think is error-prone.

I think it would be useful if there was a new alias to refer to the go directive in the go.mod file, such as:

go:
- stable
- module

It would choose the most recent patch release from that Go version.

@brackendawson brackendawson linked a pull request Sep 13, 2021 that will close this issue
@carmanchris31
Copy link

carmanchris31 commented Sep 22, 2023

In the meantime I put together a zsh hook that mimics fnm's --use-on-cd, extracting the wanted go version based on go.mod and automatically updating using gimme:
https://gist.github.com/carmanchris31/133a9ba4699bf068e6170c59b8d6f281

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants