mirror of
https://github.com/golang/go
synced 2024-11-24 22:00:09 -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>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
f, err := os.Open(name, os.O_RDONLY, 0)
|
f, err := os.Open(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -520,7 +520,7 @@ statements, the resulting code needs no <code>else</code> statements.
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
f, err := os.Open(name, os.O_RDONLY, 0)
|
f, err := os.Open(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -813,7 +813,7 @@ canonical examples are unlocking a mutex or closing a file.
|
|||||||
<pre>
|
<pre>
|
||||||
// Contents returns the file's contents as a string.
|
// Contents returns the file's contents as a string.
|
||||||
func Contents(filename string) (string, os.Error) {
|
func Contents(filename string) (string, os.Error) {
|
||||||
f, err := os.Open(filename, os.O_RDONLY, 0)
|
f, err := os.Open(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@ -2675,7 +2675,7 @@ field for recoverable failures.
|
|||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
for try := 0; try < 2; try++ {
|
for try := 0; try < 2; try++ {
|
||||||
file, err = os.Open(filename, os.O_RDONLY, 0)
|
file, err = os.Open(filename)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user