aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2010-02-11 13:59:10 -0800
committerRobert Griesemer <gri@golang.org>2010-02-11 13:59:10 -0800
commita75ebe192ecf20f4f3f4d53e9d04eafe6fddbf31 (patch)
treec96528b607fc088bbf3c2610d22ef0210af5a206
parenta91fa9d52ea0bbcf4fbb712eb522976a75a18121 (diff)
downloadgo-a75ebe192ecf20f4f3f4d53e9d04eafe6fddbf31.tar.gz
go-a75ebe192ecf20f4f3f4d53e9d04eafe6fddbf31.zip
correct meaning of "absolute" and "relative"
(implementation was swapped) R=adg CC=golang-dev, rsc https://golang.org/cl/207069
-rw-r--r--src/cmd/godoc/mapping.go30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/cmd/godoc/mapping.go b/src/cmd/godoc/mapping.go
index 62f85a0747..1143a4bdc0 100644
--- a/src/cmd/godoc/mapping.go
+++ b/src/cmd/godoc/mapping.go
@@ -141,21 +141,6 @@ func split(path string) (head, tail string) {
// string is returned.
//
func (m *Mapping) ToAbsolute(path string) string {
- for _, e := range m.list {
- if strings.HasPrefix(path, e.path) {
- // /absolute/prefix/foo -> prefix/foo
- return pathutil.Join(e.prefix, path[len(e.path):]) // Join will remove a trailing '/'
- }
- }
- return "" // no match
-}
-
-
-// ToRelative maps an absolute path to a relative path using the Mapping
-// specified by the receiver. If the path cannot be mapped, the empty
-// string is returned.
-//
-func (m *Mapping) ToRelative(path string) string {
prefix, tail := split(path)
for _, e := range m.list {
switch {
@@ -174,3 +159,18 @@ func (m *Mapping) ToRelative(path string) string {
return "" // no match
}
+
+
+// ToRelative maps an absolute path to a relative path using the Mapping
+// specified by the receiver. If the path cannot be mapped, the empty
+// string is returned.
+//
+func (m *Mapping) ToRelative(path string) string {
+ for _, e := range m.list {
+ if strings.HasPrefix(path, e.path) {
+ // /absolute/prefix/foo -> prefix/foo
+ return pathutil.Join(e.prefix, path[len(e.path):]) // Join will remove a trailing '/'
+ }
+ }
+ return "" // no match
+}