1
0
mirror of https://github.com/golang/go synced 2024-09-24 01:20:13 -06:00

cmd/compile: set importpkg.Direct correctly when using binary imports

Fixes #13977.

Change-Id: Icf54b4d2d746d30da207d1e17c975d18188b1cf8
Reviewed-on: https://go-review.googlesource.com/18702
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
Robert Griesemer 2016-01-15 14:52:06 -08:00
parent 5e7110b92b
commit 92ba69d216

View File

@ -843,6 +843,13 @@ func importfile(f *Val, line int) {
}
p := fmt.Sprintf("package %s %s\n$$\n", importpkg.Name, tag)
cannedimports(file, p)
// Reset incannedimport flag (we are not truly in a
// canned import) - this will cause importpkg.Direct to
// be set via parser.import_package (was issue #13977).
//
// TODO(gri) Remove this global variable and convoluted
// code in the process of streamlining the import code.
incannedimport = 0
default:
Yyerror("no import in %q", f.U.(string))