Skip to content

Commit

Permalink
build: move golangci flags to its own config file.
Browse files Browse the repository at this point in the history
  • Loading branch information
dajohi authored and davecgh committed Mar 28, 2023
1 parent 59e1d24 commit 4c70396
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
with:
go-version: ${{ matrix.go }}
- name: Check out source
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c #v3.3.0
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 #v3.5.0
- name: Install Linters
run: "curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.51.1"
run: "curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.52.2"
- name: Build
run: go build ./...
- name: Test
Expand Down
30 changes: 30 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
run:
deadline: 10m

linters:
build-tags:
- rpctest

disable-all: true
enable:
- asciicheck
- bidichk
- bodyclose
- durationcheck
- errchkjson
- exportloopref
- gofmt
- goimports
- gosimple
- govet
- grouper
- ineffassign
- misspell
- nosprintfhostport
- reassign
- rowserrcheck
- tparallel
- typecheck
- unconvert
- unused
- vetshadow
2 changes: 1 addition & 1 deletion cmd/addblock/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ func newBlockImporter(ctx context.Context, db database.DB, utxoDb *leveldb.DB, r
MaxSize: 100 * 1024 * 1024, // 100 MiB
})

chain, err := blockchain.New(context.Background(),
chain, err := blockchain.New(ctx,
&blockchain.Config{
DB: db,
ChainParams: activeNetParams,
Expand Down
9 changes: 1 addition & 8 deletions run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,7 @@ for module in $MODPATHS; do
cd $MODNAME

# run linters
golangci-lint run --build-tags=rpctest --disable-all --deadline=10m \
--enable=gofmt \
--enable=gosimple \
--enable=unconvert \
--enable=ineffassign \
--enable=govet \
--enable=misspell \
--enable=unused \
golangci-lint run
)
done

Expand Down

0 comments on commit 4c70396

Please sign in to comment.