From 90d2a5e92d8ae606b13f7594fe5d8b314a9b4e79 Mon Sep 17 00:00:00 2001 From: Vytautas Saltenis Date: Sat, 9 Sep 2017 20:56:17 +0300 Subject: [PATCH] Record NonCanonicalImportRoot error instead of immediate return --- internal/gps/pkgtree/pkgtree.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/internal/gps/pkgtree/pkgtree.go b/internal/gps/pkgtree/pkgtree.go index 17322411..4440e0f7 100644 --- a/internal/gps/pkgtree/pkgtree.go +++ b/internal/gps/pkgtree/pkgtree.go @@ -155,10 +155,13 @@ func ListPackages(fileRoot, importRoot string) (PackageTree, error) { } if pkg.CommentPath != "" && !strings.HasPrefix(pkg.CommentPath, importRoot) { - return &NonCanonicalImportRoot{ - ImportRoot: importRoot, - Canonical: pkg.CommentPath, + ptree.Packages[ip] = PackageOrErr{ + Err: &NonCanonicalImportRoot{ + ImportRoot: importRoot, + Canonical: pkg.CommentPath, + }, } + return nil } // This area has some...fuzzy rules, but check all the imports for @@ -355,7 +358,7 @@ func findImportComment(pkgName *ast.Ident, c *ast.CommentGroup) string { } // ConflictingImportComments indicates that the package declares more than one -// different canonical paths. +// different canonical path. type ConflictingImportComments struct { ImportPath string ImportComments []string @@ -367,7 +370,7 @@ func (e *ConflictingImportComments) Error() string { } // NonCanonicalImportRoot reports the situation when the dependee imports a -// package via something else that the package's declared canonical path. +// package via something other than the package's declared canonical path. type NonCanonicalImportRoot struct { ImportRoot string Canonical string