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

errors when GO111MODULE=off #1026

Closed
bhcleek opened this issue Aug 18, 2024 · 3 comments · Fixed by #1025
Closed

errors when GO111MODULE=off #1026

bhcleek opened this issue Aug 18, 2024 · 3 comments · Fixed by #1025
Assignees
Labels

Comments

@bhcleek
Copy link

bhcleek commented Aug 18, 2024

Description

Revive exits non-zero and outputs an error, "linting - retrieving failures channel: command go list: exit status 1," when run against a null module or with module support turned off.

To Reproduce

  1. Update revive to v1.3.9
  2. set GO111MODULE=off
  3. Execute revive against a package that is placed properly in GOPATH

Note that the problem will also manifest when revive is executed against a package that is not in a module at all and is also not in GOPATH.

Expected behavior
Appropriate linting errors should be displayed.

Additional context

This works fine in v1.3.7 and lower; it's a new problem in v1.3.9. If you want some files to use, vim-go's test-fixtures may be useful. The files in the test-fixture for its lint tests are relevant. Here's output showing v1.3.7 vs v1.3.9 behavior:

With v1.3.7:

❯❯❯ GO111MODULE=off GOPATH=$PWD/autoload/go/test-fixtures/lint revive .
lint.go:1:1: should have a package comment
quux.go:5:1: exported function AlsoMissingDoc should have comment or be unexported
lint.go:5:1: exported function MissingDoc should have comment or be unexported

With v1.3.9:

❯❯❯ GO111MODULE=off GOPATH=$PWD/autoload/go/test-fixtures/lint revive .
linting - retrieving failures channel: command go list: exit status 1
@chavacava
Copy link
Collaborator

Hi @bhcleek thanks for reporting the problem.
I've tested the PR #1025 against your example and it seems to fix the bug.

@bhcleek
Copy link
Author

bhcleek commented Aug 18, 2024

@chavacava #1025 only fixes the case where GO111MODULE is off and revive is being run against a package that is within in a module. The problem I reported still exists when the package being checked does not have a go.mod file.

Should I open another issue?

@chavacava
Copy link
Collaborator

@bhcleek thanks for reporting the problem, I've created a new issue #1027

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

Successfully merging a pull request may close this issue.

2 participants