Skip to content

Conversation

bombsimon
Copy link
Member

Add a step in the troubleshooting guide to ensure users are not linting individual files. Even though this might work, it's often the root cause of typecheck reports when the package consists of multiple files.


This seems to be a common mistake and mentioned in #3759. This step ensures users targeting single files tries to lint the whole package first (and not necessarily ./...).

Add a step in the troubleshooting guide to ensure users are not linting
individual files. Even though this _might_ work, it's often the root
cause of `typecheck` reports when the package consists of multiple
files.
Copy link
Member

@ldez ldez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sentence is ambiguous because:

  • A single file or package can be linted if there are no dependencies with other files/packages
  • package has the same "problem" as a single file, if there are dependencies with other files/packages it will fail.

Your suggestion is the same topic as Ensure building works with go run ./.../go build ./... - whole package.

I think I will create PR to explain with more details what is typecheck, it will not be fun but I think it's the best approach we can take.

@bombsimon
Copy link
Member Author

Yes, the sentence wasn't meant to be an absolute truth for every time typecheck is seen, it was just one thing to try in the troubleshooting process. Same as go mod tidy won't always solve the issue but it might solve the issue and worth having the user test.

I think it would be nice to extend the list to ensure that golangci-lint is not ran on a single file since that's pretty common mistake (either with the CLI tool or with editor settings). However you're explanation in #4306 is better so I'll close this.

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.

2 participants