]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/go: traverse module-root symlinks in Walk calls
authorBryan C. Mills <bcmills@google.com>
Fri, 13 Jan 2023 18:59:19 +0000 (13:59 -0500)
committerGopher Robot <gobot@golang.org>
Tue, 31 Jan 2023 20:33:05 +0000 (20:33 +0000)
commitf36c7c5983e039e36e187d7fcd7e7e5a1aa2d74f
tree3e57f57870a77ae109c3c5ab277fe13bea088abf
parent5f00ce86334aa7e80ab825882db1a080f1b56404
cmd/go: traverse module-root symlinks in Walk calls

fsys.Walk, like filepath.Walk, avoids traversing symlinks. Also like
filepath.Walk, it follows a symlink at the root if the root path ends
in a file separator (consistent with POSIX pathname resolution¹).

If the user's working directory is within a repository stored in
(and symlinked to) a different filesystem path, we want to follow the
symlink instead of treating the module as completely empty.

¹https://pubs.opengroup.org/onlinepubs/9699919799.2013edition/basedefs/V1_chap04.html#tag_04_12

Fixes #50807.
Updates #57754.

Change-Id: Idaf6168dfffafe879e05b4ded5fda287fcd3eeec
Reviewed-on: https://go-review.googlesource.com/c/go/+/463179
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
src/cmd/go/internal/fsys/fsys.go
src/cmd/go/internal/fsys/fsys_test.go
src/cmd/go/internal/modindex/scan.go
src/cmd/go/internal/modload/search.go
src/cmd/go/internal/search/search.go
src/cmd/go/internal/workcmd/use.go
src/cmd/go/testdata/script/list_goroot_symlink.txt
src/cmd/go/testdata/script/list_symlink_dotdotdot.txt [new file with mode: 0644]