Skip to content

Commit 028536f

Browse files
committed
Add Go 1.20 support
Swaps lint tooling from golint to golangci-lint. Resolve lint warnings for deprecated package io/ioutil. Add go.[mod/sum] to gitignore. Signed-off-by: Austin Vazquez <macedonv@amazon.com>
1 parent 7301c34 commit 028536f

5 files changed

Lines changed: 27 additions & 21 deletions

File tree

.github/workflows/build-pr.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,18 @@ on:
88
jobs:
99
run:
1010
runs-on: ubuntu-latest
11+
12+
strategy:
13+
matrix:
14+
go: ['1.18.x', '1.19.x', '1.20.x']
15+
1116
steps:
1217
- name: checkout source code
1318
uses: actions/checkout@master
1419
- name: setup go environment
15-
uses: actions/setup-go@v1
20+
uses: actions/setup-go@v3
1621
with:
17-
go-version: '1.17.2'
22+
go-version: ${{ matrix.go }}
1823
- name: run tests
1924
run: |
2025
export PATH="$(go env GOPATH)/bin:${PATH}"
@@ -26,7 +31,7 @@ jobs:
2631
2732
go get -d ./schema/...
2833
make .govet
29-
make .golint
34+
make .lint
3035
3136
make .gitvalidation
3237
make docs

.github/workflows/build.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,18 @@ on:
88
jobs:
99
run:
1010
runs-on: ubuntu-latest
11+
12+
strategy:
13+
matrix:
14+
go: ['1.18.x', '1.19.x', '1.20.x']
15+
1116
steps:
1217
- name: checkout source code
1318
uses: actions/checkout@master
1419
- name: setup go environment
15-
uses: actions/setup-go@v1
20+
uses: actions/setup-go@v3
1621
with:
17-
go-version: '1.17.2'
22+
go-version: ${{ matrix.go }}
1823
- name: run tests
1924
run: |
2025
export PATH="$(go env GOPATH)/bin:${PATH}"
@@ -26,7 +31,7 @@ jobs:
2631
2732
go get -d ./schema/...
2833
make .govet
29-
make .golint
34+
make .lint
3035
3136
make .gitvalidation
3237
make docs

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
go.mod
2+
go.sum
13
output
24
schema/validate
35
version.md

Makefile

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,9 @@ test: .govet .golint .gitvalidation
6161
.govet:
6262
go vet -x ./...
6363

64-
# `go get github.com/golang/lint/golint`
65-
.golint:
66-
ifeq ($(call ALLOWED_GO_VERSION,1.7,$(HOST_GOLANG_VERSION)),true)
67-
@which golint > /dev/null 2>/dev/null || (echo "ERROR: golint not found. Consider 'make install.tools' target" && false)
68-
golint ./...
69-
endif
64+
.lint:
65+
@which golangci-lint > /dev/null 2>/dev/null || (echo "ERROR: golangci-lint not found. Consider 'make install.tools' target" && false)
66+
golangci-lint run
7067

7168

7269
# When this is running in GitHub, it will only check the GitHub commit range
@@ -78,16 +75,13 @@ else
7875
git-validation -v -run DCO,short-subject,dangling-whitespace -range $(EPOCH_TEST_COMMIT)..HEAD
7976
endif
8077

81-
install.tools: .install.golint .install.gitvalidation
78+
install.tools: .install.lint .install.gitvalidation
8279

83-
# golint does not even build for <go1.7
84-
.install.golint:
85-
ifeq ($(call ALLOWED_GO_VERSION,1.7,$(HOST_GOLANG_VERSION)),true)
86-
go get -u golang.org/x/lint/golint
87-
endif
80+
.install.lint:
81+
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.0
8882

8983
.install.gitvalidation:
90-
go get -u github.com/vbatts/git-validation
84+
go install github.com/vbatts/git-validation@v1.1.0
9185

9286
clean:
9387
rm -rf $(OUTPUT_DIRNAME) *~

schema/validate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package main
22

33
import (
44
"fmt"
5-
"io/ioutil"
5+
"io"
66
"os"
77
"path/filepath"
88
"strings"
@@ -61,7 +61,7 @@ func main() {
6161
}
6262
documentLoader = gojsonschema.NewReferenceLoader("file://" + documentPath)
6363
} else {
64-
documentBytes, err := ioutil.ReadAll(os.Stdin)
64+
documentBytes, err := io.ReadAll(os.Stdin)
6565
if err != nil {
6666
fmt.Println(err)
6767
os.Exit(1)

0 commit comments

Comments
 (0)