-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
path: path.Clean should not remove the last slash of a path #59904
Comments
Working as intended. If clean was a no-op, it wouldn't need to exist. |
@seankhliao How do you know if the path represents a path to a directory or to a file? trailing slashes have that meaning, right? if you said that |
nothing stops a directory from being called file.jpeg |
@seankhliao don't you think trailing slashes have a meaning? files will not have trailing slashes right? |
@stephane-archer At this time we aren't going to change the behavior of |
@ianlancetaylor It's strange that |
It seems to me that your point about |
I’m not sure if you notice but the function is named "Dir" not "Parent",
maybe you should consider rename the function or give this function the
behavior of its name.
Le jeu. 4 mai 2023 à 17:39, Ian Lance Taylor ***@***.***> a
écrit :
It seems to me that your point about path.Dir doesn't hold if we assume
that paths should normally not have trailing slashes. It's true that
path.Dir("a/") returns "a", but that's only because of the unexpected
trailing slash. path.Dir is not supposed to return a directory if the
path refers to a directory; it's supposed to return the parent directory of
whatever it is given, so that path.Dir("a") returns ".".
—
Reply to this email directly, view it on GitHub
<#59904 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAWX4PNBUPT2MVWF772VBY3XEQOXPANCNFSM6AAAAAAXRA3HBI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Best Regards,
Stephane Archer
|
Whether it was a mistake or not, we can't change it now, or we would break the Go 1 compatibility guarantee: https://go.dev/doc/go1compat. |
path.Clean
should not remove the last slash of a path otherwise the rest of thepath
library doesn't have the appropriate behaviorThe text was updated successfully, but these errors were encountered: