Skip to content

Commit

Permalink
Revert "Stage Go sources in a directory named after the package."
Browse files Browse the repository at this point in the history
This reverts commit 18a0557.
  • Loading branch information
RaduBerinde committed Jan 14, 2022
1 parent 1ce9e34 commit 0259fe0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
9 changes: 2 additions & 7 deletions go/tools/builders/cgo2.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,19 +204,14 @@ func cgo2(goenv *env, goSrcs, cgoSrcs, cSrcs, cxxSrcs, objcSrcs, objcxxSrcs, sSr

// Copy regular Go source files into the work directory so that we can
// use -trimpath=workDir.
subDir := filepath.Join(workDir, packagePath)
err = os.MkdirAll(subDir, 0755)
if err != nil {
return "", nil, nil, err
}
goBases, err := gatherSrcs(subDir, goSrcs)
goBases, err := gatherSrcs(workDir, goSrcs)
if err != nil {
return "", nil, nil, err
}

allGoSrcs = make([]string, len(goSrcs)+len(genGoSrcs))
for i := range goSrcs {
allGoSrcs[i] = filepath.Join(subDir, goBases[i])
allGoSrcs[i] = filepath.Join(workDir, goBases[i])
}
copy(allGoSrcs[len(goSrcs):], genGoSrcs)
return workDir, allGoSrcs, cObjs, nil
Expand Down
11 changes: 1 addition & 10 deletions go/tools/builders/compilepkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,16 +284,7 @@ func compileArchive(
return err
}
}
subDir := filepath.Join(workDir, packagePath)
err := os.MkdirAll(subDir, 0755)
if err != nil {
return err
}
goBases, err := gatherSrcs(subDir, goSrcs)
for i, base := range goBases {
goSrcs[i] = filepath.Join(subDir, base)
}
gcFlags = append(gcFlags, "-trimpath="+workDir)
gcFlags = append(gcFlags, "-trimpath=.")
}

// Check that the filtered sources don't import anything outside of
Expand Down

0 comments on commit 0259fe0

Please sign in to comment.