Closed
Description
Welcome
- Yes, I'm using a binary release within 2 latest releases. Only such installations are supported.
- Yes, I've searched similar issues on GitHub and didn't find any.
- Yes, I've read the
typecheck
section of the FAQ. - Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.).
- I agree to follow this project's Code of Conduct
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:
# 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 --version
v1.59.1
Configuration
# paste configuration file or CLI flags here
Go environment
$ go version && go env
go version && go env
go version go1.22.1 darwin/amd64
GO111MODULE='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.).
Supporter
- I am a sponsor/backer through GitHub or OpenCollective