Skip to content
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/filepath: rename func VolumeName(path string) string #40158

Open
ericwj opened this issue Jul 10, 2020 · 3 comments
Open

path/filepath: rename func VolumeName(path string) string #40158

ericwj opened this issue Jul 10, 2020 · 3 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@ericwj
Copy link

ericwj commented Jul 10, 2020

What version of Go are you using (go version)?

$ go version
1..14.4

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

Operating system and architecture independent.

What did you do?

Read the docs.

What did you expect to see?

func VolumeRoot(path string) string

or something similar that reflects what VolumeName actually returns.

-or-

Documentation to the effect that VolumeName in fact returns a volume name.

A volume name on Windows is also known as a volume label.

What did you see instead?

The function certainly does not return a volume name, hence either the name or its behavior and documentation are wrong.

Having VolumeName("C:\A") return "C:" is confusing and inconsistent. It could also be considered wrong, since "C:" is a relative path which would resolve to %CD% or C:. and Abs is also documented to never return C: for probably this reason. However this issue is about the function returning a path, not a name, as one would not be overly unjustified expect.

@ianlancetaylor
Copy link
Contributor

We can update the docs, but we can't rename the function, because of the Go 1 compatibility guarantee (https://golang.org/doc/go1compat).

@ericwj
Copy link
Author

ericwj commented Jul 10, 2020

Just punt it, I'm fine with that - I don't write go.

Try googling with Bing for Windows related stuff - seriously, the result are absolutely primary e.g. for 'volume name':

  1. What Is a Volume Label of a Drive? - Lifewire.
  2. How to Find a Drive's Volume Label or Serial Number
  3. Naming a Volume - Win32 apps | Microsoft Docs

@alexbrainman
Copy link
Member

VolumeName also works with UNC paths. See

https://golang.org/pkg/path/filepath/#VolumeName

for details.

Whatever this function does, we cannot change its name (as Ian explained).

Alex

@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 11, 2020
@dmitshur dmitshur added this to the Backlog milestone Jul 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants