]> Cypherpunks repositories - gostls13.git/commitdiff
os: use Fstat instead of Stat in FileMode example
authorTaro Aoki <aizu.s1230022@gmail.com>
Sat, 1 Jul 2017 10:13:03 +0000 (19:13 +0900)
committerBrad Fitzpatrick <bradfitz@golang.org>
Sat, 15 Jul 2017 16:46:50 +0000 (16:46 +0000)
The existing example for FileMode using Stat to get FileInfo.
But, Stat cannot get symlink info, it need to use Fstat instead.

Change-Id: I5cc38cd10caaa5912946abe2a2b90995a91ee10f
Reviewed-on: https://go-review.googlesource.com/47370
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

src/os/example_test.go

index d10bab4e1bc98ad55938e66ae1f473278a9eb28b..5749194871b795f6e49cb8b64d799abbc1e2e1b2 100644 (file)
@@ -50,7 +50,7 @@ func ExampleChtimes() {
 }
 
 func ExampleFileMode() {
-       fi, err := os.Stat("some-filename")
+       fi, err := os.Lstat("some-filename")
        if err != nil {
                log.Fatal(err)
        }