Browse code

hack/ci/windows.ps1: fix Go version check (due to trailing .0)

The Windows Dockerfile downloads the Go binaries, which (unlike
the Golang images) do not have a trailing `.0` in their version.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 61450a651ba8fe4ef3cac284482a9495fc0b761d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2019/09/06 09:57:58
Showing 2 changed files
... ...
@@ -214,7 +214,8 @@ RUN `
214 214
   Download-File $location C:\gitsetup.zip; `
215 215
   `
216 216
   Write-Host INFO: Downloading go...; `
217
-  Download-File $('https://golang.org/dl/go'+$Env:GO_VERSION.TrimEnd('.0')"+'.windows-amd64.zip') C:\go.zip; `
217
+  $dlGoVersion=$Env:GO_VERSION -replace '\.0$',''; `
218
+  Download-File "https://golang.org/dl/go${dlGoVersion}.windows-amd64.zip" C:\go.zip; `
218 219
   `
219 220
   Write-Host INFO: Downloading compiler 1 of 3...; `
220 221
   Download-File https://raw.githubusercontent.com/jhowardmsft/docker-tdmgcc/master/gcc.zip C:\gcc.zip; `
... ...
@@ -134,7 +134,7 @@ Function Check-InContainer() {
134 134
 # outside of a container where it may be out of date with master.
135 135
 Function Verify-GoVersion() {
136 136
     Try {
137
-        $goVersionDockerfile=(Select-String -Path ".\Dockerfile" -Pattern "^ARG[\s]+GO_VERSION=(.*)$").Matches.groups[1].Value.TrimEnd(".0")
137
+        $goVersionDockerfile=(Select-String -Path ".\Dockerfile" -Pattern "^ARG[\s]+GO_VERSION=(.*)$").Matches.groups[1].Value -replace '\.0$',''
138 138
         $goVersionInstalled=(go version).ToString().Split(" ")[2].SubString(2)
139 139
     }
140 140
     Catch [Exception] {