Golangci-lint: Can't enable certain linters

Created on 2 Oct 2019  路  6Comments  路  Source: golangci/golangci-lint

I can't enable certain linters, for example staticcheck. Doesn't matter how I try to enable it (CLI argument, enable-all, enable, ...), it never shows up in the golangci-lint linters. What am I doing wrong?

Version: v1.19.1
Config:

linters:
    enable-all: true
    disable:
        - stylecheck
        - gofmt
        - depguard
        - dogsled
        - godox

Env:

go version go1.13 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/grongor/.cache/go-build"
GOENV="/home/grongor/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/grongor/projects/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/grongor/projects/flop/storm/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-build428867034=/tmp/go-build -gno-record-gcc-switches"

Output:

$ bin/golangci-lint linters -v                                    
INFO [config_reader] Config search paths: [./ /home/grongor/projects/flop/storm /home/grongor/projects/flop /home/grongor/projects /home/grongor /home /] 
INFO [config_reader] Used config file .golangci.yaml 
INFO [lintersdb] Active 31 linters: [bodyclose deadcode dupl errcheck funlen gochecknoglobals gochecknoinits goconst gocritic gocyclo goimports golint gosec gosimple govet ineffassign interfacer lll maligned misspell nakedret prealloc scopelint staticcheck structcheck typecheck unconvert unparam unused varcheck whitespace] 
Enabled by your configuration linters:
deadcode: Finds unused code [fast: true, auto-fix: false]
dupl: Tool for code clone detection [fast: true, auto-fix: false]
errcheck: Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases [fast: true, auto-fix: false]
funlen: Tool for detection of long functions [fast: true, auto-fix: false]
goanalysis_metalinter:  [fast: false, auto-fix: false]
gochecknoglobals: Checks that no globals are present in Go code [fast: true, auto-fix: false]
gochecknoinits: Checks that no init functions are present in Go code [fast: true, auto-fix: false]
goconst: Finds repeated strings that could be replaced by a constant [fast: true, auto-fix: false]
gocritic: The most opinionated Go source code linter [fast: true, auto-fix: false]
gocyclo: Computes and checks the cyclomatic complexity of functions [fast: true, auto-fix: false]
goimports: Goimports does everything that gofmt does. Additionally it checks unused imports [fast: true, auto-fix: true]
golint: Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes [fast: true, auto-fix: false]
gosec (gas): Inspects source code for security problems [fast: true, auto-fix: false]
ineffassign: Detects when assignments to existing variables are not used [fast: true, auto-fix: false]
interfacer: Linter that suggests narrower interface types [fast: false, auto-fix: false]
lll: Reports long lines [fast: true, auto-fix: false]
maligned: Tool to detect Go structs that would take less memory if their fields were sorted [fast: true, auto-fix: false]
misspell: Finds commonly misspelled English words in comments [fast: true, auto-fix: true]
nakedret: Finds naked returns in functions greater than a specified function length [fast: true, auto-fix: false]
prealloc: Finds slice declarations that could potentially be preallocated [fast: true, auto-fix: false]
scopelint: Scopelint checks for unpinned variables in go programs [fast: true, auto-fix: false]
structcheck: Finds unused struct fields [fast: true, auto-fix: false]
typecheck: Like the front-end of a Go compiler, parses and type-checks Go code [fast: true, auto-fix: false]
unconvert: Remove unnecessary type conversions [fast: true, auto-fix: false]
unparam: Reports unused function parameters [fast: false, auto-fix: false]
unused: Checks Go code for unused constants, variables, functions and types [fast: false, auto-fix: false]
varcheck: Finds unused global variables and constants [fast: true, auto-fix: false]
whitespace: Tool for detection of leading and trailing whitespace [fast: true, auto-fix: true]

Disabled by your configuration linters:
bodyclose: checks whether HTTP response body is closed successfully [fast: false, auto-fix: false]
depguard: Go linter that checks if package imports are in a list of acceptable packages [fast: true, auto-fix: false]
dogsled: Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) [fast: true, auto-fix: false]
godox: Tool for detection of FIXME, TODO and other comment keywords [fast: true, auto-fix: false]
gofmt: Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification [fast: true, auto-fix: true]
gosimple: Linter for Go source code that specializes in simplifying a code [fast: false, auto-fix: false]
govet (vet, vetshadow): Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string [fast: false, auto-fix: false]
staticcheck: Staticcheck is a go vet on steroids, applying a ton of static analysis checks [fast: false, auto-fix: false]
stylecheck: Stylecheck is a replacement for golint [fast: false, auto-fix: false]
bug config

All 6 comments

@grongor Thanks for the report. I was able to reproduce the issue with v1.19.1 but not master. I believe this issue was recently fixed in commit 95ec0cf21ea4720ec9555c43176ab8b1d1b035f2 and will be included in the v1.20.0 release.

@grongor Resolving now that v1.20.0 has been released.

Thank you :)

This is still an issue

Nevermind, it works fine - I simply named a config setting wrong enabled vs enable :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nektro picture nektro  路  3Comments

bacongobbler picture bacongobbler  路  4Comments

cyriltovena picture cyriltovena  路  5Comments

jirfag picture jirfag  路  3Comments

alessio picture alessio  路  4Comments