]> Cypherpunks repositories - gostls13.git/commitdiff
os: remove executable bits from os.OpenFile example
authorRami <72725910+ramikg@users.noreply.github.com>
Sun, 16 Jul 2023 10:25:40 +0000 (10:25 +0000)
committerGopher Robot <gobot@golang.org>
Thu, 20 Jul 2023 17:30:18 +0000 (17:30 +0000)
The mode used in the os.OpenFile example (0755) has all executable bits set.
I suspect that this ill-advised usage propagates to other codebases (by means of people carelessly copying the usage example), which is why I suggest modifying the example.

Change-Id: Ic36c8b41974f3fe00471822c2414e36b4e5dc1bc
GitHub-Last-Rev: 638f3beefe8926c8e5c2c4ab9a1a5899e55de892
GitHub-Pull-Request: golang/go#61384
Reviewed-on: https://go-review.googlesource.com/c/go/+/510135
Reviewed-by: Rob Pike <r@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/os/example_test.go

index 5c7c6eac87da1066ae4ab82ad21d7d1e81a3817e..e9657ed1fcfe42f6a035571c948e09bdb331868b 100644 (file)
@@ -15,7 +15,7 @@ import (
 )
 
 func ExampleOpenFile() {
-       f, err := os.OpenFile("notes.txt", os.O_RDWR|os.O_CREATE, 0755)
+       f, err := os.OpenFile("notes.txt", os.O_RDWR|os.O_CREATE, 0644)
        if err != nil {
                log.Fatal(err)
        }