aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/path/filepath
diff options
context:
space:
mode:
authorAlex Brainman <alex.brainman@gmail.com>2012-03-23 15:57:19 +1100
committerAlex Brainman <alex.brainman@gmail.com>2012-03-23 15:57:19 +1100
commitf39ff80beaab4b366917575e5addcbdd551563c2 (patch)
tree22196edbf5bd8173fbf80312f62e73f824d4d3a7 /src/pkg/path/filepath
parentd420be5b1c03dd4d7791062ae50c37fb0aa529d6 (diff)
downloadgo-f39ff80beaab4b366917575e5addcbdd551563c2.tar.xz
path/filepath: windows drive letter cannot be a digit
R=golang-dev, r CC=golang-dev, mattn.jp https://golang.org/cl/5885056
Diffstat (limited to 'src/pkg/path/filepath')
-rw-r--r--src/pkg/path/filepath/path_test.go1
-rw-r--r--src/pkg/path/filepath/path_windows.go4
2 files changed, 2 insertions, 3 deletions
diff --git a/src/pkg/path/filepath/path_test.go b/src/pkg/path/filepath/path_test.go
index 87cb5e5530..2aba553d23 100644
--- a/src/pkg/path/filepath/path_test.go
+++ b/src/pkg/path/filepath/path_test.go
@@ -814,6 +814,7 @@ type VolumeNameTest struct {
var volumenametests = []VolumeNameTest{
{`c:/foo/bar`, `c:`},
{`c:`, `c:`},
+ {`2:`, ``},
{``, ``},
{`\\\host`, ``},
{`\\\host\`, ``},
diff --git a/src/pkg/path/filepath/path_windows.go b/src/pkg/path/filepath/path_windows.go
index 1d1d23bfe7..3dcd030219 100644
--- a/src/pkg/path/filepath/path_windows.go
+++ b/src/pkg/path/filepath/path_windows.go
@@ -35,9 +35,7 @@ func VolumeName(path string) (v string) {
}
// with drive letter
c := path[0]
- if path[1] == ':' &&
- ('0' <= c && c <= '9' || 'a' <= c && c <= 'z' ||
- 'A' <= c && c <= 'Z') {
+ if path[1] == ':' && ('a' <= c && c <= 'z' || 'A' <= c && c <= 'Z') {
return path[:2]
}
// is it UNC