Skip to content

Commit d812e7b

Browse files
authored
Bump lint (#42)
1 parent 46c1d65 commit d812e7b

File tree

4 files changed

+17
-24
lines changed

4 files changed

+17
-24
lines changed

.github/workflows/workflow.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,5 @@ jobs:
5050
- name: golangci-lint
5151
uses: golangci/golangci-lint-action@v3
5252
with:
53-
version: v1.52
53+
version: v1.64.8
5454
skip-cache: true # cache/restore is done by actions/setup-go step

.golangci.yml

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,41 @@ linters:
33
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
44
disable-all: true
55
enable:
6+
- errcheck
7+
- nilerr
8+
- ineffassign
9+
- staticcheck
10+
- gosec
611
- bodyclose
7-
- depguard
12+
813
- dogsled
914
- dupl
10-
- errcheck
1115
- exhaustive
12-
- exportloopref
1316
- funlen
1417
- gochecknoinits
1518
- gocognit
1619
- goconst
1720
- gocritic
1821
- gocyclo
19-
- goerr113
20-
- gofmt
2122
- goimports
2223
- goprintffuncname
23-
- gosec
2424
- gosimple
2525
- govet
26-
- ineffassign
2726
- lll
2827
- misspell
2928
- nakedret
30-
#- noctx # TODO: enable
29+
# - noctx # TODO: enable
3130
- nolintlint
3231
- nlreturn
3332
- prealloc
3433
- revive
3534
- rowserrcheck
36-
- staticcheck
3735
- stylecheck
38-
- typecheck
3936
- unconvert
4037
- unparam
4138
- unused
39+
# - depguard # TODO: enable
40+
# - err113 # TODO: enable
4241

4342
# disabled:
4443
# - asciicheck
@@ -64,8 +63,6 @@ linters-settings:
6463
funlen:
6564
lines: 100
6665
statements: 50
67-
gci:
68-
local-prefixes: github.com/vtopc/go-monobank
6966
goconst:
7067
min-len: 2
7168
min-occurrences: 2
@@ -94,7 +91,7 @@ linters-settings:
9491
# don't include the "operation" and "assign"
9592
checks: argument,case,condition,return
9693
govet:
97-
check-shadowing: true
94+
shadow: true
9895
#settings:
9996
# printf:
10097
# funcs:
@@ -130,10 +127,3 @@ issues:
130127
#run:
131128
# skip-dirs:
132129
# - test/testdata_etc
133-
134-
# golangci.com configuration
135-
# https://github.com/golangci/golangci/wiki/Configuration
136-
service:
137-
golangci-lint-version: 1.35.x # use the fixed version to not introduce new linters unexpectedly
138-
prepare:
139-
- echo "here I can run custom commands, but no preparation needed for this repo"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ deps:
1212
# linter:
1313
GOLINT = $(GOPATH)/bin/golangci-lint
1414
$(GOLINT):
15-
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.52.0
15+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(GOPATH)/bin v1.64.8
1616

1717
NILAWAY = $(GOPATH)/bin/nilaway
1818
$(NILAWAY):

auth_corp.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,19 @@ func (a CorpAuth) SetAuth(r *http.Request) error {
104104

105105
var actor string
106106
switch {
107-
case len(a.requestID) > 0:
107+
case a.requestID != "":
108108
actor = a.requestID
109109
r.Header.Set("X-Request-Id", actor)
110-
case len(a.permissions) > 0:
110+
case a.permissions != "":
111111
actor = a.permissions
112112
r.Header.Set("X-Permissions", actor)
113113
}
114114

115115
timestamp := strconv.FormatInt(time.Now().Unix(), 10)
116116

117+
if r.URL == nil {
118+
return errors.New("missing URL in request")
119+
}
117120
sign, err := a.sign(timestamp, actor, r.URL.Path)
118121
if err != nil {
119122
return fmt.Errorf("calculate Sign: %w", err)

0 commit comments

Comments
 (0)