Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interfacebloat: configuration not applied #3193

Closed
4 tasks done
outcatcher opened this issue Sep 5, 2022 · 1 comment · Fixed by #3194
Closed
4 tasks done

interfacebloat: configuration not applied #3193

outcatcher opened this issue Sep 5, 2022 · 1 comment · Fixed by #3194
Labels
bug Something isn't working

Comments

@outcatcher
Copy link
Contributor

Welcome

  • Yes, I'm using a binary release within 2 latest major releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).
  • Yes, I've tried with the standalone linter if available. (https://golangci-lint.run/usage/linters/)

Description of the problem

When configuring max configuration value for interfacebloat linter, nothing changes.

The culprit seems to be incorrect configuration handling in NewInterfaceBloat, configuration is not passed:

	return goanalysis.NewLinter(
		a.Name,
		a.Doc,
		[]*analysis.Analyzer{a},
		nil,
	).WithLoadMode(goanalysis.LoadModeSyntax)

Changing it to the following fixes the problem:

	return goanalysis.NewLinter(
		a.Name,
		a.Doc,
		[]*analysis.Analyzer{a},
		cfgMap,
	).WithLoadMode(goanalysis.LoadModeSyntax)

Version of golangci-lint

golangci-lint has version 1.49.0 built from cc2d97f3 on 2022-08-24T10:24:37Z

Configuration file

linters:
  enable:
    - interfacebloat

linters-settings:
  interfacebloat:
    max: 1

Go environment

$ go version && go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/akachurin/.cache/go-build"
GOENV="/home/akachurin/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/akachurin/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/akachurin/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/snap/go/current"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/snap/go/current/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19"
GCCGO="/usr/bin/gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/akachurin/GolandProjects/awesomeProject/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-build810072952=/tmp/go-build -gno-record-gcc-switches"

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /home/akachurin/GolandProjects/awesomeProject /home/akachurin/GolandProjects /home/akachurin /home /] 
INFO [config_reader] Used config file .golangci.yml 
INFO [lintersdb] Active 8 linters: [errcheck gosimple govet ineffassign interfacebloat staticcheck typecheck unused] 
INFO [loader] Go packages loading at mode 575 (files|imports|compiled_files|exports_file|types_sizes|deps|name) took 5.275142ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 57.575µs 
INFO [linters context/goanalysis] analyzers took 4.805985ms with top 10 stages: printf: 226.904µs, fact_deprecated: 199.072µs, buildir: 152.661µs, ctrlflow: 116.967µs, atomic: 114.7µs, typedness: 110.951µs, sigchanyzer: 100.285µs, fact_purity: 95.948µs, S1004: 93.358µs, loopclosure: 75.59µs 
INFO [runner] processing took 1.837µs with stages: max_same_issues: 337ns, skip_dirs: 175ns, max_from_linter: 169ns, nolint: 163ns, filename_unadjuster: 138ns, skip_files: 130ns, cgo: 94ns, exclude: 90ns, path_prettifier: 88ns, autogenerated_exclude: 84ns, uniq_by_line: 82ns, exclude-rules: 35ns, source_code: 34ns, path_shortener: 33ns, sort_results: 33ns, diff: 32ns, identifier_marker: 31ns, severity-rules: 30ns, max_per_file_from_linter: 30ns, path_prefixer: 29ns 
INFO [runner] linters took 2.766386ms with stages: goanalysis_metalinter: 2.744519ms 
INFO File cache stats: 0 entries of total size 0B 
INFO Memory: 2 samples, avg is 35.5MB, max is 37.9MB 
INFO Execution took 10.660817ms 

Code example or link to a public repository

package example

type BiggerOne interface { // interfacebloat max is set to 1
	i1()
	i2()
	i3()
}
@outcatcher outcatcher added the bug Something isn't working label Sep 5, 2022
@boring-cyborg
Copy link

boring-cyborg bot commented Sep 5, 2022

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant