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

« back to all changes in this revision

Viewing changes to src/cmd/godoc/index.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:
45
45
        "go/token"
46
46
        "go/scanner"
47
47
        "index/suffixarray"
48
 
        "io/ioutil"
49
48
        "os"
50
49
        "path/filepath"
51
50
        "regexp"
624
623
// failed (that is, if the file was not added), it returns file == nil.
625
624
func (x *Indexer) addFile(filename string, goFile bool) (file *token.File, ast *ast.File) {
626
625
        // open file
627
 
        f, err := os.Open(filename)
 
626
        f, err := fs.Open(filename)
628
627
        if err != nil {
629
628
                return
630
629
        }
727
726
}
728
727
 
729
728
 
730
 
func (x *Indexer) visitFile(dirname string, f *os.FileInfo, fulltextIndex bool) {
 
729
func (x *Indexer) visitFile(dirname string, f FileInfo, fulltextIndex bool) {
731
730
        if !f.IsRegular() {
732
731
                return
733
732
        }
734
733
 
735
 
        filename := filepath.Join(dirname, f.Name)
 
734
        filename := filepath.Join(dirname, f.Name())
736
735
        goFile := false
737
736
 
738
737
        switch {
745
744
                }
746
745
                goFile = true
747
746
 
748
 
        case !fulltextIndex || !isWhitelisted(f.Name):
 
747
        case !fulltextIndex || !isWhitelisted(f.Name()):
749
748
                return
750
749
        }
751
750
 
804
803
 
805
804
        // index all files in the directories given by dirnames
806
805
        for dirname := range dirnames {
807
 
                list, err := ioutil.ReadDir(dirname)
 
806
                list, err := fs.ReadDir(dirname)
808
807
                if err != nil {
809
808
                        continue // ignore this directory
810
809
                }
902
901
// identifier, Lookup returns a LookupResult, and a list of alternative
903
902
// spellings, if any. If the query syntax is wrong, an error is reported.
904
903
func (x *Index) Lookup(query string) (match *LookupResult, alt *AltWords, err os.Error) {
905
 
        ss := strings.Split(query, ".", -1)
 
904
        ss := strings.Split(query, ".")
906
905
 
907
906
        // check query syntax
908
907
        for _, s := range ss {
955
954
 
956
955
// unique returns the list sorted and with duplicate entries removed
957
956
func unique(list []int) []int {
958
 
        sort.SortInts(list)
 
957
        sort.Ints(list)
959
958
        var last int
960
959
        i := 0
961
960
        for _, x := range list {