|
6 | 6 | // A file system can be provided by the host operating system
|
7 | 7 | // but also by other packages.
|
8 | 8 | //
|
| 9 | +// # Path Names |
| 10 | +// |
| 11 | +// The interfaces in this package all operate on the same |
| 12 | +// path name syntax, regardless of the host operating system. |
| 13 | +// |
| 14 | +// Path names are UTF-8-encoded, |
| 15 | +// unrooted, slash-separated sequences of path elements, like “x/y/z”. |
| 16 | +// Path names must not contain an element that is “.” or “..” or the empty string, |
| 17 | +// except for the special case that the name "." may be used for the root directory. |
| 18 | +// Paths must not start or end with a slash: “/x” and “x/” are invalid. |
| 19 | +// |
| 20 | +// # Testing |
| 21 | +// |
9 | 22 | // See the [testing/fstest] package for support with testing
|
10 | 23 | // implementations of file systems.
|
11 | 24 | package fs
|
@@ -41,16 +54,13 @@ type FS interface {
|
41 | 54 | // ValidPath reports whether the given path name
|
42 | 55 | // is valid for use in a call to Open.
|
43 | 56 | //
|
44 |
| -// Path names passed to open are UTF-8-encoded, |
45 |
| -// unrooted, slash-separated sequences of path elements, like “x/y/z”. |
46 |
| -// Path names must not contain an element that is “.” or “..” or the empty string, |
47 |
| -// except for the special case that the name "." may be used for the root directory. |
48 |
| -// Paths must not start or end with a slash: “/x” and “x/” are invalid. |
49 |
| -// |
50 | 57 | // Note that paths are slash-separated on all systems, even Windows.
|
51 | 58 | // Paths containing other characters such as backslash and colon
|
52 | 59 | // are accepted as valid, but those characters must never be
|
53 | 60 | // interpreted by an [FS] implementation as path element separators.
|
| 61 | +// See the [Path Names] section for more details. |
| 62 | +// |
| 63 | +// [Path Names]: https://pkg.go.dev/io/fs#hdr-Path_Names |
54 | 64 | func ValidPath(name string) bool {
|
55 | 65 | if !utf8.ValidString(name) {
|
56 | 66 | return false
|
|
0 commit comments