Skip to content

govet requires go install to work better #87

Closed
@alecthomas

Description

@alecthomas

I know this report won't be that helpful, but I don't have much information.

I have this configuration:

# Exhaustive list of options here:
# https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml
run:
  deadline: 5m
  tests: true
  skip-dirs:
    - mock # Remove once https://github.com/golangci/golangci-lint/issues/86 is fixed

output:
  print-issued-lines: false

linters:
  enable-all: true
  disable:
    - maligned

linters-settings:
  govet:
    check-shadowing: true
  golint:
    min-confidence: 0
  gocyclo:
    min-complexity: 10
  dupl:
    threshold: 100
  goconst:
    min-len: 2
    min-occurrences: 2
  gocyclo:
    min-complexity: 20

issues:
  max-per-linter: 0
  max-same: 0
  exclude-use-default: false
  exclude:
    # Captured by errcheck.
    - '^(G104|G204):'
    # Very commonly not checked.
    - 'Error return value of .(.*\.Help|.*\.MarkFlagRequired|(os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked'
    # TODO(aat): remove this once docs are added.
    - '.*should have.*comment.*'
    # Weird error only seen on CI...
    - 'internal error: no range for'

Running golangci-lint run locally on my laptop results in the following error:

pkg/provision/iam/policies.go:133:5: declaration of "err" shadows declaration at pkg/provision/iam/policies.go:115 (govet)

But when this runs under CI (on Kochiku), no error is reported. I've run it on CI with -v and it gives the following:

time="2018-06-12T00:27:06Z" level=info msg="Config search paths: [./ /data/app/kochiku-worker/shared/build-partition/cash/squaremason/src/stash.corp.squareup.com/cash/squaremason /data/app/kochiku-worker/shared/build-partition/cash/squaremason/src/stash.corp.squareup.com/cash /data/app/kochiku-worker/shared/build-partition/cash/squaremason/src/stash.corp.squareup.com /data/app/kochiku-worker/shared/build-partition/cash/squaremason/src /data/app/kochiku-worker/shared/build-partition/cash/squaremason /data/app/kochiku-worker/shared/build-partition/cash /data/app/kochiku-worker/shared/build-partition /data/app/kochiku-worker/shared /data/app/kochiku-worker /data/app /data /]"
time="2018-06-12T00:27:06Z" level=info msg="Used config file .golangci.yml"
time="2018-06-12T00:27:06Z" level=info msg="Active 18 linters: [deadcode depguard dupl errcheck gas goconst gocyclo gofmt goimports golint govet ineffassign interfacer megacheck structcheck typecheck unconvert varcheck]"
time="2018-06-12T00:27:06Z" level=info msg="Skipped dirs: [mocks pkg/awsenv/testdata vendor]"
time="2018-06-12T00:27:06Z" level=info msg="Paths resolving took 3.812451ms: [cmd/sqm cmd/sqm/env cmd/sqm/service internal/registry pkg/awsenv pkg/awsenv/iampolicy pkg/k8senv pkg/provision pkg/provision/database pkg/provision/iam pkg/provision/service server]"
time="2018-06-12T00:27:13Z" level=info msg="Program loading took 7.027793144s"
time="2018-06-12T00:27:17Z" level=info msg="SSA repr building took 3.545941115s"
time="2018-06-12T00:27:17Z" level=info msg="worker.3 took 358.10083ms with stages: goimports: 239.360565ms, dupl: 98.248495ms, ineffassign: 16.93739ms, gocyclo: 1.830568ms, unconvert: 1.651006ms"
time="2018-06-12T00:27:17Z" level=info msg="worker.4 took 360.277981ms with stages: golint: 237.566721ms, gofmt: 57.642512ms, gas: 45.870413ms, varcheck: 7.755287ms, deadcode: 3.634114ms, structcheck: 3.598876ms, errcheck: 2.459229ms, goconst: 1.650107ms, typecheck: 948ns"
time="2018-06-12T00:27:18Z" level=info msg="worker.1 took 928.704012ms with stages: interfacer: 790.557348ms, govet: 138.112655ms, depguard: 7.709µs"
time="2018-06-12T00:28:08Z" level=info msg="worker.2 took 51.523991372s with stages: megacheck: 51.523955449s"
time="2018-06-12T00:28:08Z" level=info msg="Workers idle times: #1: 50.595252839s, #3: 51.165207269s, #4: 51.163674384s"
time="2018-06-12T00:28:08Z" level=info msg="processing took 1.665043ms with stages: nolint: 824.966µs, exclude: 571.104µs, path_prettifier: 149.593µs, autogenerated_exclude: 78.38µs, cgo: 13.559µs, max_same_issues: 4.953µs, uniq_by_line: 4.94µs, diff: 4.718µs, max_per_file_from_linter: 4.331µs, skip_files: 4.306µs, max_from_linter: 4.193µs"
Congrats! No issues were found.

The CI gets the latest golangci-lint with:

go get -u github.com/golangci/golangci-lint/cmd/golangci-lint

And I'm using the same version locally.

Sorry I can't be of more help, but I can't get any more information out of golangci-lint or the CI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions