Fixes #64375
Change-Id: I24ce67ef254db447cdf37a3fda5b5ab5fc782a36
GitHub-Last-Rev:
05590b9e20b31413d455a6e87bc38843e33ff116
GitHub-Pull-Request: golang/go#64376
Reviewed-on: https://go-review.googlesource.com/c/go/+/544757
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
goBin := testenv.GoToolPath(t)
goroot.once.Do(func() {
- goroot.err = filepath.WalkDir(testenv.GOROOT(t), func(path string, info fs.DirEntry, err error) error {
+ // If the root itself is a symlink to a directory,
+ // we want to follow it (see https://go.dev/issue/64375).
+ // Add a trailing separator to force that to happen.
+ root := testenv.GOROOT(t)
+ if !os.IsPathSeparator(root[len(root)-1]) {
+ root += string(filepath.Separator)
+ }
+ goroot.err = filepath.WalkDir(root, func(path string, info fs.DirEntry, err error) error {
if err != nil {
return err
}