mirror of https://github.com/golang/go.git
os: don't check for IsExist in MkdirAll example
If a directory already exists, then MkdirAll returns nil. Therefore the
check with IsExist is not necessary.
Change-Id: Idf83c056f64bb56f49eb2b649af7827b759bcd7c
GitHub-Last-Rev: 1f29873d0c
GitHub-Pull-Request: golang/go#53242
Reviewed-on: https://go-review.googlesource.com/c/go/+/410434
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
b431277da8
commit
fde1b139be
|
|
@ -255,7 +255,7 @@ func ExampleMkdir() {
|
|||
|
||||
func ExampleMkdirAll() {
|
||||
err := os.MkdirAll("test/subdir", 0750)
|
||||
if err != nil && !os.IsExist(err) {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
err = os.WriteFile("test/subdir/testfile.txt", []byte("Hello, Gophers!"), 0660)
|
||||
|
|
|
|||
Loading…
Reference in New Issue