os: New Open API.
We replace the current Open with: OpenFile(name, flag, perm) // same as old Open Open(name) // same as old Open(name, O_RDONLY, 0) Create(name) // same as old Open(name, O_RDWR|O_TRUNC|O_CREAT, 0666) This CL includes a gofix module and full code updates: all.bash passes. (There may be a few comments I missed.) The interesting packages are: gofix os Everything else is automatically generated except for hand tweaks to: src/pkg/io/ioutil/ioutil.go src/pkg/io/ioutil/tempfile.go src/pkg/crypto/tls/generate_cert.go src/cmd/goyacc/goyacc.go src/cmd/goyacc/units.y R=golang-dev, bradfitzwork, rsc, r2 CC=golang-dev https://golang.org/cl/4357052
This commit is contained in:
parent
1721e53cdf
commit
abbbdb168d
@ -50,7 +50,7 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
certOut, err := os.Open("cert.pem", os.O_WRONLY|os.O_CREAT, 0644)
|
||||
certOut, err := os.Create("cert.pem")
|
||||
if err != nil {
|
||||
log.Fatalf("failed to open cert.pem for writing: %s", err)
|
||||
return
|
||||
@ -59,7 +59,7 @@ func main() {
|
||||
certOut.Close()
|
||||
log.Print("written cert.pem\n")
|
||||
|
||||
keyOut, err := os.Open("key.pem", os.O_WRONLY|os.O_CREAT, 0600)
|
||||
keyOut, err := os.OpenFile("key.pem", os.O_WRONLY|os.O_CREAT, 0600)
|
||||
if err != nil {
|
||||
log.Print("failed to open key.pem for writing:", err)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user