Dockerfile.windows: fix gotestsum.installer installing wrong version

When using go modules, `go build` will always fetch the latest
version of the package, so ignores the version we previously `go get`'d.

Instead of running `go get` and `go build` separately, this patch uses
`go get` (without the `-d` option) to do it all in one step.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2020-06-24 21:50:49 +02:00
parent 441aff3a17
commit 20570d91c8
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 6 additions and 9 deletions

View File

@ -262,15 +262,12 @@ RUN `
RUN ` RUN `
Function Build-GoTestSum() { ` Function Build-GoTestSum() { `
Write-Host "INFO: Building gotestsum version $Env:GOTESTSUM_COMMIT in $Env:GOPATH"; ` Write-Host "INFO: Building gotestsum version $Env:GOTESTSUM_COMMIT in $Env:GOPATH"; `
$env:GO111MODULE = 'on'; ` $Env:GO111MODULE = 'on'; `
&go get -d "gotest.tools/gotestsum@${Env:GOTESTSUM_COMMIT}"; ` $tmpGobin = "${Env:GOBIN_TMP}"; `
$env:GO111MODULE = 'off'; ` $Env:GOBIN = """${Env:GOPATH}`\bin"""; `
if ($LASTEXITCODE -ne 0) { ` &go get -buildmode=exe "gotest.tools/gotestsum@${Env:GOTESTSUM_COMMIT}"; `
Throw '"Failed getting gotestsum sources..."' ` $Env:GOBIN = "${tmpGobin}"; `
}; ` $Env:GO111MODULE = 'off'; `
$env:GO111MODULE = 'on'; `
&go build -buildmode=exe -o "${Env:GOPATH}\bin\gotestsum.exe" gotest.tools/gotestsum; `
$env:GO111MODULE = 'off'; `
if ($LASTEXITCODE -ne 0) { ` if ($LASTEXITCODE -ne 0) { `
Throw '"gotestsum build failed..."'; ` Throw '"gotestsum build failed..."'; `
} ` } `