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>
| ... | ... |
@@ -262,15 +262,12 @@ RUN ` |
| 262 | 262 |
RUN ` |
| 263 | 263 |
Function Build-GoTestSum() { `
|
| 264 | 264 |
Write-Host "INFO: Building gotestsum version $Env:GOTESTSUM_COMMIT in $Env:GOPATH"; ` |
| 265 |
- $env:GO111MODULE = 'on'; ` |
|
| 266 |
- &go get -d "gotest.tools/gotestsum@${Env:GOTESTSUM_COMMIT}"; `
|
|
| 267 |
- $env:GO111MODULE = 'off'; ` |
|
| 268 |
- if ($LASTEXITCODE -ne 0) { `
|
|
| 269 |
- Throw '"Failed getting gotestsum sources..."' ` |
|
| 270 |
- }; ` |
|
| 271 |
- $env:GO111MODULE = 'on'; ` |
|
| 272 |
- &go build -buildmode=exe -o "${Env:GOPATH}\bin\gotestsum.exe" gotest.tools/gotestsum; `
|
|
| 273 |
- $env:GO111MODULE = 'off'; ` |
|
| 265 |
+ $Env:GO111MODULE = 'on'; ` |
|
| 266 |
+ $tmpGobin = "${Env:GOBIN_TMP}"; `
|
|
| 267 |
+ $Env:GOBIN = """${Env:GOPATH}`\bin"""; `
|
|
| 268 |
+ &go get -buildmode=exe "gotest.tools/gotestsum@${Env:GOTESTSUM_COMMIT}"; `
|
|
| 269 |
+ $Env:GOBIN = "${tmpGobin}"; `
|
|
| 270 |
+ $Env:GO111MODULE = 'off'; ` |
|
| 274 | 271 |
if ($LASTEXITCODE -ne 0) { `
|
| 275 | 272 |
Throw '"gotestsum build failed..."'; ` |
| 276 | 273 |
} ` |