Get the modules aware importer via the function that was available in Go 1.11 and earlier

pull/839/head^2
Leigh McCulloch 2019-12-07 15:14:48 -08:00 committed by George Lesica
parent 940aba6697
commit 59bec1f2ff
3 changed files with 3 additions and 2 deletions

View File

@ -4,6 +4,7 @@
# automatically or via the GO111MODULE=on environment variable. Codegen only
# works with modules, so skip generation if modules is not in use.
if [[ -z "$(go env GOMOD)" ]]; then
echo "Skipping go generate because modules not enabled and required"
exit 0
fi

View File

@ -1,5 +1,5 @@
module github.com/stretchr/testify/_codegen
go 1.13
go 1.11
require github.com/ernesto-jimenez/gogen v0.0.0-20180125220232-d7d4131e6607

View File

@ -194,7 +194,7 @@ func parsePackageSource(pkg string) (*types.Scope, *doc.Package, error) {
}
cfg := types.Config{
Importer: importer.ForCompiler(fset, "source", nil),
Importer: importer.For("source", nil),
}
info := types.Info{
Defs: make(map[*ast.Ident]types.Object),