Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8e9adf2

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. Adds Go strategy matrix for Go 1.18, 1.19, and 1.20. Update actions/setup-go package from v1 to v3 to resolve CI warnings. Signed-off-by: Austin Vazquez <[email protected]>
1 parent 7301c34 commit 8e9adf2

File tree

5 files changed

+31
-21
lines changed

5 files changed

+31
-21
lines changed

.github/workflows/build-pr.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,20 @@ 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
19+
1420
- name: setup go environment
15-
uses: actions/setup-go@v1
21+
uses: actions/setup-go@v3
1622
with:
17-
go-version: '1.17.2'
23+
go-version: ${{ matrix.go }}
24+
1825
- name: run tests
1926
run: |
2027
export PATH="$(go env GOPATH)/bin:${PATH}"
@@ -26,7 +33,7 @@ jobs:
2633
2734
go get -d ./schema/...
2835
make .govet
29-
make .golint
36+
make .lint
3037
3138
make .gitvalidation
3239
make docs

.github/workflows/build.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,20 @@ 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
19+
1420
- name: setup go environment
15-
uses: actions/setup-go@v1
21+
uses: actions/setup-go@v3
1622
with:
17-
go-version: '1.17.2'
23+
go-version: ${{ matrix.go }}
24+
1825
- name: run tests
1926
run: |
2027
export PATH="$(go env GOPATH)/bin:${PATH}"
@@ -26,7 +33,7 @@ jobs:
2633
2734
go get -d ./schema/...
2835
make .govet
29-
make .golint
36+
make .lint
3037
3138
make .gitvalidation
3239
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/[email protected]
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)