From 422e247332e2a234feaceec52aa7e3eef60a2e7b Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Tue, 22 Nov 2011 11:53:30 -0800 Subject: [PATCH] tutorial: update go_tutorial.html There's version skew with respect to the programs in doc/progs. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5433048 --- doc/go_tutorial.html | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/doc/go_tutorial.html b/doc/go_tutorial.html index 9713c904159..88785a2124b 100644 --- a/doc/go_tutorial.html +++ b/doc/go_tutorial.html @@ -557,10 +557,7 @@ exported factory to use is OpenFile (we'll explain that name in a m

func OpenFile(name string, mode int, perm uint32) (file *File, err error) {
-    r, e := syscall.Open(name, mode, perm)
-    if e != 0 {
-        err = os.Errno(e)
-    }
+    r, err := syscall.Open(name, mode, perm)
     return newFile(r, name), err
 }
 
@@ -626,22 +623,16 @@ each of which declares a receiver variable file. if file == nil { return os.EINVAL } - e := syscall.Close(file.fd) + err := syscall.Close(file.fd) file.fd = -1 // so it can't be closed again - if e != 0 { - return os.Errno(e) - } - return nil + return err } func (file *File) Read(b []byte) (ret int, err error) { if file == nil { return -1, os.EINVAL } - r, e := syscall.Read(file.fd, b) - if e != 0 { - err = os.Errno(e) - } + r, err := syscall.Read(file.fd, b) return int(r), err } @@ -649,10 +640,7 @@ func (file *File) Write(b []byte) (ret int, err error) { if file == nil { return -1, os.EINVAL } - r, e := syscall.Write(file.fd, b) - if e != 0 { - err = os.Errno(e) - } + r, err := syscall.Write(file.fd, b) return int(r), err }