Skip to content

Commit

Permalink
[Automation] Bump Go version to 1.22.1 (#73)
Browse files Browse the repository at this point in the history
* chore: Update Go version in .

* chore: Run `go mod tidy` in .

* chore: Update .github/workflows/goreleaser.yml

* chore: Update .github/workflows/golangci-lint.yml

* chore: Update .github/workflows/go.yml

* chore: Update Go version in GVM readme.

* Fix TestGVMRunUse failure

Use GOTOOLCHAIN=local when testing versions >= 1.21.

 --- FAIL: TestGVMRunUse (160.37s)
    --- FAIL: TestGVMRunUse/1.21.0_bash (3.06s)
        use_test.go:95: export GOROOT="/home/runner/.gvm/versions/go1.21.0.linux.amd64"
            export PATH="/home/runner/.gvm/versions/go1.21.0.linux.amd64/bin:$PATH"
        use_test.go:127: failed to run go version: exit status 1
            go: downloading go1.22 (linux/amd64)
            go: download go1.22 for linux/amd64: toolchain not available
    --- FAIL: TestGVMRunUse/1.21_bash (0.39s)
        use_test.go:95: export GOROOT="/home/runner/.gvm/versions/go1.21.0.linux.amd64"
            export PATH="/home/runner/.gvm/versions/go1.21.0.linux.amd64/bin:$PATH"
        use_test.go:127: failed to run go version: exit status 1
            go: downloading go1.22 (linux/amd64)
            go: download go1.22 for linux/amd64: toolchain not available
FAIL
  • Loading branch information
andrewkroh committed Mar 21, 2024
1 parent 4297e21 commit 89e52d6
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.22.x'

- name: cross build with goreleaser
uses: goreleaser/goreleaser-action@v3
Expand All @@ -48,7 +48,7 @@ jobs:
- name: set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.22.x'

- name: go test
run: go test -timeout 15m ./...
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.22.x'

- uses: actions/checkout@v4

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.22.x'
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Changed

- This release is built with Go 1.22.1. [#73](https://github.com/andrewkroh/gvm/pull/73)

### Fixed

### Added
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ examples for common shells.

bash:

`eval "$(gvm 1.21.0)"`
`eval "$(gvm 1.22.1)"`

cmd.exe (for batch scripts `%i` should be substituted with `%%i`):

`FOR /f "tokens=*" %i IN ('"gvm.exe" 1.21.0') DO %i`
`FOR /f "tokens=*" %i IN ('"gvm.exe" 1.22.1') DO %i`

powershell:

`gvm --format=powershell 1.21.0 | Invoke-Expression`
`gvm --format=powershell 1.22.1 | Invoke-Expression`

gvm flags can be set via environment variables by setting `GVM_<flag>`. For
example `--http-timeout` can be set via `GVM_HTTP_TIMEOUT=10m`.
Expand All @@ -36,7 +36,7 @@ Linux (amd64):
# Linux Example (assumes ~/bin is in PATH).
curl -sL -o ~/bin/gvm https://github.com/andrewkroh/gvm/releases/download/v0.5.2/gvm-linux-amd64
chmod +x ~/bin/gvm
eval "$(gvm 1.21.0)"
eval "$(gvm 1.22.1)"
go version
```

Expand All @@ -46,7 +46,7 @@ Linux (arm64):
# Linux Example (assumes ~/bin is in PATH).
curl -sL -o ~/bin/gvm https://github.com/andrewkroh/gvm/releases/download/v0.5.2/gvm-linux-arm64
chmod +x ~/bin/gvm
eval "$(gvm 1.21.0)"
eval "$(gvm 1.22.1)"
go version
```

Expand All @@ -56,7 +56,7 @@ macOS (universal):
# macOS Example
curl -sL -o /usr/local/bin/gvm https://github.com/andrewkroh/gvm/releases/download/v0.5.2/gvm-darwin-all
chmod +x /usr/local/bin/gvm
eval "$(gvm 1.21.0)"
eval "$(gvm 1.22.1)"
go version
```

Expand All @@ -65,13 +65,13 @@ Windows (PowerShell):
```
[Net.ServicePointManager]::SecurityProtocol = "tls12"
Invoke-WebRequest -URI https://github.com/andrewkroh/gvm/releases/download/v0.5.2/gvm-windows-amd64.exe -Outfile C:\Windows\System32\gvm.exe
gvm --format=powershell 1.21.0 | Invoke-Expression
gvm --format=powershell 1.22.1 | Invoke-Expression
go version
```

Fish Shell:

Use `gvm` with fish shell by executing `gvm 1.21.0 | source` in lieu of using `eval`.
Use `gvm` with fish shell by executing `gvm 1.22.1 | source` in lieu of using `eval`.

For existing Go users:

Expand Down
7 changes: 7 additions & 0 deletions cmd/gvm/use_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ var (
go1_9 = gvm.MustParseVersion("1.9")
go1_11 = gvm.MustParseVersion("1.11")
go1_16 = gvm.MustParseVersion("1.16")
go1_21 = gvm.MustParseVersion("1.21")
)

func TestGVMRunUse(t *testing.T) {
Expand Down Expand Up @@ -71,6 +72,12 @@ func TestGVMRunUse(t *testing.T) {
t.Skip("Go 1.10 fails on MacOS 12. https://github.com/golang/go/wiki/MacOS12BSDThreadRegisterIssue")
}

// Go 1.21 and newer will try to download a toolchain to match the version in the go.mod.
// Disable this behavior so that only the Go version manged by GVM is used.
if !ver.LessThan(go1_21) {
t.Setenv("GOTOOLCHAIN", "local")
}

output, err := withStdout(func() {
manager := &gvm.Manager{}
if err := manager.Init(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/andrewkroh/gvm

go 1.20
go 1.22

require (
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09
github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU=
github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w=
github.com/otiai10/mint v1.5.1 h1:XaPLeE+9vGbuyEHem1JNk3bYc7KKqyI/na0/mLd/Kks=
github.com/otiai10/mint v1.5.1/go.mod h1:MJm72SBthJjz8qhefc4z1PYEieWmy8Bku7CjcAqyUSM=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
Expand Down

0 comments on commit 89e52d6

Please sign in to comment.