diff --git a/.buildkite/hooks/pre-command.ps1 b/.buildkite/hooks/pre-command.ps1 new file mode 100644 index 00000000..75ae8bec --- /dev/null +++ b/.buildkite/hooks/pre-command.ps1 @@ -0,0 +1,15 @@ +$env:GO_VERSION = Get-Content -Path .go-version + +# Install gvm and go +# TODO: Move GVM download to the base VM image +$env:GvmVersion = "0.5.2" +[Net.ServicePointManager]::SecurityProtocol = "tls12" +$env:GoVersion = Get-Content -Path .go-version +Invoke-WebRequest -URI https://github.com/andrewkroh/gvm/releases/download/v$env:GvmVersion/gvm-windows-amd64.exe -Outfile C:\Windows\System32\gvm.exe +gvm --format=powershell $env:GO_VERSION | Invoke-Expression +go version + +$GOPATH = $(go env GOPATH) +$env:Path = "$GOPATH\bin;" + $env:Path +[Environment]::SetEnvironmentVariable("GOPATH", "$GOPATH", [EnvironmentVariableTarget]::Machine) +[Environment]::SetEnvironmentVariable("Path", "$GOPATH\bin;$env:Path", [EnvironmentVariableTarget]::Machine) diff --git a/.buildkite/scripts/test.ps1 b/.buildkite/scripts/test.ps1 index 7a97d512..f4046f95 100755 --- a/.buildkite/scripts/test.ps1 +++ b/.buildkite/scripts/test.ps1 @@ -8,16 +8,6 @@ function fixCRLF { git reset --quiet --hard } -function withGolang($version) { - Write-Host "-- Install golang --" - choco install -y golang --version $version - $env:ChocolateyInstall = Convert-Path "$((Get-Command choco).Path)\..\.." - Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" - refreshenv - go version - go env -} - function withGoJUnitReport { Write-Host "-- Install go-junit-report --" go install github.com/jstemmer/go-junit-report/v2@latest @@ -25,7 +15,6 @@ function withGoJUnitReport { Write-Host "--- Prepare enviroment" fixCRLF -withGolang $env:GO_VERSION withGoJUnitReport Write-Host "--- Run test" diff --git a/.go-version b/.go-version index 8909929f..acdfc793 100644 --- a/.go-version +++ b/.go-version @@ -1 +1 @@ -1.20.7 +1.20.10 diff --git a/.golangci.yml b/.golangci.yml index 27ef981e..247a210e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -83,7 +83,7 @@ linters-settings: gosimple: # Select the Go version to target. The default is '1.13'. - go: "1.20.7" + go: "1.20.10" nakedret: # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 @@ -117,19 +117,19 @@ linters-settings: staticcheck: # Select the Go version to target. The default is '1.13'. - go: "1.20.7" + go: "1.20.10" # https://staticcheck.io/docs/options#checks checks: ["all"] stylecheck: # Select the Go version to target. The default is '1.13'. - go: "1.20.7" + go: "1.20.10" # https://staticcheck.io/docs/options#checks checks: ["all"] unused: # Select the Go version to target. The default is '1.13'. - go: "1.20.7" + go: "1.20.10" gosec: excludes: