Last active
December 18, 2022 02:15
-
-
Save emmaly/83a2ad3de3132e9141b5523ecb850852 to your computer and use it in GitHub Desktop.
PowerShell: get newest Go release version from git
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# as a one-liner... because why not. #> | |
git ls-remote --tags https://go.googlesource.com/go | ForEach-Object { if ($_ -imatch ('^\s*(?<Commit>[0-9a-f]+)\s+refs/tags/go(?<Version>\d+\.\d+(?:\.\d+)?)\s*$')) { [PSCustomObject]@{Commit=$matches.Commit;Version=[Version]$matches.Version} } } | Sort-Object -Property Version -Descending -Top 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment