Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1560)

Side by Side Diff: src/pkg/path/filepath/path_unix.go

Issue 5712045: code review 5712045: path/filepath: steer people away from HasPrefix (Closed)
Patch Set: diff -r 37763a8d9c71 https://go.googlecode.com/hg/ Created 12 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pkg/path/filepath/path_plan9.go ('k') | src/pkg/path/filepath/path_windows.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 The Go Authors. All rights reserved. 1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // +build darwin freebsd linux netbsd openbsd 5 // +build darwin freebsd linux netbsd openbsd
6 6
7 package filepath 7 package filepath
8 8
9 import "strings" 9 import "strings"
10 10
11 // IsAbs returns true if the path is absolute. 11 // IsAbs returns true if the path is absolute.
12 func IsAbs(path string) bool { 12 func IsAbs(path string) bool {
13 return strings.HasPrefix(path, "/") 13 return strings.HasPrefix(path, "/")
14 } 14 }
15 15
16 // VolumeName returns the leading volume name on Windows. 16 // VolumeName returns the leading volume name on Windows.
17 // It returns "" elsewhere. 17 // It returns "" elsewhere.
18 func VolumeName(path string) string { 18 func VolumeName(path string) string {
19 return "" 19 return ""
20 } 20 }
21 21
22 // HasPrefix tests whether the path p begins with prefix. 22 // HasPrefix exists for historical compatibility and should not be used.
23 func HasPrefix(p, prefix string) bool { 23 func HasPrefix(p, prefix string) bool {
24 return strings.HasPrefix(p, prefix) 24 return strings.HasPrefix(p, prefix)
25 } 25 }
OLDNEW
« no previous file with comments | « src/pkg/path/filepath/path_plan9.go ('k') | src/pkg/path/filepath/path_windows.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b