We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents a03ef64 + 2bc79cd commit 845aad1Copy full SHA for 845aad1
cmd/main.go
@@ -80,7 +80,11 @@ func findCurrentRepo() (string, error) {
80
Mode: packages.NeedName, // name gives us path as well
81
}
82
pkgs, err := packages.Load(pkgCfg, ".")
83
- if err == nil && len(pkgs) > 0 {
+ // NB(directxman12): when go modules are off and we're outside GOPATH and
84
+ // we don't otherwise have a good guess packages.Load will fabricate a path
85
+ // that consists of `_/absolute/path/to/current/directory`. We shouldn't
86
+ // use that when it happens.
87
+ if err == nil && len(pkgs) > 0 && len(pkgs[0].PkgPath) > 0 && pkgs[0].PkgPath[0] != '_' {
88
return pkgs[0].PkgPath, nil
89
90
0 commit comments