]> Cypherpunks repositories - gostls13.git/commit
path/filepath: steer people away from HasPrefix
authorRuss Cox <rsc@golang.org>
Wed, 29 Feb 2012 21:37:40 +0000 (16:37 -0500)
committerRuss Cox <rsc@golang.org>
Wed, 29 Feb 2012 21:37:40 +0000 (16:37 -0500)
commitfc268acf05adf5d0437ef1bf80c6e919818fe6ff
tree9d92ebc03fada13c1bbad3105b2e04739b29e9f4
parent8c5290502fc1d7cddf416614aab5d2ad3c1b9b08
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
src/pkg/path/filepath/path_plan9.go
src/pkg/path/filepath/path_unix.go
src/pkg/path/filepath/path_windows.go