Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(62)

Delta Between Two Patch Sets: src/cmd/godoc/codewalk.go

Issue 5416060: code review 5416060: io: new FileInfo, FileMode types + update tree (Closed)
Left Patch Set: diff -r 0c75ae21c217 https://go.googlecode.com/hg/ Created 13 years, 4 months ago
Right Patch Set: diff -r d917a203b389 https://go.googlecode.com/hg/ Created 13 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « misc/dashboard/builder/package.go ('k') | src/cmd/godoc/dirtrees.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2010 The Go Authors. All rights reserved. 1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // The /doc/codewalk/ tree is synthesized from codewalk descriptions, 5 // The /doc/codewalk/ tree is synthesized from codewalk descriptions,
6 // files named $GOROOT/doc/codewalk/*.xml. 6 // files named $GOROOT/doc/codewalk/*.xml.
7 // For an example and a description of the format, see 7 // For an example and a description of the format, see
8 // http://golang.org/doc/codewalk/codewalk or run godoc -http=:6060 8 // http://golang.org/doc/codewalk/codewalk or run godoc -http=:6060
9 // and see http://localhost:6060/doc/codewalk/codewalk . 9 // and see http://localhost:6060/doc/codewalk/codewalk .
10 // That page is itself a codewalk; the source code for it is 10 // That page is itself a codewalk; the source code for it is
(...skipping 23 matching lines...) Expand all
34 abspath := absolutePath(r.URL.Path[1:], *goroot) 34 abspath := absolutePath(r.URL.Path[1:], *goroot)
35 35
36 r.ParseForm() 36 r.ParseForm()
37 if f := r.FormValue("fileprint"); f != "" { 37 if f := r.FormValue("fileprint"); f != "" {
38 codewalkFileprint(w, r, f) 38 codewalkFileprint(w, r, f)
39 return 39 return
40 } 40 }
41 41
42 // If directory exists, serve list of code walks. 42 // If directory exists, serve list of code walks.
43 dir, err := fs.Lstat(abspath) 43 dir, err := fs.Lstat(abspath)
44 » if err == nil && dir.Mode().IsDir() { 44 » if err == nil && dir.IsDir() {
45 codewalkDir(w, r, relpath, abspath) 45 codewalkDir(w, r, relpath, abspath)
46 return 46 return
47 } 47 }
48 48
49 // If file exists, serve using standard file server. 49 // If file exists, serve using standard file server.
50 if err == nil { 50 if err == nil {
51 serveFile(w, r) 51 serveFile(w, r)
52 return 52 return
53 } 53 }
54 54
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 dir, err := fs.ReadDir(abspath) 180 dir, err := fs.ReadDir(abspath)
181 if err != nil { 181 if err != nil {
182 log.Print(err) 182 log.Print(err)
183 serveError(w, r, relpath, err) 183 serveError(w, r, relpath, err)
184 return 184 return
185 } 185 }
186 var v []interface{} 186 var v []interface{}
187 for _, fi := range dir { 187 for _, fi := range dir {
188 name := fi.Name() 188 name := fi.Name()
189 » » if fi.Mode().IsDir() { 189 » » if fi.IsDir() {
190 v = append(v, &elem{name + "/", ""}) 190 v = append(v, &elem{name + "/", ""})
191 } else if strings.HasSuffix(name, ".xml") { 191 } else if strings.HasSuffix(name, ".xml") {
192 cw, err := loadCodewalk(abspath + "/" + name) 192 cw, err := loadCodewalk(abspath + "/" + name)
193 if err != nil { 193 if err != nil {
194 continue 194 continue
195 } 195 }
196 v = append(v, &elem{name[0 : len(name)-len(".xml")], cw. Title}) 196 v = append(v, &elem{name[0 : len(name)-len(".xml")], cw. Title})
197 } 197 }
198 } 198 }
199 199
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 for j, c := range data { 478 for j, c := range data {
479 if j == i { 479 if j == i {
480 return l 480 return l
481 } 481 }
482 if c == '\n' { 482 if c == '\n' {
483 l++ 483 l++
484 } 484 }
485 } 485 }
486 return l 486 return l
487 } 487 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b