Skip to content

Commit

Permalink
Bump to Go 1.18 and update GH action versions (#54)
Browse files Browse the repository at this point in the history
* Bump to Go 1.18 and update GH action versions

* Prepend 'v' to golangci-lint version

* Update to Go 1.18.5 on AppVeyor

* Log stderr on test failure

* Set GOROOT

GOROOT was dropped by actions/setup-go#175.

If it is not set then this test fails with:

    --- FAIL: TestGVMRunUse (5.45s)
    --- FAIL: TestGVMRunUse/1.7.4_bash (2.68s)
        use_test.go:54: export GOROOT="/home/runner/.gvm/versions/go1.7.4.linux.amd64"
            export PATH="/home/runner/.gvm/versions/go1.7.4.linux.amd64/bin:$PATH"

        use_test.go:79: failed to run go version: exit status 2
            go: cannot find GOROOT directory: /usr/local/go
  • Loading branch information
andrewkroh committed Aug 3, 2022
1 parent 0f49d00 commit 7ca12b6
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Expand Up @@ -7,7 +7,7 @@ image: Visual Studio 2015
environment:
GOPATH: c:\gopath
GO111MODULE: on
GVM_GO_VERSION: 1.17.8
GVM_GO_VERSION: 1.18.5
GVM_DL: https://github.com/andrewkroh/gvm/releases/download/v0.4.1/gvm-windows-amd64.exe

# Custom clone folder (variables are not expanded here).
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/go.yml
Expand Up @@ -14,14 +14,13 @@ jobs:
strategy:
matrix:
go-version:
- 1.17
- 1.18
- 1.19
steps:
- name: checkout
uses: actions/checkout@master
- uses: actions/checkout@v3

- name: set up Go
uses: actions/setup-go@v1
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}

Expand All @@ -39,7 +38,7 @@ jobs:

-
name: cross build with goreleaser
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser
version: latest
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/golangci-lint.yml
Expand Up @@ -16,8 +16,13 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
go-version: 1.18

- uses: actions/checkout@v3

- name: golangci-lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v3
with:
version: v1.44.2
version: v1.47.0
8 changes: 4 additions & 4 deletions .github/workflows/goreleaser.yml
Expand Up @@ -11,17 +11,17 @@ jobs:
steps:
-
name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: '1.17'
go-version: '1.18'
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser
version: latest
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Changed

- Updated releases to use Go 1.18. [#54](https://github.com/andrewkroh/gvm/pull/54)

### Fixed

- Fix `--arch` flag and associated `GVM_ARCH` env variable. [#53](https://github.com/andrewkroh/gvm/pull/53)
Expand Down
13 changes: 11 additions & 2 deletions cmd/gvm/use_test.go
Expand Up @@ -2,6 +2,7 @@ package main

import (
"bytes"
"errors"
"fmt"
"io"
"os"
Expand Down Expand Up @@ -71,9 +72,17 @@ func TestGVMRunUse(t *testing.T) {
}

// Test that GOROOT/bin/go exists and is the correct version.
version, err := exec.Command(filepath.Join(goroot, "bin", "go"), "version").Output()
goVersionCmd := exec.Command(filepath.Join(goroot, "bin", "go"), "version")
goVersionCmd.Env = append(goVersionCmd.Env, "GOROOT="+goroot)

version, err := goVersionCmd.Output()
if err != nil {
t.Fatal("failed to run go version", err)
var exitErr *exec.ExitError
if errors.As(err, &exitErr) {
t.Fatalf("failed to run go version: %v\n%s", err, exitErr.Stderr)
} else {
t.Fatal("failed to run go version", err)
}
}
assert.Contains(t, string(version), tc.Version)
})
Expand Down

0 comments on commit 7ca12b6

Please sign in to comment.