mirror of https://github.com/dmarkham/enumer.git
Remove specific version importers and use the default one
This commit is contained in:
parent
c0f685c6bf
commit
7820f3770a
|
@ -1,16 +0,0 @@
|
||||||
// Copyright 2017 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build !go1.9
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"go/importer"
|
|
||||||
"go/types"
|
|
||||||
)
|
|
||||||
|
|
||||||
func defaultImporter() types.Importer {
|
|
||||||
return importer.Default()
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
// Copyright 2017 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build go1.9
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"go/importer"
|
|
||||||
"go/types"
|
|
||||||
)
|
|
||||||
|
|
||||||
func defaultImporter() types.Importer {
|
|
||||||
return importer.For("source", nil)
|
|
||||||
}
|
|
|
@ -18,6 +18,7 @@ import (
|
||||||
"go/build"
|
"go/build"
|
||||||
exact "go/constant"
|
exact "go/constant"
|
||||||
"go/format"
|
"go/format"
|
||||||
|
"go/importer"
|
||||||
"go/parser"
|
"go/parser"
|
||||||
"go/token"
|
"go/token"
|
||||||
"go/types"
|
"go/types"
|
||||||
|
@ -262,7 +263,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{Importer: defaultImporter(), FakeImportC: true}
|
config := types.Config{Importer: importer.Default(), FakeImportC: true}
|
||||||
info := &types.Info{
|
info := &types.Info{
|
||||||
Defs: pkg.defs,
|
Defs: pkg.defs,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue