1
0
mirror of https://github.com/opencontainers/runtime-spec.git synced 2025-04-18 20:04:01 +03:00

Switch Go linting to use golangci-lint

Signed-off-by: Austin Vazquez <macedonv@amazon.com>
This commit is contained in:
Austin Vazquez 2023-03-16 16:06:00 +00:00
parent c9b5d0e19a
commit 15d2a5a2ed
4 changed files with 32 additions and 25 deletions

View File

@ -11,22 +11,32 @@ jobs:
steps:
- name: checkout source code
uses: actions/checkout@master
- name: setup go environment
uses: actions/setup-go@v1
with:
go-version: '1.17.2'
- 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: |
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/...
make .govet
make .golint
make .gitvalidation
make docs

View File

@ -11,22 +11,32 @@ jobs:
steps:
- name: checkout source code
uses: actions/checkout@master
- name: setup go environment
uses: actions/setup-go@v1
with:
go-version: '1.17.2'
- 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: |
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/...
make .govet
make .golint
make .gitvalidation
make docs

View File

@ -1,3 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@ -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)
@ -78,13 +70,7 @@ 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