diff options
| author | Russ Cox <rsc@golang.org> | 2012-02-29 16:37:40 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2012-02-29 16:37:40 -0500 |
| commit | fc268acf05adf5d0437ef1bf80c6e919818fe6ff (patch) | |
| tree | 9d92ebc03fada13c1bbad3105b2e04739b29e9f4 /src/pkg/path/filepath/path_plan9.go | |
| parent | 8c5290502fc1d7cddf416614aab5d2ad3c1b9b08 (diff) | |
| download | go-fc268acf05adf5d0437ef1bf80c6e919818fe6ff.tar.xz | |
path/filepath: steer people away from HasPrefix
The strikes against it are:
1. It does not take path boundaries into account.
2. It assumes that Windows==case-insensitive file system
and non-Windows==case-sensitive file system, neither of
which is always true.
3. Comparing ToLower against ToLower is not a correct
implementation of a case-insensitive string comparison.
4. If it returns true on Windows you still don't know how long
the matching prefix is in bytes, so you can't compute what
the suffix is.
R=golang-dev, r, dsymonds, r
CC=golang-dev
https://golang.org/cl/5712045
Diffstat (limited to 'src/pkg/path/filepath/path_plan9.go')
| -rw-r--r-- | src/pkg/path/filepath/path_plan9.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pkg/path/filepath/path_plan9.go b/src/pkg/path/filepath/path_plan9.go index 17b873f1a9..cf028a75c5 100644 --- a/src/pkg/path/filepath/path_plan9.go +++ b/src/pkg/path/filepath/path_plan9.go @@ -17,7 +17,7 @@ func VolumeName(path string) string { return "" } -// HasPrefix tests whether the path p begins with prefix. +// HasPrefix exists for historical compatibility and should not be used. func HasPrefix(p, prefix string) bool { return strings.HasPrefix(p, prefix) } |
