Skip to content

Commit 9067ce6

Browse files
authored
Merge pull request #1179 from austinvazquez/add-go-1.20
Add Go 1.20 support
2 parents a7c7692 + 167ffb4 commit 9067ce6

File tree

5 files changed

+51
-36
lines changed

5 files changed

+51
-36
lines changed

.github/workflows/build-pr.yml

+23-9
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,39 @@ on:
88
jobs:
99
run:
1010
runs-on: ubuntu-latest
11+
12+
strategy:
13+
matrix:
14+
go: [1.19.x, 1.20.x]
15+
1116
steps:
1217
- name: checkout source code
13-
uses: actions/checkout@master
18+
uses: actions/checkout@v3
19+
1420
- name: setup go environment
15-
uses: actions/setup-go@v1
21+
uses: actions/setup-go@v4
1622
with:
17-
go-version: '1.17.2'
18-
- name: run tests
23+
go-version: ${{ matrix.go }}
24+
25+
- name: create go.mod
1926
run: |
20-
export PATH="$(go env GOPATH)/bin:${PATH}"
21-
set -x
22-
make install.tools
23-
2427
# Fix for "cannot find main module" issue
2528
go mod init github.com/opencontainers/runtime-spec
2629
2730
go get -d ./schema/...
31+
32+
- name: run golangci-lint
33+
uses: golangci/golangci-lint-action@v3
34+
with:
35+
version: v1.51.2
36+
args: --verbose
37+
38+
- name: run tests
39+
run: |
40+
set -x
41+
make install.tools
42+
2843
make .govet
29-
make .golint
3044
3145
make .gitvalidation
3246
make docs

.github/workflows/build.yml

+23-9
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,39 @@ on:
88
jobs:
99
run:
1010
runs-on: ubuntu-latest
11+
12+
strategy:
13+
matrix:
14+
go: [1.19.x, 1.20.x]
15+
1116
steps:
1217
- name: checkout source code
13-
uses: actions/checkout@master
18+
uses: actions/checkout@v3
19+
1420
- name: setup go environment
15-
uses: actions/setup-go@v1
21+
uses: actions/setup-go@v4
1622
with:
17-
go-version: '1.17.2'
18-
- name: run tests
19-
run: |
20-
export PATH="$(go env GOPATH)/bin:${PATH}"
21-
set -x
22-
make install.tools
23+
go-version: ${{ matrix.go }}
2324

25+
- name: create go.mod
26+
run: |
2427
# Fix for "cannot find main module" issue
2528
go mod init github.com/opencontainers/runtime-spec
2629
2730
go get -d ./schema/...
31+
32+
- name: run golangci-lint
33+
uses: golangci/golangci-lint-action@v3
34+
with:
35+
version: v1.51.2
36+
args: --verbose
37+
38+
- name: run tests
39+
run: |
40+
set -x
41+
make install.tools
42+
2843
make .govet
29-
make .golint
3044
3145
make .gitvalidation
3246
make docs

.tool/version-doc.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build ignore
12
// +build ignore
23

34
package main

Makefile

+2-16
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,6 @@ 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
70-
71-
7264
# When this is running in GitHub, it will only check the GitHub commit range
7365
.gitvalidation:
7466
@which git-validation > /dev/null 2>/dev/null || (echo "ERROR: git-validation not found. Consider 'make install.tools' target" && false)
@@ -78,16 +70,10 @@ else
7870
git-validation -v -run DCO,short-subject,dangling-whitespace -range $(EPOCH_TEST_COMMIT)..HEAD
7971
endif
8072

81-
install.tools: .install.golint .install.gitvalidation
82-
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
73+
install.tools: .install.gitvalidation
8874

8975
.install.gitvalidation:
90-
go get -u github.com/vbatts/git-validation
76+
go install github.com/vbatts/git-validation@v1.2.0
9177

9278
clean:
9379
rm -rf $(OUTPUT_DIRNAME) *~

schema/validate.go

+2-2
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)