~john-koepi/ubuntu/trusty/golang/default

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Ondřej Surý
  • Date: 2011-08-03 17:04:59 UTC
  • mfrom: (14.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110803170459-wzd99m3567y80ila
Tags: 1:59-1
* Imported Upstream version 59
* Refresh patches to a new release
* Fix FTBFS on ARM (Closes: #634270)
* Update version.bash to work with Debian packaging and not hg
  repository

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
import (
10
10
        "fmt"
11
11
        "io"
12
 
        "os"
13
12
        "path"
14
13
        "path/filepath"
15
14
        "sort"
60
59
}
61
60
 
62
61
 
63
 
// Init initializes the Mapping from a list of paths separated by
64
 
// filepath.ListSeparator. Empty paths are ignored; relative paths
65
 
// are assumed to be relative to the current working directory and
66
 
// converted to absolute paths. For each path of the form:
 
62
// Init initializes the Mapping from a list of paths.
 
63
// Empty paths are ignored; relative paths are assumed to be relative to
 
64
// the current working directory and converted to absolute paths.
 
65
// For each path of the form:
67
66
//
68
67
//      dirname/localname
69
68
//
81
80
//      user   -> /home/user
82
81
//      public -> /home/build/public
83
82
//
84
 
func (m *Mapping) Init(paths string) {
85
 
        pathlist := canonicalizePaths(filepath.SplitList(paths), nil)
 
83
func (m *Mapping) Init(paths []string) {
 
84
        pathlist := canonicalizePaths(paths, nil)
86
85
        list := make([]mapping, len(pathlist))
87
86
 
88
87
        // create mapping list
121
120
                }
122
121
 
123
122
                // sort the list and remove duplicate entries
124
 
                sort.SortStrings(list)
 
123
                sort.Strings(list)
125
124
                i := 0
126
125
                prev := ""
127
126
                for _, path := range list {
174
173
                        continue // no match
175
174
                }
176
175
                abspath := filepath.Join(e.path, tail)
177
 
                if _, err := os.Stat(abspath); err == nil {
 
176
                if _, err := fs.Stat(abspath); err == nil {
178
177
                        return abspath
179
178
                }
180
179
        }