mirror of
https://github.com/golang/go
synced 2024-11-21 10:14:39 -07:00
effective go: update to new Open signature.
Fixes #1788. R=rsc, adg CC=golang-dev https://golang.org/cl/4519042
This commit is contained in:
parent
8bf1515825
commit
121b428a7a
@ -504,7 +504,7 @@ the body ends in <code>break</code>, <code>continue</code>,
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
f, err := os.Open(name, os.O_RDONLY, 0)
|
||||
f, err := os.Open(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -520,7 +520,7 @@ statements, the resulting code needs no <code>else</code> statements.
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
f, err := os.Open(name, os.O_RDONLY, 0)
|
||||
f, err := os.Open(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -813,7 +813,7 @@ canonical examples are unlocking a mutex or closing a file.
|
||||
<pre>
|
||||
// Contents returns the file's contents as a string.
|
||||
func Contents(filename string) (string, os.Error) {
|
||||
f, err := os.Open(filename, os.O_RDONLY, 0)
|
||||
f, err := os.Open(filename)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@ -2675,7 +2675,7 @@ field for recoverable failures.
|
||||
|
||||
<pre>
|
||||
for try := 0; try < 2; try++ {
|
||||
file, err = os.Open(filename, os.O_RDONLY, 0)
|
||||
file, err = os.Open(filename)
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user