Open natefinch opened 2 years ago
Evidently the version is in BuildInfo.Main.Version
if you've used go install, but won't be there if you just build with go build from a locally cloned repo, so probably can just check that and if it exists, use it, otherwise do the network dance above.
The only reason we have an install script is to set build data. As of 1.18, we don't need that anymore. So, now the logic will be split, if you have 1.18, you can just do
go install github.com/magefile/mage@latest
and it'll Just Work™.If you have go 1.17.x or earlier, you'll still need to run
go run install.go
to have the local mage binary report version info.One slight suboptimalness (that's a word, I swear) of the 1.18 data is that it doesn't include tag info, only commit info. That's not very user-friendly, so I wrote code to get tag info from github... which means
mage --version
has to go out to the internet if it was build with 1.18. That stinks, but I think it's worth it if it meansgo install
mostly just works.This fixes https://github.com/magefile/mage/issues/414