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:
Robert Zaremba 2021-09-14 11:05:30 +02:00 committed by GitHub
parent 9d58a5ad30
commit acf823d743
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 417 additions and 20 deletions

View File

@ -11,19 +11,17 @@ jobs:
golangci:
name: golangci-lint
runs-on: ubuntu-latest
timeout-minutes: 6
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2.1.4
with:
go-version: 1.16
- uses: technote-space/get-diff-action@v5
id: git_diff
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: golangci/golangci-lint-action@master
with:
# 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 }}
- name: run go linters
run: make lint-go
if: env.GIT_DIFF

View File

@ -15,7 +15,6 @@ linters:
- gocritic
- gofmt
- goimports
- golint
- gosec
- gosimple
- govet
@ -23,6 +22,7 @@ linters:
- misspell
- nakedret
- prealloc
- revive
- exportloopref
- staticcheck
- structcheck

View File

@ -344,14 +344,19 @@ markdownLintImage=tmknom/markdownlint
containerMarkdownLint=$(PROJECT_NAME)-markdownlint
containerMarkdownLintFix=$(PROJECT_NAME)-markdownlint-fix
lint:
golangci-lint run --out-format=tab
golangci_lint_cmd=go run github.com/golangci/golangci-lint/cmd/golangci-lint
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
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
lint-go:
echo $(GIT_DIFF)
$(golangci_lint_cmd) run --out-format=tab $(GIT_DIFF)
.PHONY: lint lint-fix
format:

8
go.mod
View File

@ -18,6 +18,7 @@ require (
github.com/gogo/protobuf v1.3.3
github.com/golang/mock v1.6.0
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/mux v1.8.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/improbable-eng/grpc-web v0.14.1
github.com/jhump/protoreflect v1.9.0
github.com/kr/text v0.2.0 // indirect
github.com/magiconair/properties v1.8.5
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/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.11.0
@ -45,10 +50,11 @@ require (
github.com/tendermint/go-amino v0.16.0
github.com/tendermint/tendermint v0.34.13
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/grpc v1.40.0
google.golang.org/protobuf v1.27.1
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/yaml.v2 v2.4.0
)

401
go.sum

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,4 @@
//go:build !test_amino
// +build !test_amino
package params