-
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: Join documentation is misleading regarding Cleaned #29875
Comments
A bug in the code, but maybe too hard to fix. Might need a documentation fix instead. |
Has this been updated yet? |
No, otherwise the Gerrit change request would be linked with this issue. |
There is actually a test case for path.Join which joins two empty strings and checks the output is an empty string. So not sure if it is a bug.
That is because path.Clean is called only for non-empty strings. Which is what the documentation tries to say. But I agree this part |
@shivi28 - would you like to work on this ? |
There hasn't been a response, so feel free to take it up. |
Change https://golang.org/cl/194339 mentions this issue: |
@erutherford, thanks for the fix; could you also fix I noticed you removed "all empty strings are ignored", is that ok? EDIT: I'm opening a new issue |
As of Go 1.11.4, the documentation of
path.Join
says:Since
Cleaned
is written in uppercase, this suggests thatpath.Clean
is called on the preliminary result ofJoin
. For most cases this is true, but for the case of only empty filenames, it isn't. There,path.Join("")
returns an empty string whilepath.Clean("")
returns dot.See https://play.golang.org/p/rjq7up_HplU.
The text was updated successfully, but these errors were encountered: