Make example more golang

This commit is contained in:
dmaiocchi 2018-10-07 09:36:09 +02:00
parent 28db807c97
commit f34b1cc12a
1 changed files with 5 additions and 5 deletions

View File

@ -51,14 +51,14 @@ similar to a standard file I/O interface:
ioctx, err := conn.OpenIOContext("mypool") ioctx, err := conn.OpenIOContext("mypool")
// write some data // write some data
bytes_in := []byte("input data") bytesIn := []byte("input data")
err = ioctx.Write("obj", bytes_in, 0) err = ioctx.Write("obj", bytesIn, 0)
// read the data back out // read the data back out
bytes_out := make([]byte, len(bytes_in)) bytesOut := make([]byte, len(bytesIn))
n_out, err := ioctx.Read("obj", bytes_out, 0) _, err := ioctx.Read("obj", bytesOut, 0)
if bytes_in != bytes_out { if !bytes.Equal(bytesIn, bytesOut) {
fmt.Println("Output is not input!") fmt.Println("Output is not input!")
} }
``` ```