LEFT | RIGHT |
(no file at all) | |
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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 m[filename] = true | 161 m[filename] = true |
162 } | 162 } |
163 | 163 |
164 // Make list of files | 164 // Make list of files |
165 cw.File = make([]string, len(m)) | 165 cw.File = make([]string, len(m)) |
166 i := 0 | 166 i := 0 |
167 for f := range m { | 167 for f := range m { |
168 cw.File[i] = f | 168 cw.File[i] = f |
169 i++ | 169 i++ |
170 } | 170 } |
171 » sort.SortStrings(cw.File) | 171 » sort.Strings(cw.File) |
172 | 172 |
173 return cw, nil | 173 return cw, nil |
174 } | 174 } |
175 | 175 |
176 | 176 |
177 // codewalkDir serves the codewalk directory listing. | 177 // codewalkDir serves the codewalk directory listing. |
178 // It scans the directory for subdirectories or files named *.xml | 178 // It scans the directory for subdirectories or files named *.xml |
179 // and prepares a table. | 179 // and prepares a table. |
180 func codewalkDir(w http.ResponseWriter, r *http.Request, relpath, abspath string
) { | 180 func codewalkDir(w http.ResponseWriter, r *http.Request, relpath, abspath string
) { |
181 type elem struct { | 181 type elem struct { |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 for j, c := range data { | 490 for j, c := range data { |
491 if j == i { | 491 if j == i { |
492 return l | 492 return l |
493 } | 493 } |
494 if c == '\n' { | 494 if c == '\n' { |
495 l++ | 495 l++ |
496 } | 496 } |
497 } | 497 } |
498 return l | 498 return l |
499 } | 499 } |
LEFT | RIGHT |