]> Cypherpunks repositories - gostls13.git/commitdiff
go/importer: report import path if package is not found
authorRobert Griesemer <gri@golang.org>
Fri, 5 May 2017 19:47:53 +0000 (12:47 -0700)
committerRobert Griesemer <gri@golang.org>
Fri, 5 May 2017 23:03:37 +0000 (23:03 +0000)
Fixes #20230.

Change-Id: I2e9b9e9d2540eb66c8411ac7910962933bc2c0e9
Reviewed-on: https://go-review.googlesource.com/42870
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
src/go/internal/gcimporter/gcimporter.go

index f99f0f8befeec89b61755d48a5f79e180cc18455..f3f90f259117ada95f7df56e7e5655ce463b4fe4 100644 (file)
@@ -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
        }