From 7820f3770aeaadc39fb65bc0ea9ecca21834e6cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro?= Date: Sat, 25 May 2019 14:58:46 +0100 Subject: [PATCH] Remove specific version importers and use the default one --- importer18.go | 16 ---------------- importer19.go | 16 ---------------- stringer.go | 3 ++- 3 files changed, 2 insertions(+), 33 deletions(-) delete mode 100644 importer18.go delete mode 100644 importer19.go diff --git a/importer18.go b/importer18.go deleted file mode 100644 index fd21873..0000000 --- a/importer18.go +++ /dev/null @@ -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() -} diff --git a/importer19.go b/importer19.go deleted file mode 100644 index deddadb..0000000 --- a/importer19.go +++ /dev/null @@ -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) -} diff --git a/stringer.go b/stringer.go index edd8063..593e071 100644 --- a/stringer.go +++ b/stringer.go @@ -18,6 +18,7 @@ import ( "go/build" exact "go/constant" "go/format" + "go/importer" "go/parser" "go/token" "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. func (pkg *Package) check(fs *token.FileSet, astFiles []*ast.File) { 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{ Defs: pkg.defs, }