Skip to content

Commit 60c0215

Browse files
authored
Add lint config (#5)
1 parent 8f570b0 commit 60c0215

File tree

6 files changed

+54
-7
lines changed

6 files changed

+54
-7
lines changed

.golangci.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# See https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml
2+
run:
3+
tests: true
4+
5+
linters-settings:
6+
errcheck:
7+
check-type-assertions: true
8+
check-blank: true
9+
gocyclo:
10+
min-complexity: 20
11+
dupl:
12+
threshold: 100
13+
misspell:
14+
locale: US
15+
unused:
16+
check-exported: false
17+
unparam:
18+
check-exported: true
19+
20+
linters:
21+
enable-all: true
22+
disable:
23+
- lll
24+
- maligned
25+
- gochecknoglobals
26+
- gomnd
27+
- wrapcheck
28+
- paralleltest
29+
- forbidigo
30+
- exhaustivestruct
31+
32+
issues:
33+
exclude-use-default: false
34+
exclude-rules:
35+
- linters:
36+
- gomnd
37+
- goconst
38+
- goerr113
39+
- noctx
40+
- funlen
41+
- dupl
42+
path: "_test.go"
43+

Makefile

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#GOLANGCI_LINT_VERSION := "v1.37.1" # Optional configuration to pinpoint golangci-lint version.
2+
13
# The head of Makefile determines location of dev-go to include standard targets.
24
GO ?= go
35
export GO111MODULE = on
@@ -26,10 +28,10 @@ ifeq ($(DEVGO_PATH),)
2628
endif
2729

2830
-include $(DEVGO_PATH)/makefiles/main.mk
31+
-include $(DEVGO_PATH)/makefiles/lint.mk
2932
-include $(DEVGO_PATH)/makefiles/test-unit.mk
3033
-include $(DEVGO_PATH)/makefiles/bench.mk
31-
-include $(DEVGO_PATH)/makefiles/lint.mk
32-
-include $(DEVGO_PATH)/makefiles/github-actions.mk
34+
-include $(DEVGO_PATH)/makefiles/reset-ci.mk
3335

3436
## Run tests
3537
test: test-unit

context_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ package stats_test
22

33
import (
44
"context"
5+
"testing"
6+
57
"github.com/bool64/stats"
68
"github.com/stretchr/testify/assert"
7-
"testing"
89
)
910

1011
func TestAddKeysAndValues(t *testing.T) {
@@ -25,6 +26,7 @@ func TestAddKeysAndValues(t *testing.T) {
2526

2627
func BenchmarkAddKeysAndValues(b *testing.B) {
2728
b.ReportAllocs()
29+
2830
for i := 0; i < b.N; i++ {
2931
ctx := stats.AddKeysAndValues(context.Background(), "k1", "one", "k2", "two")
3032
_ = stats.KeysAndValues(ctx)

dev_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
package stats_test
22

3-
import _ "github.com/bool64/dev"
3+
import _ "github.com/bool64/dev" // Include CI/Dev scripts to project.

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ module github.com/bool64/stats
33
go 1.13
44

55
require (
6-
github.com/bool64/dev v0.1.20
6+
github.com/bool64/dev v0.1.21
77
github.com/stretchr/testify v1.4.0
88
)

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
github.com/bool64/dev v0.1.20 h1:PeDScN45cziC5Swn1Xgam4LWDwaa5rsRB28vW9x771U=
2-
github.com/bool64/dev v0.1.20/go.mod h1:cTHiTDNc8EewrQPy3p1obNilpMpdmlUesDkFTF2zRWU=
1+
github.com/bool64/dev v0.1.21 h1:1wq0bbIHinSXcmQMPuyTrSLCeeMgn2m9Rfv3R4olEyQ=
2+
github.com/bool64/dev v0.1.21/go.mod h1:cTHiTDNc8EewrQPy3p1obNilpMpdmlUesDkFTF2zRWU=
33
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
44
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
55
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

0 commit comments

Comments
 (0)