Skip to content

Commit 2c9efde

Browse files
authored
Merge pull request #5547 from twz123/enable-nilnesserr
Enable nilnesserr linter
2 parents 974e411 + b8de298 commit 2c9efde

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

.golangci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ linters:
1919
- gofmt # Checks whether code was gofmt-ed
2020
- goheader # Checks is file headers matche a given pattern
2121
- intrange # Checking for loops that could use an integer range
22+
- nilnesserr # Reports constructs that check for err != nil but return a different nil value error
2223
- nolintlint # Find ill-formed or insufficiently explained nolint directives
2324
- nosprintfhostport # Detects misuses of Sprintf to construct hosts with ports in a URL
2425
- perfsprint # Checks for faster fmt.Sprintf alternatives

pkg/token/joindecode.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ func DecodeJoinToken(token string) ([]byte, error) {
3939

4040
var buf bytes.Buffer
4141
_, err = io.Copy(&buf, gz)
42-
gzErr := gz.Close()
42+
closeErr := gz.Close()
4343
if err != nil {
4444
return nil, err
4545
}
46-
if gzErr != nil {
47-
return nil, err
46+
if closeErr != nil {
47+
return nil, closeErr
4848
}
4949

5050
return buf.Bytes(), nil

0 commit comments

Comments
 (0)