Created
April 9, 2017 02:06
-
-
Save sougou/2255bc77bf8eaa45eadcc44f8832514f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/imports/fix.go b/imports/fix.go | |
index 1387c997..3504d40b 100644 | |
--- a/imports/fix.go | |
+++ b/imports/fix.go | |
@@ -641,12 +641,6 @@ func loadExportsGoPath(expectPackage, dir string) map[string]bool { | |
// handled by ctx.MatchFile. | |
continue | |
} | |
- if pkgName != expectPackage { | |
- if Debug { | |
- log.Printf("scan of dir %v is not expected package %v (actually %v)", dir, expectPackage, pkgName) | |
- } | |
- return nil | |
- } | |
for name := range f.Scope.Objects { | |
if ast.IsExported(name) { | |
exports[name] = true | |
@@ -727,7 +721,11 @@ func findImportGoPath(pkgName string, symbols map[string]bool, filename string) | |
// Find candidate packages, looking only at their directory names first. | |
var candidates []*pkg | |
for _, pkg := range dirScan { | |
- if pkgIsCandidate(filename, pkgName, pkg) { | |
+ name := pkgName | |
+ if strings.HasSuffix(name, "pb") { | |
+ name = name[:len(name)-2] | |
+ } | |
+ if pkgIsCandidate(filename, name, pkg) { | |
candidates = append(candidates, pkg) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment