diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..c42826c --- /dev/null +++ b/.golangci.yml @@ -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$ diff --git a/bin/.golangci-lint-1.64.8.pkg b/bin/.golangci-lint-2.5.0.pkg similarity index 100% rename from bin/.golangci-lint-1.64.8.pkg rename to bin/.golangci-lint-2.5.0.pkg diff --git a/bin/golangci-lint b/bin/golangci-lint index ffc9dae..6125330 120000 --- a/bin/golangci-lint +++ b/bin/golangci-lint @@ -1 +1 @@ -.golangci-lint-1.64.8.pkg \ No newline at end of file +.golangci-lint-2.5.0.pkg \ No newline at end of file diff --git a/repr.go b/repr.go index 919c3df..dafa0ac 100644 --- a/repr.go +++ b/repr.go @@ -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. @@ -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 } @@ -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() @@ -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 {