Skip to content

Commit

Permalink
Add Go 1.20 support
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
austinvazquez committed Feb 2, 2023
1 parent 7301c34 commit 028536f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 21 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ on:
jobs:
run:
runs-on: ubuntu-latest

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

steps:
- name: checkout source code
uses: actions/checkout@master
- name: setup go environment
uses: actions/setup-go@v1
uses: actions/setup-go@v3
with:
go-version: '1.17.2'
go-version: ${{ matrix.go }}
- name: run tests
run: |
export PATH="$(go env GOPATH)/bin:${PATH}"
Expand All @@ -26,7 +31,7 @@ jobs:
go get -d ./schema/...
make .govet
make .golint
make .lint
make .gitvalidation
make docs
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ on:
jobs:
run:
runs-on: ubuntu-latest

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

steps:
- name: checkout source code
uses: actions/checkout@master
- name: setup go environment
uses: actions/setup-go@v1
uses: actions/setup-go@v3
with:
go-version: '1.17.2'
go-version: ${{ matrix.go }}
- name: run tests
run: |
export PATH="$(go env GOPATH)/bin:${PATH}"
Expand All @@ -26,7 +31,7 @@ jobs:
go get -d ./schema/...
make .govet
make .golint
make .lint
make .gitvalidation
make docs
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
go.mod
go.sum
output
schema/validate
version.md
20 changes: 7 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,9 @@ 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
.lint:
@which golangci-lint > /dev/null 2>/dev/null || (echo "ERROR: golangci-lint not found. Consider 'make install.tools' target" && false)
golangci-lint run


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

install.tools: .install.golint .install.gitvalidation
install.tools: .install.lint .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.lint:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.0

.install.gitvalidation:
go get -u github.com/vbatts/git-validation
go install github.com/vbatts/git-validation@v1.1.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

0 comments on commit 028536f

Please sign in to comment.