diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 1fda24d2d2..28ba9c4e8c 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - go: [1.17] + go: [1.17, 1.18.0-rc1] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 @@ -19,6 +19,7 @@ jobs: uses: actions/setup-go@v2 with: go-version: ${{ matrix.go }} + stable: ${{ !contains(matrix.go, 'rc') }} - run: ./gomod.sh - run: ./gofmt.sh - run: ./gogenerate.sh @@ -29,7 +30,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - go: [1.17, 1.16.7] + go: [1.17, 1.16.7, 1.18.0-rc1] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 @@ -37,13 +38,14 @@ jobs: uses: actions/setup-go@v2 with: go-version: ${{ matrix.go }} + stable: ${{ !contains(matrix.go, 'rc') }} - run: go build ./... test: strategy: matrix: os: [ubuntu-latest] - go: [1.17, 1.16.7] + go: [1.17, 1.16.7, 1.18.0-rc1] pg: [9.6.5, 10] runs-on: ${{ matrix.os }} services: @@ -83,4 +85,5 @@ jobs: uses: actions/setup-go@v2 with: go-version: ${{ matrix.go }} + stable: ${{ !contains(matrix.go, 'rc') }} - run: go test -race -cover ./... diff --git a/staticcheck.sh b/staticcheck.sh index 963d0b3368..ada16a6b4c 100755 --- a/staticcheck.sh +++ b/staticcheck.sh @@ -1,7 +1,13 @@ #! /bin/bash set -e +gover=$(go version | { read _ _ gover _; printf $gover; }) + version='2020.1.4' +if [[ "$gover" = "go1.18"* ]]; then + version='d5c28addcbbbafca0b9a0f9ad8957912e9371015' +fi + staticcheck='go run honnef.co/go/tools/cmd/staticcheck@'"$version" printf "Running staticcheck $version...\n" @@ -10,6 +16,10 @@ ls -d */ \ | egrep -v '^vendor|^docs' \ | xargs -I {} $staticcheck -tests=false -checks="all,-ST1003,-SA1019,-ST1005,-ST1000,-ST1016,-S1039,-ST1021,-ST1020,-ST1019,-SA4022" ./{}... - -# Check horizon for unused exported symbols (relying on the fact that it should be self-contained) -$staticcheck -unused.whole-program -checks='U*' ./services/horizon/... +# Whole program unused checks were removed from staticcheck in newer versions, +# so this check is being sunset and will be removed once Go 1.18 is released and +# a proper release of staticcheck is released that supports it. +if [ "$version" = "2020.1.4" ]; then + # Check horizon for unused exported symbols (relying on the fact that it should be self-contained) + $staticcheck -unused.whole-program -checks='U*' ./services/horizon/... +fi