Skip to content

Commit

Permalink
.golanci: update linting settings (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
davecheney authored Oct 31, 2023
1 parent 432dda5 commit 3009e19
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 18 deletions.
13 changes: 2 additions & 11 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ run:
linters:
enable-all: true
disable:
- asasalint
- bodyclose
- containedctx
- contextcheck
Expand Down Expand Up @@ -41,15 +42,14 @@ linters:
- maintidx
- maligned # Replaced by govet
- musttag # flaky, fires on structs which aren't JSON marshalled
- nilnil
- nlreturn
- noctx
- nonamedreturns
- nosnakecase
- paralleltest
- prealloc
- rowserrcheck # disabled because of generics https://github.com/golangci/golangci-lint/issues/2649.
- scopelint # Replaced by exportloopref.
- sqlclosecheck # disabled because of generics https://github.com/golangci/golangci-lint/issues/2649.
- structcheck # replaced with unused
- tagliatelle
- tagalign # too fussy
Expand All @@ -58,19 +58,13 @@ linters:
- usestdlibvars
- varcheck # Replaced by unused.
- varnamelen
- wastedassign # disabled because of generics
- whitespace
- wrapcheck
- wsl

linters-settings:
gofumpt:
module-path: github.com/pkg/json
gosec:
excludes:
- G112 # Potential slowloris attack
- G114 # Use of net/http serve function that has no support for setting timeouts
- G404 # Insecure random number source (rand)
revive:
rules:
- name: var-naming
Expand All @@ -83,9 +77,6 @@ linters-settings:
]
unparam:
check-exported: false
usestdlibvars:
http-method: false
http-status-code: false

issues:
max-issues-per-linter: 0
Expand Down
14 changes: 7 additions & 7 deletions decoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,20 +180,20 @@ func TestDecoderDecode(t *testing.T) {
decode("1", &u)
assert(u, uint(1))

var any interface{}
decode("{}", &any)
assert(any, map[string]interface{}{})
var a interface{}
decode("{}", &a)
assert(a, map[string]interface{}{})

decode(`{"a": 1, "b": {"c": 2}}`, &any)
assert(any, map[string]interface{}{
decode(`{"a": 1, "b": {"c": 2}}`, &a)
assert(a, map[string]interface{}{
"a": float64(1),
"b": map[string]interface{}{
"c": float64(2),
},
})

decode(`[{"a": [{}]}]`, &any)
assert(any, []interface{}{
decode(`[{"a": [{}]}]`, &a)
assert(a, []interface{}{
map[string]interface{}{
"a": []interface{}{
map[string]interface{}{},
Expand Down

0 comments on commit 3009e19

Please sign in to comment.