You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Autogenerated files from swagger-codegen are not ignored by golangci-lint.
Really, this is something that should be fixed on the swagger-codegen side (and there is an open bug here), because it does not include the standard ^// Code generated .* DO NOT EDIT\.$ pattern.
# There is no need to include all autogenerated files,
# we confidently recognize autogenerated files.
# If it's not, please let us know.
So I thought I'd report it anyway.
I also tried setting exclude-generated: lax, but this does not exclude these files either.
You could add an ignore pattern for Generated by: Swagger Codegen to catch these files.
Version of golangci-lint
$ golangci-lint --versionv1.59.1
Configuration
# paste configuration file or CLI flags here
Go environment
$ go version && go envgo version && go envgo version go1.22.1 darwin/amd64GO111MODULE='on'GOARCH='amd64'GOBIN=''GOCACHE='/Users/user/Library/Caches/go-build'GOENV='/Users/user/Library/Application Support/go/env'GOEXE=''GOEXPERIMENT=''GOFLAGS=''GOHOSTARCH='amd64'GOHOSTOS='darwin'GOINSECURE=''GOMODCACHE='/Users/user/go/pkg/mod'GONOPROXY='gitlab.com/foo/*,github.com/foo/*'GONOSUMDB='gitlab.com/foo/*,github.com/foo/*'GOOS='darwin'GOPATH='/Users/user/go'GOPRIVATE='gitlab.com/foo/*,github.com/foo/*'GOPROXY='https://proxy.golang.org,direct'GOROOT='/usr/local/go'GOSUMDB='sum.golang.org'GOTMPDIR=''GOTOOLCHAIN='auto'GOTOOLDIR='/usr/local/go/pkg/tool/darwin_amd64'GOVCS=''GOVERSION='go1.22.1'GCCGO='gccgo'GOAMD64='v1'AR='ar'CC='clang'CXX='clang++'CGO_ENABLED='1'GOMOD='/Users/user/go/src/github.com/foo/bar/src/baz/go.mod'GOWORK=''CGO_CFLAGS='-O2 -g'CGO_CPPFLAGS=''CGO_CXXFLAGS='-O2 -g'CGO_FFLAGS='-O2 -g'CGO_LDFLAGS='-O2 -g'PKG_CONFIG='pkg-config'GOGCCFLAGS='-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/z4/tjbsqpbj5pz3_mh9jzb4vhxw0000gn/T/go-build336395111=/tmp/go-build -gno-record-gcc-switches -fno-common'
Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -v
# paste output here
A minimal reproducible example or link to a public repository
Generate swagger files using swagger-codegen (docker example for portability):
docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli generate \
-i https://petstore.swagger.io/v2/swagger.json \
-l go \
-o /local/out/go
Run golangci-lint against those files. It'll probably fail against things like revive for missing exported var comments, lll for being too long, etc.
Validation
Yes, I've included all information above (version, config, etc.).
Welcome
typecheck
section of the FAQ.Description of the problem
Autogenerated files from
swagger-codegen
are not ignored by golangci-lint.Really, this is something that should be fixed on the swagger-codegen side (and there is an open bug here), because it does not include the standard
^// Code generated .* DO NOT EDIT\.$
pattern.The golangci-lint configuration docs say:
So I thought I'd report it anyway.
I also tried setting
exclude-generated: lax
, but this does not exclude these files either.You could add an ignore pattern for
Generated by: Swagger Codegen
to catch these files.Version of golangci-lint
Configuration
# paste configuration file or CLI flags here
Go environment
Verbose output of running
A minimal reproducible example or link to a public repository
Generate swagger files using swagger-codegen (docker example for portability):
Run golangci-lint against those files. It'll probably fail against things like
revive
for missing exported var comments,lll
for being too long, etc.Validation
Supporter
The text was updated successfully, but these errors were encountered: