Skip to content
This repository has been archived by the owner on Feb 3, 2018. It is now read-only.

Commit

Permalink
Update LocalImportsError to suit
Browse files Browse the repository at this point in the history
  • Loading branch information
sdboyer committed Jan 19, 2017
1 parent 8281691 commit 4b3d66d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,15 @@ type LocalImportsError struct {
}

func (e *LocalImportsError) Error() string {
return fmt.Sprintf("import path %s had problematic local imports", e.Dir)
switch len(e.LocalImports) {
case 0:
// shouldn't be possible, but just cover the case
return fmt.Sprintf("import path %s had bad local imports", e.ImportPath)
case 1:
return fmt.Sprintf("import path %s had a local import: %q", e.ImportPath, e.LocalImports[0])
default:
return fmt.Sprintf("import path %s had local imports: %q", e.ImportPath, strings.Join(e.LocalImports, "\", \""))
}
}

func readFileBuildTags(fp string) ([]string, error) {
Expand Down

0 comments on commit 4b3d66d

Please sign in to comment.