Skip to content

Error reported by golint binary but not golangci-lint #295

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

Closed
theckman opened this issue Nov 16, 2018 · 6 comments
Closed

Error reported by golint binary but not golangci-lint #295

theckman opened this issue Nov 16, 2018 · 6 comments

Comments

@theckman
Copy link
Contributor

I'm currently invoking golangci-lint as part of the Go integration with my editor, and I noticed that golint failures weren't being reported. I'm testing this against a single file in my repo mocks/mocks.go. If I invoke golint directly it works just fine.

Please include the following information:

  1. Version of golangci-lint: golangci-lint --version (or git commit if you don't use binary distribution)
golangci-lint has version 1.12.2 built from 898ae4d on 2018-11-11T06:43:11Z
  1. Config file: cat .golangci.yml
run:
  tests: true

# all available settings of specific linters
linters-settings:
  govet:
    # report about shadowed variables
    check-shadowing: true
  golint:
    # minimal confidence for issues, default is 0.8
    min-confidence: 0
  gofmt:
    # simplify code: gofmt with `-s` option, true by default
    simplify: true
  dupl:
    # tokens count to trigger issue, 150 by default
    threshold: 100
  goconst:
    # minimal length of string constant, 3 by default
    min-len: 3
    # minimal occurrences count to trigger, 3 by default
    min-occurrences: 3
  misspell:
    # Correct spellings using locale preferences for US or UK.
    # Default is to use a neutral variety of English.
    # Setting locale to US will correct the British spelling of 'colour' to 'color'.
    locale: US

linters:
  enable:
    - golint
    - govet
    - goimports
  fast: false
  1. Go environment: go version && go env
go version go1.11.2 darwin/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/theckman/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/theckman/go/"
GOPROXY=""
GORACE=""
GOROOT="/Users/theckman/.gimme/versions/go1.11.2.darwin.amd64"
GOTMPDIR=""
GOTOOLDIR="/Users/theckman/.gimme/versions/go1.11.2.darwin.amd64/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/f5/zjcsdkrx2bxdm32zzqfg5yp80000gn/T/go-build734660567=/tmp/go-build -gno-record-gcc-switches -fno-common"
  1. Verbose output of running: golangci-lint run -v
$ golangci-lint run -v --disable-all --enable=golint
level=info msg="[config_reader] Config search paths: [./ /Users/theckman/go/src/stash.corp.netflix.com/core/halp2/mocks /Users/theckman/go/src/stash.corp.netflix.com/core/halp2 /Users/theckman/go/src/stash.corp.netflix.com/core /Users/theckman/go/src/stash.corp.netflix.com /Users/theckman/go/src /Users/theckman/go /Users/theckman /Users /]"
level=info msg="Gocritic enabled checks: [appendAssign assignOp caseOrder dupArg dupBranchBody dupCase flagDeref ifElseChain regexpMust singleCaseSwitch sloppyLen switchTrue typeSwitchVar underef unlambda unslice defaultCaseOrder]"
level=info msg="[lintersdb] Active 1 linters: [golint]"
level=info msg="[loader] Go packages loading at mode load files took 221.81526ms"
level=info msg="[loader/astcache] Parsed AST of all pkg.GoFiles: [/Users/theckman/go/src/stash.corp.netflix.com/core/halp2/mocks/mocks.go] for 265.499µs"
level=info msg="[runner] worker.3 took 45.717µs"
level=info msg="[runner] worker.1 took 47.912µs"
level=info msg="[runner] worker.2 took 95.618µs"
level=info msg="[runner] worker.8 took 62.359µs"
level=info msg="[runner] worker.6 took 4.875µs"
level=info msg="[runner] worker.7 took 122.185µs"
level=info msg="[runner] worker.5 took 207.095µs"
level=info msg="[runner] worker.4 took 6.375107ms with stages: golint: 6.302914ms"
level=info msg="[runner] Workers idle times: #1: 6.26094ms, #2: 6.257305ms, #3: 6.279785ms, #5: 6.147833ms, #6: 6.247951ms, #7: 6.241924ms, #8: 6.25127ms"
level=info msg="[runner] processing took 1.376574ms with stages: exclude: 932.155µs, skip_dirs: 160.794µs, path_prettifier: 159.561µs, cgo: 72.912µs, autogenerated_exclude: 45.621µs, max_same_issues: 1.231µs, nolint: 807ns, diff: 594ns, skip_files: 568ns, max_from_linter: 537ns, source_code: 477ns, path_shortener: 450ns, uniq_by_line: 447ns, max_per_file_from_linter: 420ns"
level=info msg="Memory: 4 samples, avg is 69.1MB, max is 69.2MB"
level=info msg="Execution took 347.224436ms"

Here is me running golint manually:

$ echo $GOPATH
/Users/theckman/go/
$ which golint
/Users/theckman/go/bin/golint
 $ golint mocks/
mocks/mocks.go:1:1: package comment should be of the form "Package mocks ..."
mocks/mocks.go:17:5: exported var DefaultMockS3ManagerUploadOutput should have comment or be unexported
mocks/mocks.go:19:6: exported type S3Uploader should have comment or be unexported
mocks/mocks.go:28:1: exported function NewS3Uploader should have comment or be unexported
mocks/mocks.go:32:1: exported method S3Uploader.UploadWithContext should have comment or be unexported
@theckman
Copy link
Contributor Author

Ah, just found #88 when searching again. Let me see if I can get that fixed-up on my workstation.

@jirfag
Copy link
Contributor

jirfag commented Nov 23, 2018

hi!
did exclude-use-default: false help you?

@ifraixedes
Copy link

I had this issue too and with --exclude-use-default=false worked

@ifraixedes
Copy link

I've realized that when using it in vim with Ale I see warnings with types declared in other files of the same package.

For example:
In the same package there is

data.go

package foo

type Data []byte

envelop.go

package foo

type Envelop struct {
	ID string
	Data Data
}

I have a warning in Data field of the Envelop type like `undeclared name: Data (typecheck)

@jirfag
Copy link
Contributor

jirfag commented Dec 22, 2018

@ifraixedes please make an issue in Ale: it could be when editor runs golangci-lint on the file, but not on the directory containing file. If golangci-lint gets only one file as argument is analyzes only this file

@theckman
Copy link
Contributor Author

Sorry for forgetting to close this. Enabling that setting in my config took care of it. 👍

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

3 participants