Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1557)

Unified Diff: src/cmd/go/pkg.go

Issue 5787055: code review 5787055: cmd/go: local import fixes (Closed)
Patch Set: diff -r 91a86970157c https://code.google.com/p/go/ Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/cmd/go/build.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/cmd/go/pkg.go
===================================================================
--- a/src/cmd/go/pkg.go
+++ b/src/cmd/go/pkg.go
@@ -279,9 +279,8 @@
p.copyBuild(bp)
// The localPrefix is the path we interpret ./ imports relative to.
- // Now that we've fixed the import path, it's just the import path.
// Synthesized main packages sometimes override this.
- p.localPrefix = p.ImportPath
+ p.localPrefix = dirToImportPath(p.Dir)
if err != nil {
p.Incomplete = true
@@ -343,6 +342,16 @@
}
p1 := loadImport(path, p.Dir, stk, p.build.ImportPos[path])
if p1.local {
+ if !p.local && p.Error == nil {
+ p.Error = &PackageError{
+ ImportStack: stk.copy(),
+ Err: fmt.Sprintf("local import %q in non-local package", path),
+ }
+ pos := p.build.ImportPos[path]
+ if len(pos) > 0 {
+ p.Error.Pos = pos[0].String()
+ }
+ }
path = p1.ImportPath
importPaths[i] = path
}
« no previous file with comments | « src/cmd/go/build.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b