diff options
| author | Mostyn Bramley-Moore <mostyn@antipode.se> | 2018-07-04 23:32:59 +0200 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2018-07-17 21:26:47 +0000 |
| commit | 940811922fb528fabda91a2b2dbb401a06aeb1b3 (patch) | |
| tree | 3d88aa32532ecbe5b484a029eeb15074286488b9 /src/path/filepath/example_unix_test.go | |
| parent | a80a7f0e77fab42cebe61c43b98e0959b740def2 (diff) | |
| download | go-940811922fb528fabda91a2b2dbb401a06aeb1b3.tar.xz | |
path/filepath: make Walk example runnable in the playground
Relates to #9679
Change-Id: I68951f664d2a03812dae309c580c181869d8af21
Reviewed-on: https://go-review.googlesource.com/122237
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/path/filepath/example_unix_test.go')
| -rw-r--r-- | src/path/filepath/example_unix_test.go | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/src/path/filepath/example_unix_test.go b/src/path/filepath/example_unix_test.go index fe49c12d8d..cd8233ceb6 100644 --- a/src/path/filepath/example_unix_test.go +++ b/src/path/filepath/example_unix_test.go @@ -8,7 +8,6 @@ package filepath_test import ( "fmt" - "os" "path/filepath" ) @@ -80,25 +79,3 @@ func ExampleJoin() { // a/b/c // a/b/c } - -func ExampleWalk() { - dir := "dir/to/walk" - subDirToSkip := "skip" // dir/to/walk/skip - - err := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error { - if err != nil { - fmt.Printf("prevent panic by handling failure accessing a path %q: %v\n", path, err) - return err - } - if info.IsDir() && info.Name() == subDirToSkip { - fmt.Printf("skipping a dir without errors: %+v \n", info.Name()) - return filepath.SkipDir - } - fmt.Printf("visited file: %q\n", path) - return nil - }) - - if err != nil { - fmt.Printf("error walking the path %q: %v\n", dir, err) - } -} |
