Skip to content

Instantly share code, notes, and snippets.

@emmaly
Last active December 18, 2022 02:15
Show Gist options
  • Save emmaly/83a2ad3de3132e9141b5523ecb850852 to your computer and use it in GitHub Desktop.
Save emmaly/83a2ad3de3132e9141b5523ecb850852 to your computer and use it in GitHub Desktop.
PowerShell: get newest Go release version from git
<# 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