diff options
| author | Michael Stapelberg <stapelberg@debian.org> | 2013-03-04 21:27:36 +0100 | 
|---|---|---|
| committer | Michael Stapelberg <michael@stapelberg.de> | 2013-03-04 21:27:36 +0100 | 
| commit | 04b08da9af0c450d645ab7389d1467308cfc2db8 (patch) | |
| tree | db247935fa4f2f94408edc3acd5d0d4f997aa0d8 /src/cmd/godoc/filesystem.go | |
| parent | 917c5fb8ec48e22459d77e3849e6d388f93d3260 (diff) | |
| download | golang-04b08da9af0c450d645ab7389d1467308cfc2db8.tar.gz | |
Imported Upstream version 1.1~hg20130304upstream/1.1_hg20130304
Diffstat (limited to 'src/cmd/godoc/filesystem.go')
| -rw-r--r-- | src/cmd/godoc/filesystem.go | 10 | 
1 files changed, 4 insertions, 6 deletions
| diff --git a/src/cmd/godoc/filesystem.go b/src/cmd/godoc/filesystem.go index 09d7b2463..0309d7cab 100644 --- a/src/cmd/godoc/filesystem.go +++ b/src/cmd/godoc/filesystem.go @@ -41,7 +41,7 @@ import (  // paths can assume they are slash-separated and should be using  // package path (often imported as pathpkg) to manipulate them,  // even on Windows. -//  +//  var fs = nameSpace{} // the underlying file system for godoc  // Setting debugNS = true will enable debugging prints about @@ -138,7 +138,7 @@ func hasPathPrefix(x, y string) bool {  // but we want to be able to mount multiple file systems on a single  // mount point and have the system behave as if the union of those  // file systems were present at the mount point. -// For example, if the OS file system has a Go installation in  +// For example, if the OS file system has a Go installation in  // c:\Go and additional Go path trees in  d:\Work1 and d:\Work2, then  // this name space creates the view we want for the godoc server:  // @@ -179,7 +179,7 @@ func hasPathPrefix(x, y string) bool {  //	OS(`d:\Work1').ReadDir("/src/code")  //	OS(`d:\Work2').ReadDir("/src/code")  // -// Note that the "/src/pkg" in "/src/pkg/code" has been replaced by  +// Note that the "/src/pkg" in "/src/pkg/code" has been replaced by  // just "/src" in the final two calls.  //  // OS is itself an implementation of a file system: it implements @@ -459,9 +459,7 @@ func (ns nameSpace) ReadDir(path string) ([]os.FileInfo, error) {  		if hasPathPrefix(old, path) && old != path {  			// Find next element after path in old.  			elem := old[len(path):] -			if strings.HasPrefix(elem, "/") { -				elem = elem[1:] -			} +			elem = strings.TrimPrefix(elem, "/")  			if i := strings.Index(elem, "/"); i >= 0 {  				elem = elem[:i]  			} | 
