Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit 5bdff0f

Browse files
authored
Merge pull request #363 from smowton/smowton/fix/use-realpath-for-gopath
Autobuilder: Use fully resolved path for GOPATH
2 parents e871061 + 6b6c862 commit 5bdff0f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

extractor/cli/go-autobuilder/go-autobuilder.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,15 @@ func main() {
350350
}
351351

352352
// create a new folder which we will add to GOPATH below
353-
root := filepath.Join(srcdir, "root")
353+
// Note we evaluate all symlinks here for consistency: otherwise os.Chdir below
354+
// will follow links but other references to the path may not, which can lead to
355+
// disagreements between GOPATH and the working directory.
356+
realSrc, err := filepath.EvalSymlinks(srcdir)
357+
if err != nil {
358+
log.Fatalf("Failed to evaluate symlinks in %s: %s\n", srcdir, err.Error())
359+
}
360+
361+
root := filepath.Join(realSrc, "root")
354362

355363
// move source files to where Go expects them to be
356364
newdir := filepath.Join(root, "src", importpath)

0 commit comments

Comments
 (0)