Skip to content

path/filepath: clarify VolumeName returns a path not a name #40158

Open
@ericwj

Description

@ericwj

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions