Skip to content

Commit 90919d9

Browse files
committed
Relint
* updated linter config * fixed linting issues: * wrapped errors * used explicitly named constants instead of "magic numbers" * used more recent stdlib API to replace bson time conversions Signed-off-by: Frederic BIDON <[email protected]>
1 parent 0cede8a commit 90919d9

File tree

11 files changed

+121
-99
lines changed

11 files changed

+121
-99
lines changed

.golangci.yml

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
linters-settings:
2-
govet:
3-
check-shadowing: true
4-
golint:
5-
min-confidence: 0
62
gocyclo:
73
min-complexity: 45
8-
maligned:
9-
suggest-new: true
104
dupl:
115
threshold: 200
126
goconst:
@@ -16,7 +10,7 @@ linters-settings:
1610
linters:
1711
enable-all: true
1812
disable:
19-
- maligned
13+
- recvcheck
2014
- unparam
2115
- lll
2216
- gochecknoinits
@@ -29,17 +23,13 @@ linters:
2923
- wrapcheck
3024
- testpackage
3125
- nlreturn
32-
- gomnd
33-
- exhaustivestruct
34-
- goerr113
3526
- errorlint
3627
- nestif
3728
- godot
3829
- gofumpt
3930
- paralleltest
4031
- tparallel
4132
- thelper
42-
- ifshort
4333
- exhaustruct
4434
- varnamelen
4535
- gci
@@ -52,10 +42,15 @@ linters:
5242
- forcetypeassert
5343
- cyclop
5444
# deprecated linters
55-
- deadcode
56-
- interfacer
57-
- scopelint
58-
- varcheck
59-
- structcheck
60-
- golint
61-
- nosnakecase
45+
#- deadcode
46+
#- interfacer
47+
#- scopelint
48+
#- varcheck
49+
#- structcheck
50+
#- golint
51+
#- nosnakecase
52+
#- maligned
53+
#- goerr113
54+
#- ifshort
55+
#- gomnd
56+
#- exhaustivestruct

bson.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func (id *ObjectId) Scan(raw interface{}) error {
8383
case string:
8484
data = []byte(v)
8585
default:
86-
return fmt.Errorf("cannot sql.Scan() strfmt.URI from: %#v", v)
86+
return fmt.Errorf("cannot sql.Scan() strfmt.URI from: %#v: %w", v, ErrFormat)
8787
}
8888

8989
return id.UnmarshalText(data)

date.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package strfmt
1717
import (
1818
"database/sql/driver"
1919
"encoding/json"
20-
"errors"
2120
"fmt"
2221
"time"
2322

@@ -84,7 +83,7 @@ func (d *Date) Scan(raw interface{}) error {
8483
*d = Date{}
8584
return nil
8685
default:
87-
return fmt.Errorf("cannot sql.Scan() strfmt.Date from: %#v", v)
86+
return fmt.Errorf("cannot sql.Scan() strfmt.Date from: %#v: %w", v, ErrFormat)
8887
}
8988
}
9089

@@ -134,7 +133,7 @@ func (d *Date) UnmarshalBSON(data []byte) error {
134133
return nil
135134
}
136135

137-
return errors.New("couldn't unmarshal bson bytes value as Date")
136+
return fmt.Errorf("couldn't unmarshal bson bytes value as Date: %w", ErrFormat)
138137
}
139138

140139
// DeepCopyInto copies the receiver and writes its value into out.

0 commit comments

Comments
 (0)