staticcheck: fix generics (#2976)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
This commit is contained in:
parent
d6a39ef374
commit
0abb298136
@ -121,14 +121,7 @@ func (lp *loadingPackage) loadFromSource(loadMode LoadMode) error {
|
|||||||
|
|
||||||
pkg.IllTyped = true
|
pkg.IllTyped = true
|
||||||
|
|
||||||
pkg.TypesInfo = &types.Info{
|
pkg.TypesInfo = newTypesInfo()
|
||||||
Types: make(map[ast.Expr]types.TypeAndValue),
|
|
||||||
Defs: make(map[*ast.Ident]types.Object),
|
|
||||||
Uses: make(map[*ast.Ident]types.Object),
|
|
||||||
Implicits: make(map[ast.Node]types.Object),
|
|
||||||
Scopes: make(map[ast.Node]*types.Scope),
|
|
||||||
Selections: make(map[*ast.SelectorExpr]*types.Selection),
|
|
||||||
}
|
|
||||||
|
|
||||||
importer := func(path string) (*types.Package, error) {
|
importer := func(path string) (*types.Package, error) {
|
||||||
if path == unsafePkgName {
|
if path == unsafePkgName {
|
||||||
|
21
pkg/golinters/goanalysis/runner_loadingpackage_ti.go
Normal file
21
pkg/golinters/goanalysis/runner_loadingpackage_ti.go
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
//go:build go1.18
|
||||||
|
// +build go1.18
|
||||||
|
|
||||||
|
package goanalysis
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go/ast"
|
||||||
|
"go/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
func newTypesInfo() *types.Info {
|
||||||
|
return &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),
|
||||||
|
Scopes: make(map[ast.Node]*types.Scope),
|
||||||
|
Selections: make(map[*ast.SelectorExpr]*types.Selection),
|
||||||
|
}
|
||||||
|
}
|
20
pkg/golinters/goanalysis/runner_loadingpackage_ti_go117.go
Normal file
20
pkg/golinters/goanalysis/runner_loadingpackage_ti_go117.go
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
//go:build go1.17 && !go1.18
|
||||||
|
// +build go1.17,!go1.18
|
||||||
|
|
||||||
|
package goanalysis
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go/ast"
|
||||||
|
"go/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
func newTypesInfo() *types.Info {
|
||||||
|
return &types.Info{
|
||||||
|
Types: make(map[ast.Expr]types.TypeAndValue),
|
||||||
|
Defs: make(map[*ast.Ident]types.Object),
|
||||||
|
Uses: make(map[*ast.Ident]types.Object),
|
||||||
|
Implicits: make(map[ast.Node]types.Object),
|
||||||
|
Scopes: make(map[ast.Node]*types.Scope),
|
||||||
|
Selections: make(map[*ast.SelectorExpr]*types.Selection),
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user