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

Stylecheck's ST1000 is not enabled (or no way to enable it) #980

Closed
3 tasks done
benjaminjkraft opened this issue Mar 3, 2020 · 5 comments
Closed
3 tasks done

Stylecheck's ST1000 is not enabled (or no way to enable it) #980

benjaminjkraft opened this issue Mar 3, 2020 · 5 comments
Labels
question Further information is requested

Comments

@benjaminjkraft
Copy link

benjaminjkraft commented Mar 3, 2020

It seems like golangci-lint does not run stylecheck's ST1000 (which complains about missing or malformed package comments) even if stylecheck is enabled. Stylecheck disables it by default; it's not clear to me if golangci-lint intends to do so as well, but if so it has no way to enable it.

For example, run golangci-lint on its own codebase, which enables stylecheck. (Say on ./pkg/commands, which has no package doc.) No errors are reported. (Same applies to a package doc that doesn't start "Package packagename ...".)

Is it possible to enable this, either by default or in configuration?

  • 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).

Please include the following information:

Version of golangci-lint
$ golangci-lint --version
golangci-lint has version 1.23.7 built from 96964db on 2020-02-28T12:07:44Z
Config file

(running on golangci/golangci-lint itself)

Go environment
$ go version && go env
go version go1.13.5 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/benkraft/.cache/go-build"
GOENV="/home/benkraft/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/benkraft/.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"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/benkraft/src/golangci-lint/go.mod"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build202635661=/tmp/go-build -gno-record-gcc-switches"
Verbose output of running
$ golangci-lint run -v ./pkg/commands/
INFO [config_reader] Config search paths: [./ /home/benkraft/src/golangci-lint/pkg/commands /home/benkraft/src/golangci-lint/pkg /home/benkraft/src/golangci-l
int /home/benkraft/src /home/benkraft /home /] 
INFO [config_reader] Used config file .golangci.yml 
INFO [lintersdb] Active 35 linters: [bodyclose deadcode depguard dogsled dupl errcheck funlen gochecknoinits goconst gocritic gocyclo gofmt goimports golint g
omnd goprintffuncname gosec gosimple govet ineffassign interfacer lll misspell nakedret rowserrcheck scopelint staticcheck structcheck stylecheck typecheck un
convert unparam unused varcheck whitespace] 
INFO [lintersdb] Active 35 linters: [bodyclose deadcode depguard dogsled dupl errcheck funlen gochecknoinits goconst gocritic gocyclo gofmt goimports golint g
omnd goprintffuncname gosec gosimple govet ineffassign interfacer lll misspell nakedret rowserrcheck scopelint staticcheck structcheck stylecheck typecheck un
convert unparam unused varcheck whitespace] 
INFO [loader] Go packages loading at mode 575 (compiled_files|types_sizes|deps|exports_file|files|imports|name) took 248.976387ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 2.59017ms 
INFO [runner/goanalysis_metalinter/goanalysis] analyzers took 11.826866399s with top 10 stages: buildssa: 9.302634707s, inspect: 624.028215ms, ctrlflow: 435.0
53726ms, fact_deprecated: 414.82956ms, printf: 362.323826ms, fact_purity: 340.985916ms, goimports: 33.559718ms, dupl: 32.319154ms, gocritic: 30.578649ms, gose
c: 28.351244ms 
INFO [runner/unused/goanalysis] analyzers took 18.583548ms with top 10 stages: buildssa: 14.658602ms, U1000: 3.924946ms 
INFO [runner] Issues before processing: 30, after processing: 0 
INFO [runner] Processors filtering stat (out/in): filename_unadjuster: 30/30, skip_files: 30/30, skip_dirs: 30/30, path_prettifier: 30/30, identifier_marker: 
30/30, exclude-rules: 2/2, cgo: 30/30, autogenerated_exclude: 30/30, exclude: 2/30, nolint: 0/2 
INFO [runner] processing took 2.547733ms with stages: nolint: 1.200208ms, exclude: 651.102µs, identifier_marker: 468.268µs, path_prettifier: 152.868µs, autoge
nerated_exclude: 57.939µs, skip_dirs: 8.244µs, cgo: 3.674µs, filename_unadjuster: 2.331µs, exclude-rules: 933ns, max_same_issues: 710ns, uniq_by_line: 314ns, 
max_from_linter: 253ns, diff: 239ns, skip_files: 191ns, path_shortener: 165ns, source_code: 164ns, max_per_file_from_linter: 130ns 
INFO [runner] linters took 2.945401154s with stages: goanalysis_metalinter: 2.7176486s, unused: 225.147624ms 
INFO File cache stats: 9 entries of total size 36.0KiB 
INFO Memory: 34 samples, avg is 330.0MB, max is 474.1MB 
INFO Execution took 3.201593403s
@sagikazarmark
Copy link

I believe the staticcheck version is relatively old: https://github.com/golangci/golangci-lint/blob/master/go.mod#L49

@ernado
Copy link
Member

ernado commented Mar 15, 2020

Seems like after update staticcheck to v2020.1.3 this should be fixed, please check.

@benjaminjkraft
Copy link
Author

benjaminjkraft commented Mar 18, 2020

This does not appear fixed to me. Perhaps I'm doing something wrong, but checking out golangci-lint master, then running in the repo root:

make build
./golangci-lint cache clean
./golangci-lint run ./pkg/commands

reports no errors, but

go doc ./pkg/commands

shows no godoc (nor does inspecting the source). Additionally, I still see no option to explicitly enable ST1000 (if it's intentionally disabled by default).

@csilvers
Copy link
Contributor

It looks like staticcheck-in-the-context-of-golangci-lint reads the staticcheck.conf file, so it might work to just make one of those. It's not great to have two config files (.golangci.yml and staticcheck.conf) but it's better than nothing.

@hebime
Copy link

hebime commented Feb 10, 2021

I ran into this recently. What fixed it for me (and I suspect that this option was added in a newer release) was adding the following to my .golangci.yml:

issues:
  include:
    - EXC0011

@ldez ldez added the stale No recent correspondence or work activity label Mar 25, 2021
@ldez ldez closed this as completed May 27, 2021
@ldez ldez added question Further information is requested and removed stale No recent correspondence or work activity labels May 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

6 participants