From 0e7518296d04977db0c71e2f326d473782973739 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Fri, 5 May 2017 12:47:53 -0700 Subject: [PATCH] go/importer: report import path if package is not found Fixes #20230. Change-Id: I2e9b9e9d2540eb66c8411ac7910962933bc2c0e9 Reviewed-on: https://go-review.googlesource.com/42870 Run-TryBot: Robert Griesemer TryBot-Result: Gobot Gobot Reviewed-by: Josh Bleecher Snyder --- src/go/internal/gcimporter/gcimporter.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/go/internal/gcimporter/gcimporter.go b/src/go/internal/gcimporter/gcimporter.go index f99f0f8bef..f3f90f2591 100644 --- a/src/go/internal/gcimporter/gcimporter.go +++ b/src/go/internal/gcimporter/gcimporter.go @@ -43,6 +43,7 @@ func FindPkg(path, srcDir string) (filename, id string) { } bp, _ := build.Import(path, srcDir, build.FindOnly|build.AllowBinary) if bp.PkgObj == "" { + id = path // make sure we have an id to print in error message return } noext = strings.TrimSuffix(bp.PkgObj, ".a") @@ -89,7 +90,7 @@ func Import(packages map[string]*types.Package, path, srcDir string) (pkg *types if path == "unsafe" { return types.Unsafe, nil } - err = fmt.Errorf("can't find import: %s", id) + err = fmt.Errorf("can't find import: %q", id) return } -- 2.48.1