mirror of
https://github.com/mgechev/revive.git
synced 2025-02-13 13:48:36 +02:00
Move to the default importer from gcexportdata (#723)
This commit is contained in:
parent
db56db0b6a
commit
71ef7fdcb9
@ -2,12 +2,11 @@ package lint
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"go/ast"
|
"go/ast"
|
||||||
|
"go/importer"
|
||||||
"go/token"
|
"go/token"
|
||||||
"go/types"
|
"go/types"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"golang.org/x/tools/go/gcexportdata"
|
|
||||||
|
|
||||||
"github.com/mgechev/revive/internal/typeparams"
|
"github.com/mgechev/revive/internal/typeparams"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -26,10 +25,6 @@ type Package struct {
|
|||||||
sync.RWMutex
|
sync.RWMutex
|
||||||
}
|
}
|
||||||
|
|
||||||
var newImporter = func(fset *token.FileSet) types.ImporterFrom {
|
|
||||||
return gcexportdata.NewImporter(fset, make(map[string]*types.Package))
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
trueValue = 1
|
trueValue = 1
|
||||||
falseValue = 2
|
falseValue = 2
|
||||||
@ -95,7 +90,7 @@ func (p *Package) TypeCheck() error {
|
|||||||
config := &types.Config{
|
config := &types.Config{
|
||||||
// By setting a no-op error reporter, the type checker does as much work as possible.
|
// By setting a no-op error reporter, the type checker does as much work as possible.
|
||||||
Error: func(error) {},
|
Error: func(error) {},
|
||||||
Importer: newImporter(p.fset),
|
Importer: importer.Default(),
|
||||||
}
|
}
|
||||||
info := &types.Info{
|
info := &types.Info{
|
||||||
Types: make(map[ast.Expr]types.TypeAndValue),
|
Types: make(map[ast.Expr]types.TypeAndValue),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user