-
-
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
Panic, from staticcheck #2859
Comments
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors. |
Hello, The problem seems to only affect staticcheck inside golangci-lint, the standalone binary of staticcheck seems to work. |
A quick glance tells me that golangci-lint doesn't populate types.Info.Instances. |
Hi, how is this issue going? |
Not sure if this is super helpful, but maybe for testing a fix.
|
I believe I've encoutered the same issue with
|
package main
type ColScan[T any] struct {
Pick func(item *T) any
}
type Foo struct {
A string
}
func main() {
_ = ColScan[Foo]{
Pick: Jointer[int, Foo],
}
}
func Jointer[T, V any](*V) any {
var z T
return &z
} ERRO [runner] Panic: buildir: package "main" (isInitialPkg: true, needAnalyzeSource: true): in xx/aaa.main: cannot convert xx/aaa.Jointer (funcT, V any any) to func(item *xx/aaa.Foo) any: goroutine 543 [running]: |
Is anyone familiar with a workaround? or at least a temporary way to silence this error? |
There is no other workaround than disabling staticcheck rules ( |
I am running into this same issue on this commit. I updated to 1.46.2, disabled my custom rules, and ran
|
Another example:
In some cases I managed to workaround the issue by wrapping the instantiation into a function. For example:
In this case the gosimple linter might complain about not using a "lambda", but at least no panic. |
I've tracked this down to the fact that However when running within |
diff --git a/pkg/golinters/goanalysis/runner_loadingpackage.go b/pkg/golinters/goanalysis/runner_loadingpackage.go
index 1ac6b83e..a5b5cccf 100644
--- a/pkg/golinters/goanalysis/runner_loadingpackage.go
+++ b/pkg/golinters/goanalysis/runner_loadingpackage.go
@@ -123,6 +123,7 @@ func (lp *loadingPackage) loadFromSource(loadMode LoadMode) error {
pkg.TypesInfo = &types.Info{
Types: make(map[ast.Expr]types.TypeAndValue),
+ Instances: make(map[*ast.Ident]types.Instance),
Defs: make(map[*ast.Ident]types.Object),
Uses: make(map[*ast.Ident]types.Object),
Implicits: make(map[ast.Node]types.Object), |
You can use my patch by adding |
refactor -> work against runtime update dependency proto & change runtime port fix port out of range rename manifests "expression" to "pyexp" update natun dep replace the runtime pb to the monorepo sha1 -> sha256 add headers better logging :bug: fix minor configuration bugs :bug: add auth to grpc :seedling: update deps :bug: change proto dir in makefile :seedling: update natun ver :seedling: go mod tidy :seedling: add missing header :seedling: fix gh actions :sparkles: update deps (& runtime api change) :bug: fix bugs :seedling: upgrade pyexp :seedling: upgrade deps :bug: temporarily disabling some lint checks golangci/golangci-lint#2859 👻 rename org Signed-off-by: AlmogBaku <almog.baku@gmail.com> 👻 rebrand 👻 add missing file ✨ update golang-lint 👻 raptor/raptorml
Welcome
Description of the problem
Version of golangci-lint
Configuration file
no .golongci.yml, only enable staticcheck by command line.
Go environment
Verbose output of running
Code example or link to a public repository
https://github.com/matrixorigin/matrixone
The text was updated successfully, but these errors were encountered: