diff --git a/.golangci.yaml b/.golangci.yaml index 50b02eb..0315043 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -1,52 +1,66 @@ -# See https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml +version: "2" run: tests: true - -linters-settings: - errcheck: - check-type-assertions: true - check-blank: true - gocyclo: - min-complexity: 20 - dupl: - threshold: 100 - misspell: - locale: US - unused: - check-exported: false - unparam: - check-exported: true - linters: - enable-all: true + default: all disable: - depguard + - exhaustive - exhaustruct - - exportloopref - forbidigo - forcetypeassert - - gci + - funcorder - gochecknoglobals - ireturn - lll - mnd + - noinlineerr + - nolintlint - nonamedreturns - - nolintlint # https://github.com/golangci/golangci-lint/issues/3063 - paralleltest - tagliatelle - testpackage - varnamelen - wrapcheck - + - wsl + settings: + dupl: + threshold: 100 + errcheck: + check-type-assertions: true + check-blank: true + gocyclo: + min-complexity: 20 + misspell: + locale: US + exclusions: + generated: lax + rules: + - linters: + - dupl + - err113 + - funlen + - goconst + - mnd + - noctx + path: _test.go + - linters: + - revive + path: examples/ + paths: + - third_party$ + - builtin$ + - examples$ issues: max-same-issues: 20 - exclude-use-default: false - exclude-rules: - - linters: - - dupl - - funlen - - goconst - - goerr113 - - gomnd - - noctx - path: "_test.go" +formatters: + enable: + - gofmt + - gofumpt + - goimports + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/Makefile b/Makefile index f237e5d..6091da4 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ MODULE_NAME=python VENDOR_DIR = vendor PYTHON_VERSION ?= 3.11 -GOLANGCI_LINT_VERSION ?= v1.63.4 +GOLANGCI_LINT_VERSION ?= v2.2.1 GO ?= go GOLANGCI_LINT ?= $(shell go env GOPATH)/bin/golangci-lint-$(GOLANGCI_LINT_VERSION) diff --git a/go.mod b/go.mod index d61aa4b..abad3f0 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,9 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/kr/pretty v0.2.1 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/rogpeppe/go-internal v1.9.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 82e6291..fe85d50 100644 --- a/go.sum +++ b/go.sum @@ -1,13 +1,19 @@ +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= go.nhat.io/cpy/v3 v3.11.2 h1:6+9rz9UAMg2j3ryZ/r7m9KMTDua88uJcBjU+lHzJ+Jg= diff --git a/marshal.go b/marshal.go index 89d86e2..5b1987e 100644 --- a/marshal.go +++ b/marshal.go @@ -89,7 +89,7 @@ func Marshal(v any) (*Object, error) { //nolint: cyclop,funlen,gocyclo return marshalSlice(rv), nil } - return nil, fmt.Errorf("cannot marshal value of %T to python object", v) //nolint: goerr113 + return nil, fmt.Errorf("cannot marshal value of %T to python object", v) //nolint: err113 } // MustMarshal returns the Python object for v or panics if an error occurs.