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

Side by Side Diff: src/pkg/path/filepath/path.go

Issue 7304043: code review 7304043: path/filepath: document that Walk does not follow symlinks (Closed)
Patch Set: diff -r 1f343d81deab https://code.google.com/p/go/ Created 12 years, 1 month 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:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 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 // Package filepath implements utility routines for manipulating filename paths 5 // Package filepath implements utility routines for manipulating filename paths
6 // in a way compatible with the target operating system-defined file paths. 6 // in a way compatible with the target operating system-defined file paths.
7 package filepath 7 package filepath
8 8
9 import ( 9 import (
10 "errors" 10 "errors"
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 } 367 }
368 } 368 }
369 return nil 369 return nil
370 } 370 }
371 371
372 // Walk walks the file tree rooted at root, calling walkFn for each file or 372 // Walk walks the file tree rooted at root, calling walkFn for each file or
373 // directory in the tree, including root. All errors that arise visiting files 373 // directory in the tree, including root. All errors that arise visiting files
374 // and directories are filtered by walkFn. The files are walked in lexical 374 // and directories are filtered by walkFn. The files are walked in lexical
375 // order, which makes the output deterministic but means that for very 375 // order, which makes the output deterministic but means that for very
376 // large directories Walk can be inefficient. 376 // large directories Walk can be inefficient.
377 // Walk does not follow symbolic links.
377 func Walk(root string, walkFn WalkFunc) error { 378 func Walk(root string, walkFn WalkFunc) error {
378 info, err := os.Lstat(root) 379 info, err := os.Lstat(root)
379 if err != nil { 380 if err != nil {
380 return walkFn(root, nil, err) 381 return walkFn(root, nil, err)
381 } 382 }
382 return walk(root, info, walkFn) 383 return walk(root, info, walkFn)
383 } 384 }
384 385
385 // readDir reads the directory named by dirname and returns 386 // readDir reads the directory named by dirname and returns
386 // a sorted list of directory entries. 387 // a sorted list of directory entries.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 return vol + dir 458 return vol + dir
458 } 459 }
459 460
460 // VolumeName returns leading volume name. 461 // VolumeName returns leading volume name.
461 // Given "C:\foo\bar" it returns "C:" under windows. 462 // Given "C:\foo\bar" it returns "C:" under windows.
462 // Given "\\host\share\foo" it returns "\\host\share". 463 // Given "\\host\share\foo" it returns "\\host\share".
463 // On other platforms it returns "". 464 // On other platforms it returns "".
464 func VolumeName(path string) (v string) { 465 func VolumeName(path string) (v string) {
465 return path[:volumeNameLen(path)] 466 return path[:volumeNameLen(path)]
466 } 467 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

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