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

Fix #17, #87: govet becomes SLOW linter by default #117

Merged
merged 1 commit into from
Jun 18, 2018

Conversation

jirfag
Copy link
Member

@jirfag jirfag commented Jun 17, 2018

  1. Allow govet to work in 2 modes: fast and slow. Default is slow.
    In fast mode golangci-lint runs go install -i and go test -i
    for analyzed packages. But it's fast only when:
  • go >= 1.10
  • it's repeated run or $GOPATH/pkg or go env GOCACHE is cached
    between CI builds
    In slow mode we load program from source code like for another linters
    and do it only once for all linters.
  1. Patch govet code to warn about any troubles with the type
    information. Default behaviour of govet was to hide such warnings.
    Fail analysis if there are any troubles with type loading: it will
    prevent false-positives and false-negatives from govet.

  2. Describe almost all options in .golangci.example.yml and
    include it into README. Describe when to use slow or fast mode of govet.

  3. Speed up govet: reuse AST parsing: it's already parsed once by
    golangci-lint.
    For "slow" runs (when we run at least one slow linter) speedup by
    not loading type information second time.

  4. Improve logging, debug logging

@jirfag
Copy link
Member Author

jirfag commented Jun 17, 2018

@alecthomas, users of golangci-lint: what do you think about this fix?

Are you ok that govet will become a slow linter: it won't be enabled with --fast and will run much slower if it's enabled explicitly with only "fast" linters (golint, gofmt, gocyclo)? What do you think about "fast" mode by enabling option use-installed-packages: true?

@alecthomas
Copy link
Contributor

This works for me 👍

1. Allow govet to work in 2 modes: fast and slow. Default is slow.
In fast mode golangci-lint runs `go install -i` and `go test -i`
for analyzed packages. But it's fast only when:
  - go >= 1.10
  - it's repeated run or $GOPATH/pkg or `go env GOCACHE` is cached
  between CI builds
In slow mode we load program from source code like for another linters
and do it only once for all linters.

3. Patch govet code to warn about any troubles with the type
information. Default behaviour of govet was to hide such warnings.
Fail analysis if there are any troubles with type loading: it will
prevent false-positives and false-negatives from govet.

4. Describe almost all options in .golangci.example.yml and
include it into README. Describe when to use slow or fast mode of govet.

5. Speed up govet: reuse AST parsing: it's already parsed once by
golangci-lint.
For "slow" runs (when we run at least one slow linter) speedup by
not loading type information second time.

6. Improve logging, debug logging

7. Fix crash in logging of AST cache warnings (#118)
@golangci golangci force-pushed the support/fix-govet-failure-because-of-type-info branch from e6da4be to f2efd61 Compare June 18, 2018 06:29
@jirfag jirfag merged commit 5514c43 into master Jun 18, 2018
@jirfag
Copy link
Member Author

jirfag commented Jun 18, 2018

thank you

@jirfag jirfag deleted the support/fix-govet-failure-because-of-type-info branch June 18, 2018 06:48
@jirfag jirfag mentioned this pull request Jun 18, 2018
@ldez ldez added this to the v1.7 milestone Mar 6, 2024
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

Successfully merging this pull request may close these issues.

3 participants