~ubuntu-branches/ubuntu/saucy/golang/saucy

« back to all changes in this revision

Viewing changes to src/cmd/godoc/filesystem.go

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2013-07-08 05:52:37 UTC
  • mfrom: (29.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20130708055237-at01839e0hp8z3ni
Tags: 2:1.1-1ubuntu1
016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
// paths can assume they are slash-separated and should be using
42
42
// package path (often imported as pathpkg) to manipulate them,
43
43
// even on Windows.
44
 
// 
 
44
//
45
45
var fs = nameSpace{} // the underlying file system for godoc
46
46
 
47
47
// Setting debugNS = true will enable debugging prints about
153
153
// but we want to be able to mount multiple file systems on a single
154
154
// mount point and have the system behave as if the union of those
155
155
// file systems were present at the mount point.
156
 
// For example, if the OS file system has a Go installation in 
 
156
// For example, if the OS file system has a Go installation in
157
157
// c:\Go and additional Go path trees in  d:\Work1 and d:\Work2, then
158
158
// this name space creates the view we want for the godoc server:
159
159
//
194
194
//      OS(`d:\Work1').ReadDir("/src/code")
195
195
//      OS(`d:\Work2').ReadDir("/src/code")
196
196
//
197
 
// Note that the "/src/pkg" in "/src/pkg/code" has been replaced by 
 
197
// Note that the "/src/pkg" in "/src/pkg/code" has been replaced by
198
198
// just "/src" in the final two calls.
199
199
//
200
200
// OS is itself an implementation of a file system: it implements
474
474
                if hasPathPrefix(old, path) && old != path {
475
475
                        // Find next element after path in old.
476
476
                        elem := old[len(path):]
477
 
                        if strings.HasPrefix(elem, "/") {
478
 
                                elem = elem[1:]
479
 
                        }
 
477
                        elem = strings.TrimPrefix(elem, "/")
480
478
                        if i := strings.Index(elem, "/"); i >= 0 {
481
479
                                elem = elem[:i]
482
480
                        }