fixed importer

This commit is contained in:
marco 2016-04-09 01:30:49 +02:00
parent 3d7dacca3a
commit 8bdc3a85b5
2 changed files with 3 additions and 5 deletions

BIN
enumer

Binary file not shown.

View File

@ -64,7 +64,9 @@ import (
"fmt" "fmt"
"go/ast" "go/ast"
"go/build" "go/build"
exact "go/constant"
"go/format" "go/format"
"go/importer"
"go/parser" "go/parser"
"go/token" "go/token"
"go/types" "go/types"
@ -74,10 +76,6 @@ import (
"path/filepath" "path/filepath"
"sort" "sort"
"strings" "strings"
exact "go/constant"
_ "go/importer"
) )
var ( var (
@ -270,7 +268,7 @@ func (g *Generator) parsePackage(directory string, names []string, text interfac
// check type-checks the package. The package must be OK to proceed. // check type-checks the package. The package must be OK to proceed.
func (pkg *Package) check(fs *token.FileSet, astFiles []*ast.File) { func (pkg *Package) check(fs *token.FileSet, astFiles []*ast.File) {
pkg.defs = make(map[*ast.Ident]types.Object) pkg.defs = make(map[*ast.Ident]types.Object)
config := types.Config{FakeImportC: true} config := types.Config{Importer: importer.Default(), FakeImportC: true}
info := &types.Info{ info := &types.Info{
Defs: pkg.defs, Defs: pkg.defs,
} }