Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions pkg/golinters/goanalysis/runner_loadingpackage.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,7 @@ func (lp *loadingPackage) loadFromSource(loadMode LoadMode) error {

pkg.IllTyped = true

pkg.TypesInfo = &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),
}
pkg.TypesInfo = newTypesInfo()

importer := func(path string) (*types.Package, error) {
if path == unsafePkgName {
Expand Down
21 changes: 21 additions & 0 deletions pkg/golinters/goanalysis/runner_loadingpackage_ti.go
Original file line number Diff line number Diff line change
@@ -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 changes: 20 additions & 0 deletions pkg/golinters/goanalysis/runner_loadingpackage_ti_go117.go
Original file line number Diff line number Diff line change
@@ -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),
}
}