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
In v1.4.0 forbidigo added the ability to analyze import types and match regardless of the aliased import name, however this requires a new config flag to be set to true: analyze_types.
forbidigo was updated to 1.4.0 in golangci-lint v1.51.2, but the required flag does not appear to be supported.
Can we add that flag?
Expected output:
main.go:8:2: use of `log.Warn` forbidden because "do not use logrus, instead use slog" (forbidigo) log.Warn("Hello")main.go:8:11: use of `log.Entry.Info` forbidden because "do not use logrus, instead use slog" (forbidigo) }).Info("A walrus appears")
Version of golangci-lint
$ golangci-lint --versiongolangci-lint has version v1.52.2 built with go1.19.8 from (unknown, mod sum: "h1:FrPElUUI5rrHXg1mQ7KxI1MXPAw5lBVskiz7U7a8a1A=") on (unknown)
Configuration file
$ cat .golangci.yml---linters: disable-all: true enable: - forbidigolinters-settings: forbidigo: analyze-types: true forbid: - '{p: "^logrus\\.(Debug|Error|Fatal|Info|Panic|Print|Println|Trace|Warn|Warning)f?$", msg: "do not use logrus, instead use slog"}' - '{p: "^\\*?logrus.Entry\\.(Debug|Error|Fatal|Info|Panic|Print|Println|Trace|Warn|Warning)f?$", msg: "do not use logrus, instead use slog"}'
Go environment
$ go version && go envgo version go1.19.8 linux/amd64GO111MODULE=""GOARCH="amd64"GOBIN=""GOCACHE="/root/.cache/go-build"GOENV="/root/.config/go/env"GOEXE=""GOEXPERIMENT=""GOFLAGS=""GOHOSTARCH="amd64"GOHOSTOS="linux"GOINSECURE=""GOMODCACHE="/go/pkg/mod"GONOPROXY=""GONOSUMDB=""GOOS="linux"GOPATH="/go"GOPRIVATE=""GOPROXY="https://proxy.golang.org,direct"GOROOT="/usr/local/go"GOSUMDB="sum.golang.org"GOTMPDIR=""GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"GOVCS=""GOVERSION="go1.19.8"GCCGO="gccgo"GOAMD64="v1"AR="ar"CC="gcc"CXX="g++"CGO_ENABLED="1"GOMOD="/go/src/github.com/<Company>/<repo>/go.mod"GOWORK=""CGO_CFLAGS="-g -O2"CGO_CPPFLAGS=""CGO_CXXFLAGS="-g -O2"CGO_FFLAGS="-g -O2"CGO_LDFLAGS="-g -O2"PKG_CONFIG="pkg-config"GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1372520807=/tmp/go-build -gno-record-gcc-switches"
Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -vINFO [config_reader] Config search paths: [./ /go/src/github.com/<Company>/<repo> /go/src/github.com/<Company> /go/src/github.com /go/src /go / /root] INFO [config_reader] Used config file .golangci.yml INFO [lintersdb] Active 1 linters: [forbidigo] INFO [loader] Go packages loading at mode 575 (compiled_files|name|types_sizes|deps|exports_file|files|imports) took 20.89445497s INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 20.132798ms INFO [linters_context/goanalysis] analyzers took 18.042039ms with top 10 stages: forbidigo: 18.042039ms WARN [runner] Can't run linter forbidigo: forbidigo: failed to create linter "forbidigo": parsing as JSON or YAML failed: yaml: unmarshal errors: line 1: field pkg not found in type forbidigo.pattern INFO [runner] processing took 2.031µs with stages: max_same_issues: 400ns, skip_dirs: 268ns, nolint: 203ns, filename_unadjuster: 124ns, cgo: 118ns, autogenerated_exclude: 93ns, exclude-rules: 92ns, fixer: 92ns, skip_files: 91ns, identifier_marker: 90ns, path_prettifier: 89ns, path_prefixer: 84ns, max_from_linter: 58ns, sort_results: 31ns, diff: 31ns, path_shortener: 31ns, source_code: 30ns, exclude: 27ns, max_per_file_from_linter: 27ns, severity-rules: 26ns, uniq_by_line: 26ns INFO [runner] linters took 175.963204ms with stages: forbidigo: 175.941496ms ERRO Running error: 1 error occurred: * can't run linter forbidigo: forbidigo: failed to create linter "forbidigo": parsing as JSON or YAML failed: yaml: unmarshal errors: line 1: field pkg not found in type forbidigo.patternINFO Memory: 212 samples, avg is 33.8MB, max is 168.6MB INFO Execution took 21.096143903s
Welcome
Description of the problem
In v1.4.0 forbidigo added the ability to analyze import types and match regardless of the aliased import name, however this requires a new config flag to be set to true: analyze_types.
forbidigo was updated to 1.4.0 in golangci-lint v1.51.2, but the required flag does not appear to be supported.
Can we add that flag?
Expected output:
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: