Skip to content

Commit b438285

Browse files
committed
Fallback to package dir for discovering go.mod
This reverts to the old behavior of reusing the package directory when looking for go.mod. It seems unlikely that this is the right thing to do since we failed to find the module directory, but this behavior should be consistent with what we had before.
1 parent b471926 commit b438285

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

go/extractor/extractor.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,12 @@ func ExtractWithFlags(buildFlags []string, patterns []string) error {
186186

187187
extraction.extractPackage(pkg)
188188

189-
if pkgInfo.ModDir != "" {
190-
modPath := filepath.Join(pkgInfo.ModDir, "go.mod")
189+
modDir := pkgInfo.ModDir
190+
if modDir == "" {
191+
modDir = pkgInfo.PkgDir
192+
}
193+
if modDir != "" {
194+
modPath := filepath.Join(modDir, "go.mod")
191195
if util.FileExists(modPath) {
192196
log.Printf("Extracting %s", modPath)
193197
start := time.Now()

0 commit comments

Comments
 (0)