path/filepath: WalkDir does not treat "." as equivalent to os.Getwd() #50804
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Unfortunate
Milestone
What version of Go are you using (
go version
)?go1.18-16d6a5233a
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?linux/amd64
via play.golang.org.What did you do?
(https://go.dev/play/p/OLEED5lI02l?v=gotip)
With
PWD
set to a path ending in a symlink to the actual working directory, compare the behavior offilepath.WalkDir
with"."
and with the directory reported byos.Getwd()
.What did you expect to see?
Equivalent behavior for
"."
andos.Getwd()
. Specifically, I expectedfilepath.WalkDir
to report the current working directory as a symlink in both cases.What did you see instead?
os.Chdir
accepts the symlink as valid and changes to the underlying directory. With a matchingPWD
environment variable,os.Getwd()
reports the symlink as the current working directory (as intended since #8400).filepath.WalkDir(cwd, …)
treats the current directory as the symlink itself, and does not list its contents.However,
filepath.WalkDir(".", …)
treats"."
as the underlying directory and walks its contents.The text was updated successfully, but these errors were encountered: