fix(CI): add golangci-lint to dependencies (#10112)
* fix(CI): add golangci-lint to dependencies * update github workflow * tidy go.mod * add missing entries to go.mod * update deps * add missing run command * remove golint and use revive instead * fix workflow setup * lint only changed files * gofmt go tags * update comments * make lint-go Co-authored-by: Marko <marbar3778@yahoo.com> Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
parent
9d58a5ad30
commit
acf823d743
|
@ -11,19 +11,17 @@ jobs:
|
||||||
golangci:
|
golangci:
|
||||||
name: golangci-lint
|
name: golangci-lint
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 6
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/setup-go@v2.1.4
|
||||||
|
with:
|
||||||
|
go-version: 1.16
|
||||||
- uses: technote-space/get-diff-action@v5
|
- uses: technote-space/get-diff-action@v5
|
||||||
|
id: git_diff
|
||||||
with:
|
with:
|
||||||
PATTERNS: |
|
PATTERNS: |
|
||||||
**/**.go
|
**/**.go
|
||||||
go.mod
|
go.mod
|
||||||
go.sum
|
go.sum
|
||||||
- uses: golangci/golangci-lint-action@master
|
- name: run go linters
|
||||||
with:
|
run: make lint-go
|
||||||
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
|
|
||||||
version: v1.39
|
|
||||||
args: --timeout 10m
|
|
||||||
github-token: ${{ secrets.github_token }}
|
|
||||||
if: env.GIT_DIFF
|
if: env.GIT_DIFF
|
||||||
|
|
|
@ -15,7 +15,6 @@ linters:
|
||||||
- gocritic
|
- gocritic
|
||||||
- gofmt
|
- gofmt
|
||||||
- goimports
|
- goimports
|
||||||
- golint
|
|
||||||
- gosec
|
- gosec
|
||||||
- gosimple
|
- gosimple
|
||||||
- govet
|
- govet
|
||||||
|
@ -23,6 +22,7 @@ linters:
|
||||||
- misspell
|
- misspell
|
||||||
- nakedret
|
- nakedret
|
||||||
- prealloc
|
- prealloc
|
||||||
|
- revive
|
||||||
- exportloopref
|
- exportloopref
|
||||||
- staticcheck
|
- staticcheck
|
||||||
- structcheck
|
- structcheck
|
||||||
|
|
11
Makefile
11
Makefile
|
@ -344,14 +344,19 @@ markdownLintImage=tmknom/markdownlint
|
||||||
containerMarkdownLint=$(PROJECT_NAME)-markdownlint
|
containerMarkdownLint=$(PROJECT_NAME)-markdownlint
|
||||||
containerMarkdownLintFix=$(PROJECT_NAME)-markdownlint-fix
|
containerMarkdownLintFix=$(PROJECT_NAME)-markdownlint-fix
|
||||||
|
|
||||||
lint:
|
golangci_lint_cmd=go run github.com/golangci/golangci-lint/cmd/golangci-lint
|
||||||
golangci-lint run --out-format=tab
|
|
||||||
|
lint: lint-go
|
||||||
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerMarkdownLint}$$"; then docker start -a $(containerMarkdownLint); else docker run --name $(containerMarkdownLint) -i -v "$(CURDIR):/work" $(markdownLintImage); fi
|
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerMarkdownLint}$$"; then docker start -a $(containerMarkdownLint); else docker run --name $(containerMarkdownLint) -i -v "$(CURDIR):/work" $(markdownLintImage); fi
|
||||||
|
|
||||||
lint-fix:
|
lint-fix:
|
||||||
golangci-lint run --fix --out-format=tab --issues-exit-code=0
|
$(golangci_lint_cmd) run --fix --out-format=tab --issues-exit-code=0
|
||||||
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerMarkdownLintFix}$$"; then docker start -a $(containerMarkdownLintFix); else docker run --name $(containerMarkdownLintFix) -i -v "$(CURDIR):/work" $(markdownLintImage) . --fix; fi
|
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerMarkdownLintFix}$$"; then docker start -a $(containerMarkdownLintFix); else docker run --name $(containerMarkdownLintFix) -i -v "$(CURDIR):/work" $(markdownLintImage) . --fix; fi
|
||||||
|
|
||||||
|
lint-go:
|
||||||
|
echo $(GIT_DIFF)
|
||||||
|
$(golangci_lint_cmd) run --out-format=tab $(GIT_DIFF)
|
||||||
|
|
||||||
.PHONY: lint lint-fix
|
.PHONY: lint lint-fix
|
||||||
|
|
||||||
format:
|
format:
|
||||||
|
|
8
go.mod
8
go.mod
|
@ -18,6 +18,7 @@ require (
|
||||||
github.com/gogo/protobuf v1.3.3
|
github.com/gogo/protobuf v1.3.3
|
||||||
github.com/golang/mock v1.6.0
|
github.com/golang/mock v1.6.0
|
||||||
github.com/golang/protobuf v1.5.2
|
github.com/golang/protobuf v1.5.2
|
||||||
|
github.com/golangci/golangci-lint v1.42.1 // indirect
|
||||||
github.com/gorilla/handlers v1.5.1
|
github.com/gorilla/handlers v1.5.1
|
||||||
github.com/gorilla/mux v1.8.0
|
github.com/gorilla/mux v1.8.0
|
||||||
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
|
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
|
||||||
|
@ -26,8 +27,12 @@ require (
|
||||||
github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87
|
github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87
|
||||||
github.com/improbable-eng/grpc-web v0.14.1
|
github.com/improbable-eng/grpc-web v0.14.1
|
||||||
github.com/jhump/protoreflect v1.9.0
|
github.com/jhump/protoreflect v1.9.0
|
||||||
|
github.com/kr/text v0.2.0 // indirect
|
||||||
github.com/magiconair/properties v1.8.5
|
github.com/magiconair/properties v1.8.5
|
||||||
github.com/mattn/go-isatty v0.0.14
|
github.com/mattn/go-isatty v0.0.14
|
||||||
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
|
||||||
|
github.com/onsi/ginkgo v1.16.4 // indirect
|
||||||
|
github.com/onsi/gomega v1.13.0 // indirect
|
||||||
github.com/otiai10/copy v1.6.0
|
github.com/otiai10/copy v1.6.0
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/pkg/errors v0.9.1
|
||||||
github.com/prometheus/client_golang v1.11.0
|
github.com/prometheus/client_golang v1.11.0
|
||||||
|
@ -45,10 +50,11 @@ require (
|
||||||
github.com/tendermint/go-amino v0.16.0
|
github.com/tendermint/go-amino v0.16.0
|
||||||
github.com/tendermint/tendermint v0.34.13
|
github.com/tendermint/tendermint v0.34.13
|
||||||
github.com/tendermint/tm-db v0.6.4
|
github.com/tendermint/tm-db v0.6.4
|
||||||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
|
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a
|
||||||
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c
|
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c
|
||||||
google.golang.org/grpc v1.40.0
|
google.golang.org/grpc v1.40.0
|
||||||
google.golang.org/protobuf v1.27.1
|
google.golang.org/protobuf v1.27.1
|
||||||
|
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
|
||||||
gopkg.in/yaml.v2 v2.4.0
|
gopkg.in/yaml.v2 v2.4.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build !test_amino
|
||||||
// +build !test_amino
|
// +build !test_amino
|
||||||
|
|
||||||
package params
|
package params
|
||||||
|
|
Loading…
Reference in New Issue