In the Go programming language, to get the volume name from the given path – we use the VolumeName() function of path/filepath package. The VolumeName() function returns the leading volume name.
For Example, given "C:\foo\bar" it returns "C:" on Windows. Given "\\host\share\foo" it returns "\\host\share". On other platforms it returns "".
Syntax:
Consider the below Golang program demonstrating how to get the volume name from a path?
Output
need an explanation for this answer? contact us directly to get an explanation for this answer