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

Unable to enable all linters #355

Closed
JensRantil opened this issue Jan 13, 2019 · 2 comments
Closed

Unable to enable all linters #355

JensRantil opened this issue Jan 13, 2019 · 2 comments

Comments

@JensRantil
Copy link

JensRantil commented Jan 13, 2019

  1. Version of golangci-lint: golangci-lint --version (or git commit if you don't use binary distribution)
$ golangci-lint --version
golangci-lint has version 1.12.5 built from 609de32 on 2018-12-23T09:40:14Z
  1. Config file: cat .golangci.yml
$ cat .golangci.yml
linters:
  enable:
    - gofmt
    - golint
    - goimports
    - unparam
    - unconvert
    - interfacer
    - megacheck
    - staticcheck
    - unused
    - gosimple
    - dupl
    - goconst
    - gocyclo
    - nakedret
    - scopelint
    - gocritic
    - misspell

issues:
  # Not using default exclusions because we want to require comments on public
  # functions and types.
  exclude-use-default: false
  exclude:
    # errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
    - Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked
    # golint: False positive when tests are defined in package 'test'
    - func name will be used as test\.Test.* by other packages, and that stutters; consider calling this
    # govet: Common false positives
    - (possible misuse of unsafe.Pointer|should have signature)
  1. Go environment: go version && go env
$ go version && go env
go version go1.11.4 darwin/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/jrantil/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/jrantil/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11.4/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11.4/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/jk/zh2vp9qj5n5bpzrgb7t_6p700000gn/T/go-build759552981=/tmp/go-build -gno-record-gcc-switches -fno-common"
  1. Verbose output of running: golangci-lint run -v
$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /Users/jrantil/go/src/github.com/tink-ab/tink-X-service /Users/jrantil/go/src/github.com/tink-ab /Users/jrantil/go/src/github.com /Users/jrantil/go/src /Users/jrantil/go /Users/jrantil /Users /]
INFO [config_reader] Used config file .golangci.yml
INFO Gocritic enabled checks: [appendAssign assignOp caseOrder dupArg dupBranchBody dupCase flagDeref ifElseChain regexpMust singleCaseSwitch sloppyLen switchTrue typeSwitchVar underef unlambda unslice defaultCaseOrder]
INFO [lintersdb] Active 21 linters: [deadcode dupl errcheck goconst gocritic gocyclo gofmt goimports golint govet ineffassign interfacer megacheck misspell nakedret scopelint structcheck typecheck unconvert unparam varcheck]
INFO [loader] Go packages loading at mode load deps types and syntax took 1.225644244s
INFO [loader] SSA repr building timing: packages building 40.996435ms, total 500.019011ms
INFO [loader] SSA for megacheck repr building timing: packages building 19.565716ms, total 515.004713ms
INFO [runner] worker.8 took 119.308034ms with stages: govet: 50.364686ms, misspell: 43.987059ms, ineffassign: 17.148967ms, gocyclo: 3.458496ms, scopelint: 2.900651ms, errcheck: 1.353479ms, typecheck: 2.204µs
INFO [runner] worker.4 took 121.009721ms with stages: dupl: 108.435449ms, varcheck: 4.244229ms, deadcode: 2.73331ms, structcheck: 1.88393ms, unconvert: 1.826333ms, goconst: 996.709µs, nakedret: 787.428µs
INFO [runner] worker.2 took 129.153755ms with stages: gocritic: 68.08492ms, gofmt: 61.027651ms
INFO [runner] worker.3 took 149.511559ms with stages: goimports: 149.429989ms
INFO [runner] worker.5 took 232.136393ms with stages: interfacer: 232.09977ms
INFO [runner] worker.7 took 287.534796ms with stages: golint: 287.499709ms
INFO [runner] worker.6 took 647.988716ms with stages: unparam: 647.917314ms
INFO [runner] worker.1 took 1.038813044s with stages: megacheck: 1.038763079s
INFO [runner] Workers idle times: #2: 909.542155ms, #3: 889.190676ms, #4: 917.727892ms, #5: 806.560338ms, #6: 390.806578ms, #7: 751.262926ms, #8: 919.405722ms
INFO [runner] Issues before processing: 141, after processing: 0
INFO [runner] processing took 2.76686ms with stages: skip_dirs: 1.412165ms, cgo: 1.000398ms, path_prettifier: 181.553µs, autogenerated_exclude: 134.277µs, exclude: 31.62µs, diff: 1.156µs, max_same_issues: 1.007µs, source_code: 970ns, nolint: 848ns, skip_files: 625ns, uniq_by_line: 604ns, max_per_file_from_linter: 571ns, max_from_linter: 538ns, path_shortener: 528ns
INFO Memory: 33 samples, avg is 635.8MB, max is 1352.1MB
INFO Execution took 3.380052444s

Problem:

staticcheck, gosimple & unused are still not enabled:

$ golangci-lint linters
Enabled by your configuration linters:
govet: Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string [fast: true]
ineffassign: Detects when assignments to existing variables are not used [fast: true]
deadcode: Finds unused code [fast: true]
nakedret: Finds naked returns in functions greater than a specified function length [fast: true]
unparam: Reports unused function parameters [fast: false]
dupl: Tool for code clone detection [fast: true]
gocyclo: Computes and checks the cyclomatic complexity of functions [fast: true]
gocritic: The most opinionated Go source code linter [fast: true]
interfacer: Linter that suggests narrower interface types [fast: false]
goconst: Finds repeated strings that could be replaced by a constant [fast: true]
scopelint: Scopelint checks for unpinned variables in go programs [fast: true]
golint: Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes [fast: true]
goimports: Goimports does everything that gofmt does. Additionally it checks unused imports [fast: true]
misspell: Finds commonly misspelled English words in comments [fast: true]
unconvert: Remove unnecessary type conversions [fast: true]
megacheck: 3 sub-linters in one: unused, gosimple and staticcheck [fast: 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]
structcheck: Finds an unused struct fields [fast: true]
varcheck: Finds unused global variables and constants [fast: true]
typecheck: Like the front-end of a Go compiler, parses and type-checks Go code [fast: true]
gofmt: Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification [fast: true]

Disabled by your configuration linters:
staticcheck: Staticcheck is a go vet on steroids, applying a ton of static analysis checks [fast: false]
unused: Checks Go code for unused constants, variables, functions and types [fast: false]
gosimple: Linter for Go source code that specializes in simplifying a code [fast: false]
gosec (gas): Inspects source code for security problems [fast: true]
maligned: Tool to detect Go structs that would take less memory if their fields were sorted [fast: true]
depguard: Go linter that checks if package imports are in a list of acceptable packages [fast: true]
lll: Reports long lines [fast: true]
prealloc: Finds slice declarations that could potentially be preallocated [fast: true]
gochecknoinits: Checks that no init functions are present in Go code [fast: true]
gochecknoglobals: Checks that no globals are present in Go code [fast: true]

Am I missing something or is this a bug?

@jirfag
Copy link
Member

jirfag commented Jan 20, 2019

Hi, thank you for reporting!
All linters are enabled. Confusion arose because we merge staticcheck, unused, gosimple into one linter megacheck.

I've fixed printing of linter names in golangci-lint linters command in #364. Please check the version from the master after merging it.

@jirfag jirfag closed this as completed in f6ce931 Jan 20, 2019
@JensRantil
Copy link
Author

Ah, that explains things! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants