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
With the http-status-code configured as false for usestdlibvars, it should not report errors for use of numeric literals such as 200. But with the latest version of golangci-lint, the error is still being reported. If I run the linter directly, it behaves as expected:
$ usestdlibvars -http-status-code=false ./...<succeeds without any output>
$ usestdlibvars ./.../.../tusestdlibvars/main.go:15:24: "200" can be replaced by http.StatusOK
Version of golangci-lint
$ golangci-lint --versiongolangci-lint has version 1.52.2 built with go1.20.2 from da04413 on 2023-03-23T16:18:48Z
Configuration file
$ cat .golangci.toml[linters] disable-all = true enable = ["usestdlibvars"][linters-settings] [linters-settings.usestdlibvars] # Suggest the use of http.StatusXX. # covered by stylecheck ST1013. # Default: true http-status-code = false
Go environment
$ go version && go envgo version go1.20.3 darwin/arm64GO111MODULE=""GOARCH="arm64"GOBIN=""GOCACHE="/Users/skaranth/Library/Caches/go-build"GOENV="/Users/skaranth/Library/Application Support/go/env"GOEXE=""GOEXPERIMENT=""GOFLAGS=""GOHOSTARCH="arm64"GOHOSTOS="darwin"GOINSECURE=""GOMODCACHE="/Users/skaranth/dev/work/go/pkg/mod"GONOPROXY="_REDACTED_"GONOSUMDB="_REDACTED_"GOOS="darwin"GOPATH="/Users/skaranth/dev/work/go"GOPRIVATE="_REDACTED_"GOPROXY="https://proxy.golang.org,direct"GOROOT="/opt/homebrew/Cellar/go/1.20.3/libexec"GOSUMDB="sum.golang.org"GOTMPDIR=""GOTOOLDIR="/opt/homebrew/Cellar/go/1.20.3/libexec/pkg/tool/darwin_arm64"GOVCS=""GOVERSION="go1.20.3"GCCGO="gccgo"AR="ar"CC="cc"CXX="c++"CGO_ENABLED="1"GOMOD="/.../tusestdlibvars/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 arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/zp/01m9f4ld29l4crxjfhhpnxxw0000gn/T/go-build112225028=/tmp/go-build -gno-record-gcc-switches -fno-common"
Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -vINFO [config_reader] Config search paths: [./ /.../tusestdlibvars _REDACTED_ /Users /]INFO [config_reader] Used config file .golangci.tomlINFO [lintersdb] Active 1 linters: [usestdlibvars]INFO [loader] Go packages loading at mode 7 (compiled_files|files|name) took 145.543792msINFO [runner/filename_unadjuster] Pre-built 0 adjustments in 1.47575msINFO [linters_context/goanalysis] analyzers took 50.583µs with top 10 stages: inspect: 43.125µs, usestdlibvars: 7.458µsINFO [runner] Processors filtering stat (out/in): max_same_issues: 1/1, path_shortener: 1/1, severity-rules: 1/1, cgo: 1/1, skip_files: 1/1, identifier_marker: 1/1, filename_unadjuster: 1/1, autogenerated_exclude: 1/1, sort_results: 1/1, max_from_linter: 1/1, source_code: 1/1, path_prettifier: 1/1, skip_dirs: 1/1, uniq_by_line: 1/1, diff: 1/1, max_per_file_from_linter: 1/1, fixer: 1/1, path_prefixer: 1/1, exclude: 1/1, exclude-rules: 1/1, nolint: 1/1INFO [runner] processing took 112.709µs with stages: nolint: 30.75µs, path_prettifier: 21.375µs, autogenerated_exclude: 15.833µs, identifier_marker: 14.542µs, exclude-rules: 12.291µs, source_code: 10.459µs, skip_dirs: 3.167µs, max_same_issues: 834ns, cgo: 626ns, uniq_by_line: 583ns, path_shortener: 375ns, max_from_linter: 292ns, filename_unadjuster: 291ns, severity-rules: 250ns, max_per_file_from_linter: 249ns, skip_files: 209ns, diff: 208ns, exclude: 166ns, sort_results: 84ns, fixer: 83ns, path_prefixer: 42nsINFO [runner] linters took 14.903583ms with stages: usestdlibvars: 14.753333msmain.go:15:24: "200" can be replaced by http.StatusOK (usestdlibvars) if resp.StatusCode != 200 { ^INFO File cache stats: 1 entries of total size 269BINFO Memory: 3 samples, avg is 27.2MB, max is 27.4MBINFO Execution took 168.664208ms
Welcome
Description of the problem
With the
http-status-code
configured asfalse
forusestdlibvars
, it should not report errors for use of numeric literals such as200
. But with the latest version ofgolangci-lint
, the error is still being reported. If I run the linter directly, it behaves as expected:Version of golangci-lint
Configuration file
Go environment
Verbose output of running
Code example or link to a public repository
The text was updated successfully, but these errors were encountered: