-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
undeclared name: false positive (typecheck) #3185
Comments
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors. |
Hello,
|
The logs seem not related to the title and the description of the issue. In the log, there is a panic from |
The revive panic comes because I think that the typecheck issues are related to a problem with |
Even if I remove revive, and re-run to see various messages from NOTE: After re-running local lint = require("lint")
lint.linters_by_ft = {
go = { "golangcilint" },
}
local golangcilint = require("lint.linters.golangcilint")
golangcilint.append_fname = true
golangcilint.args = {
"run",
"--out-format",
"json",
} |
I'm sure of the root cause of the panic, because I'm able to reproduce it with your configuration. invalid configuration (panic) - name: "add-constant"
severity: "warning"
arguments: [{ maxLitCount = "10", allowInts = "0,1,2,3,4,5" }] # <--HERE (TOML syntax)
disabled: true valid configuration - name: add-constant
severity: warning
disabled: false
arguments:
- maxLitCount: "10"
allowInts: "0,1,2,3,4,5" I don't know how neovim work, but if you are running golangci-lint to only one file it will not work because the code must be compilable to be analyzed. I'm still thinking that the typecheck issues are related to a problem with |
I recommend using v1.49.0 (support go1.19) instead of v1.48.0 |
Thanks I'll be sure to update versions. re:
I'm using the Neovim plugin https://github.com/mfussenegger/nvim-lint the configuration I'm using (shown earlier) looks to be passing the file name to golangci-lint. So maybe that's why the typecheck linter is failing to pick up references across files (even if they're part of the same package). The revive tool has a similar issue with it not working correctly on single files. |
Interesting.
|
I don't recommend using
|
Welcome
Description of the problem
I have a package called
compute
which is split across multiple files.pkg/commands/compute/init.go
pkg/commands/compute/language.go
The
init.go
file reports:But the
NewLanguages
type is a declared function in the same package (it's defined insidelanguage.go
).Version of golangci-lint
I installed the binary using
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
.Configuration file
Go environment
Verbose output of running
Code example or link to a public repository
https://github.com/fastly/cli/blob/main/pkg/commands/compute/init.go#L150
The text was updated successfully, but these errors were encountered: