1
0
Fork 0
mirror of https://github.com/actions/go-versions synced 2024-12-28 17:32:43 +00:00

Update Go.Tests.ps1

This commit is contained in:
aparnajyothi-y 2024-06-28 16:06:21 +05:30 committed by GitHub
parent 0f6d2a4392
commit fb117ec42a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -23,11 +23,15 @@ Describe "Go" {
"go version" | Should -ReturnZeroExitCode
}
It "version is correct" {
It "version is correct" {
[version]$Version = $env:VERSION
$versionOutput = (Invoke-Expression -Command "go version") -replace "v", "" # remove "v" prefix
$versionOutputRaw = Invoke-Expression -Command "go version"
# Extract the version number from the output
$versionOutput = ($versionOutputRaw -split " ")[2] -replace "go", ""
$finalVersion = $Version.ToString(3)
If ($Version.Build -eq "0") {
If ($Version.Build -eq "0"){
$finalVersion = $Version.ToString(2)
}
$versionOutput | Should -Match $finalVersion