Skip to content

Commit

Permalink
docs: improve typecheck FAQ (golangci#4306)
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez authored and Antonboom committed Mar 3, 2024
1 parent cdf94c3 commit f172205
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions docs/src/docs/usage/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,27 @@ Usually this options is used during development on local machine and compilation

## Why do you have `typecheck` errors?

`typecheck` is like the front-end of a Go compiler, parses and type-checks Go code, it manages compilation errors.
`typecheck` is like a front-end for the Go compiler errors.
Compilation errors are identified/labeled as reports of `typecheck` but they are not produced by a linter called `typecheck`.

`typecheck` is not a linter, it doesn't perform any analysis,
it's just a way to identify, parse, and display compiling errors (produced by the `types.Checker`) and some linter errors.

It cannot be disabled because of that.

Of course, this is just as good as the compiler itself and a lot of compilation issues will not properly show where in the code your error lies.

`typecheck` is not a real linter, it's just a way to parse compiling errors (produced by the `types.Checker`) and some linter errors.
As a consequence, the code to analyze should compile.
It means that if you try to run an analysis on a single file or a group of files or a package or a group of packages,
with dependencies on other files or packages of your project, as it doesn't compile (because of the missing pieces of code),
it also cannot be analyzed.

If there are `typecheck` errors, golangci-lint will not able to produce other reports because that kind of error doesn't allow it to perform analysis.
If there are `typecheck` errors, golangci-lint will not able to produce other reports because that kind of error doesn't allow it to perform any analysis.

How to troubleshoot:

- [ ] Ensure the version of `golangci-lint` is built with a compatible version of Go.
- [ ] Ensure dependencies are up-to-date with `go mod tidy`.
- [ ] Ensure building works with `go run ./...`/`go build ./...` - whole package.
- [ ] Ensure you are not running an analysis on code that depends on files/packages outside the scope of the analyzed elements.
- [ ] If using CGO, ensure all require system libraries are installed.

0 comments on commit f172205

Please sign in to comment.