Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Go 1.20 support #1179

Merged
merged 3 commits into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,39 @@ on:
jobs:
run:
runs-on: ubuntu-latest

strategy:
matrix:
go: [1.19.x, 1.20.x]

steps:
- name: checkout source code
uses: actions/checkout@master
uses: actions/checkout@v3

- name: setup go environment
uses: actions/setup-go@v1
uses: actions/setup-go@v4
with:
go-version: '1.17.2'
- name: run tests
go-version: ${{ matrix.go }}

- name: create go.mod
run: |
export PATH="$(go env GOPATH)/bin:${PATH}"
set -x
make install.tools

# Fix for "cannot find main module" issue
go mod init github.com/opencontainers/runtime-spec

go get -d ./schema/...

- name: run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.51.2
args: --verbose

- name: run tests
run: |
set -x
make install.tools

make .govet
make .golint

make .gitvalidation
make docs
Expand Down
32 changes: 23 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,39 @@ on:
jobs:
run:
runs-on: ubuntu-latest

strategy:
matrix:
go: [1.19.x, 1.20.x]

steps:
- name: checkout source code
uses: actions/checkout@master
uses: actions/checkout@v3

- name: setup go environment
uses: actions/setup-go@v1
uses: actions/setup-go@v4
with:
go-version: '1.17.2'
- name: run tests
run: |
export PATH="$(go env GOPATH)/bin:${PATH}"
set -x
make install.tools
go-version: ${{ matrix.go }}

- name: create go.mod
run: |
# Fix for "cannot find main module" issue
go mod init github.com/opencontainers/runtime-spec

go get -d ./schema/...

- name: run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.51.2
args: --verbose

- name: run tests
run: |
set -x
make install.tools

make .govet
make .golint

make .gitvalidation
make docs
Expand Down
1 change: 1 addition & 0 deletions .tool/version-doc.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build ignore
// +build ignore

package main
Expand Down
18 changes: 2 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,6 @@ test: .govet .golint .gitvalidation
.govet:
go vet -x ./...

# `go get github.com/golang/lint/golint`
.golint:
ifeq ($(call ALLOWED_GO_VERSION,1.7,$(HOST_GOLANG_VERSION)),true)
@which golint > /dev/null 2>/dev/null || (echo "ERROR: golint not found. Consider 'make install.tools' target" && false)
golint ./...
endif


# When this is running in GitHub, it will only check the GitHub commit range
.gitvalidation:
@which git-validation > /dev/null 2>/dev/null || (echo "ERROR: git-validation not found. Consider 'make install.tools' target" && false)
Expand All @@ -78,16 +70,10 @@ else
git-validation -v -run DCO,short-subject,dangling-whitespace -range $(EPOCH_TEST_COMMIT)..HEAD
endif

install.tools: .install.golint .install.gitvalidation

# golint does not even build for <go1.7
.install.golint:
ifeq ($(call ALLOWED_GO_VERSION,1.7,$(HOST_GOLANG_VERSION)),true)
go get -u golang.org/x/lint/golint
endif
install.tools: .install.gitvalidation

.install.gitvalidation:
go get -u github.com/vbatts/git-validation
go install github.com/vbatts/git-validation@v1.2.0

clean:
rm -rf $(OUTPUT_DIRNAME) *~
Expand Down
4 changes: 2 additions & 2 deletions schema/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"fmt"
"io/ioutil"
"io"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -61,7 +61,7 @@ func main() {
}
documentLoader = gojsonschema.NewReferenceLoader("file://" + documentPath)
} else {
documentBytes, err := ioutil.ReadAll(os.Stdin)
documentBytes, err := io.ReadAll(os.Stdin)
if err != nil {
fmt.Println(err)
os.Exit(1)
Expand Down