Compare commits
1 Commits
exegroup/v
...
mapset/v0.
| Author | SHA1 | Date | |
|---|---|---|---|
| d9e5a3371d |
138
mapset/.golangci.yaml
Normal file
138
mapset/.golangci.yaml
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
## 更新到 golangci-lint@v1.52.2
|
||||||
|
run:
|
||||||
|
timeout: 1m
|
||||||
|
build-tags: [ ]
|
||||||
|
skip-dirs: [ ]
|
||||||
|
skip-files: [ ]
|
||||||
|
linters:
|
||||||
|
disable-all: true
|
||||||
|
enable:
|
||||||
|
- errcheck
|
||||||
|
- gosimple
|
||||||
|
- govet
|
||||||
|
- ineffassign
|
||||||
|
- staticcheck
|
||||||
|
- typecheck
|
||||||
|
- unused
|
||||||
|
- asasalint
|
||||||
|
- asciicheck
|
||||||
|
- bidichk
|
||||||
|
- bodyclose
|
||||||
|
- containedctx
|
||||||
|
- cyclop
|
||||||
|
- dupl
|
||||||
|
- durationcheck
|
||||||
|
- errname
|
||||||
|
- errorlint
|
||||||
|
- exhaustive
|
||||||
|
- exportloopref
|
||||||
|
- funlen
|
||||||
|
- gocheckcompilerdirectives
|
||||||
|
- gochecknoinits
|
||||||
|
- goconst
|
||||||
|
- gocritic
|
||||||
|
- gocyclo
|
||||||
|
- goimports
|
||||||
|
- gomnd
|
||||||
|
- goprintffuncname
|
||||||
|
- gosec
|
||||||
|
- lll
|
||||||
|
- loggercheck
|
||||||
|
- makezero
|
||||||
|
- nakedret
|
||||||
|
- nestif
|
||||||
|
- nilnil
|
||||||
|
- noctx
|
||||||
|
- nolintlint
|
||||||
|
- nosprintfhostport
|
||||||
|
- prealloc
|
||||||
|
- predeclared
|
||||||
|
- promlinter
|
||||||
|
- reassign
|
||||||
|
- revive
|
||||||
|
- stylecheck
|
||||||
|
- tenv
|
||||||
|
- testableexamples
|
||||||
|
- testpackage
|
||||||
|
- tparallel
|
||||||
|
- unconvert
|
||||||
|
- unparam
|
||||||
|
- usestdlibvars
|
||||||
|
- wastedassign
|
||||||
|
- whitespace
|
||||||
|
linters-settings:
|
||||||
|
errcheck:
|
||||||
|
check-type-assertions: true
|
||||||
|
exclude-functions: [ ]
|
||||||
|
govet:
|
||||||
|
enable-all: true
|
||||||
|
disable: [ ]
|
||||||
|
cyclop:
|
||||||
|
max-complexity: 10
|
||||||
|
package-average: 0.0
|
||||||
|
dupl:
|
||||||
|
threshold: 150
|
||||||
|
exhaustive:
|
||||||
|
check:
|
||||||
|
- switch
|
||||||
|
- map
|
||||||
|
funlen:
|
||||||
|
lines: 100
|
||||||
|
statements: 60
|
||||||
|
gocritic:
|
||||||
|
disabled-checks:
|
||||||
|
- commentFormatting
|
||||||
|
settings:
|
||||||
|
captLocal:
|
||||||
|
paramsOnly: false
|
||||||
|
underef:
|
||||||
|
skipRecvDeref: false
|
||||||
|
gocyclo:
|
||||||
|
min-complexity: 20
|
||||||
|
gomnd:
|
||||||
|
ignored-functions:
|
||||||
|
- os.Chmod
|
||||||
|
- os.Mkdir
|
||||||
|
- os.MkdirAll
|
||||||
|
- os.OpenFile
|
||||||
|
- os.WriteFile
|
||||||
|
- prometheus.ExponentialBuckets
|
||||||
|
- prometheus.ExponentialBucketsRange
|
||||||
|
- prometheus.LinearBuckets
|
||||||
|
lll:
|
||||||
|
line-length: 240
|
||||||
|
nakedret:
|
||||||
|
max-func-lines: 10
|
||||||
|
nestif:
|
||||||
|
min-complexity: 5
|
||||||
|
predeclared:
|
||||||
|
ignore: ""
|
||||||
|
q: false
|
||||||
|
reassign:
|
||||||
|
patterns:
|
||||||
|
- ".*"
|
||||||
|
tenv:
|
||||||
|
all: true
|
||||||
|
usestdlibvars:
|
||||||
|
time-month: true
|
||||||
|
time-layout: true
|
||||||
|
crypto-hash: true
|
||||||
|
default-rpc-path: true
|
||||||
|
os-dev-null: true
|
||||||
|
sql-isolation-level: true
|
||||||
|
tls-signature-scheme: true
|
||||||
|
constant-kind: true
|
||||||
|
syslog-priority: true
|
||||||
|
issues:
|
||||||
|
max-same-issues: 10
|
||||||
|
exclude-rules:
|
||||||
|
- source: "//noinspection"
|
||||||
|
linters: [ gocritic ]
|
||||||
|
- path: "_test\\.go"
|
||||||
|
linters:
|
||||||
|
- bodyclose
|
||||||
|
- dupl
|
||||||
|
- funlen
|
||||||
|
- goconst
|
||||||
|
- gosec
|
||||||
|
- noctx
|
||||||
@@ -7,6 +7,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
maximumItemToPrint = 64
|
||||||
|
)
|
||||||
|
|
||||||
// New 返回 [MapSet]
|
// New 返回 [MapSet]
|
||||||
func New[T comparable](keys ...T) MapSet[T] {
|
func New[T comparable](keys ...T) MapSet[T] {
|
||||||
s := make(MapSet[T], len(keys))
|
s := make(MapSet[T], len(keys))
|
||||||
@@ -267,8 +271,8 @@ func (s *MapSet[T]) UnmarshalJSON(b []byte) error {
|
|||||||
|
|
||||||
func (s MapSet[T]) String() string {
|
func (s MapSet[T]) String() string {
|
||||||
size := s.Cardinality()
|
size := s.Cardinality()
|
||||||
if size > 64 {
|
if size > maximumItemToPrint {
|
||||||
size = 64
|
size = maximumItemToPrint
|
||||||
}
|
}
|
||||||
keys := make([]string, 0, size)
|
keys := make([]string, 0, size)
|
||||||
for key := range s {
|
for key := range s {
|
||||||
|
|||||||
Reference in New Issue
Block a user