From 92ba69d216e6b840b02ae4ecdc7fb425a94473b2 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Fri, 15 Jan 2016 14:52:06 -0800 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Alan Donovan --- src/cmd/compile/internal/gc/lex.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/cmd/compile/internal/gc/lex.go b/src/cmd/compile/internal/gc/lex.go index fb30d58527..01eb3a5656 100644 --- a/src/cmd/compile/internal/gc/lex.go +++ b/src/cmd/compile/internal/gc/lex.go @@ -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)) -- 2.48.1