Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 118 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
version: "2"
run:
tests: true
output:
show-stats: false
formats:
text:
print-issued-lines: false
colors: true
linters:
default: all
disable:
- cyclop
- depguard
- dupword
- err113
- errname
- errorlint
- exhaustruct
- forbidigo
- forcetypeassert
- funlen
- gochecknoglobals
- gocognit
- gocritic
- gocyclo
- godot
- godox
- gomoddirectives
- ireturn
- lll
- maintidx
- mnd
- nakedret
- nestif
- nilnil
- nlreturn
- nolintlint
- nonamedreturns
- paralleltest
- perfsprint
- predeclared
- recvcheck
- revive
- testpackage
- varnamelen
- wastedassign
- whitespace
- wsl
- wsl_v5
- funcorder
- noinlineerr
- tagalign
- goconst
- gochecknoinits
- durationcheck
- embeddedstructfieldcheck
- copyloopvar
- intrange
settings:
dupl:
threshold: 100
exhaustive:
default-signifies-exhaustive: true
goconst:
min-len: 8
min-occurrences: 3
gocyclo:
min-complexity: 10
wrapcheck:
report-internal-errors: false
ignore-package-globs:
- github.com/alecthomas/errors
exclusions:
generated: lax
rules:
- path: (.+)\.go$
text: "^(G104|G204|G307|G304):"
- path: (.+)\.go$
text: Error return value of .(.*\.Help|.*\.MarkFlagRequired|(os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked
- path: (.+)\.go$
text: exported method `(.*\.MarshalJSON|.*\.UnmarshalJSON|.*\.EntityURN|.*\.GoString|.*\.Pos)` should have comment or be unexported
- path: (.+)\.go$
text: uses unkeyed fields
- path: (.+)\.go$
text: declaration of "err" shadows declaration
- path: (.+)\.go$
text: bad syntax for struct tag key
- path: (.+)\.go$
text: bad syntax for struct tag pair
- path: (.+)\.go$
text: ^ST1012
- path: (.+)\.go$
text: log/slog.Logger.*must not be called
- path: (.+)_test\.go$
text: error returned from external package is unwrapped
- linters: [staticcheck]
text: QF1008
- text: "Error return value of `.*.Write` is not checked"
linters: [errcheck]
path: (.+)_test\.go$
paths:
- third_party$
- builtin$
- examples$
issues:
max-issues-per-linter: 0
max-same-issues: 0
formatters:
enable:
- gofmt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
File renamed without changes.
2 changes: 1 addition & 1 deletion bin/golangci-lint
8 changes: 5 additions & 3 deletions repr.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (p *Printer) Println(vs ...any) {
}
p.reprValue(map[reflect.Value]bool{}, reflect.ValueOf(v), "", true, false)
}
fmt.Fprintln(p.w)
_, _ = fmt.Fprintln(p.w)
}

// showType is true if struct types should be shown. isAnyValue is true if the containing value is an "any" type.
Expand All @@ -209,7 +209,7 @@ func (p *Printer) reprValue(seen map[reflect.Value]bool, v reflect.Value, indent

// If we can't access a private field directly with reflection, try and do so via unsafe.
if !v.CanInterface() && v.CanAddr() {
uv := reflect.NewAt(t, unsafe.Pointer(v.UnsafeAddr())).Elem()
uv := reflect.NewAt(t, unsafe.Pointer(v.UnsafeAddr())).Elem() //nolint
if uv.CanInterface() {
v = uv
}
Expand Down Expand Up @@ -438,7 +438,7 @@ func timeToGo(w io.Writer, t time.Time) {
zone = "nil"
case time.UTC:
zone = "time.UTC"
case time.Local:
case time.Local: //nolint
zone = "time.Local"
default:
n, off := t.Zone()
Expand Down Expand Up @@ -476,6 +476,8 @@ func substAny(t reflect.Type) string {
return "func" + t.Name() + "(" + strings.Join(in, ", ") + ")"
}
return "func" + t.Name() + "(" + strings.Join(in, ", ") + ") (" + strings.Join(out, ", ") + ")"

default:
}

if t == anyType {
Expand Down