summaryrefslogtreecommitdiff
path: root/libgo/go/bytes/example_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/bytes/example_test.go')
-rw-r--r--libgo/go/bytes/example_test.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/libgo/go/bytes/example_test.go b/libgo/go/bytes/example_test.go
index 6fe8cd5a90cc..1774a5ab4261 100644
--- a/libgo/go/bytes/example_test.go
+++ b/libgo/go/bytes/example_test.go
@@ -5,23 +5,24 @@
package bytes_test
import (
- . "bytes"
+ "bytes"
"encoding/base64"
+ "fmt"
"io"
"os"
)
func ExampleBuffer() {
- var b Buffer // A Buffer needs no initialization.
+ var b bytes.Buffer // A Buffer needs no initialization.
b.Write([]byte("Hello "))
- b.Write([]byte("world!"))
+ fmt.Fprintf(&b, "world!")
b.WriteTo(os.Stdout)
// Output: Hello world!
}
func ExampleBuffer_reader() {
// A Buffer can turn a string or a []byte into an io.Reader.
- buf := NewBufferString("R29waGVycyBydWxlIQ==")
+ buf := bytes.NewBufferString("R29waGVycyBydWxlIQ==")
dec := base64.NewDecoder(base64.StdEncoding, buf)
io.Copy(os.Stdout, dec)
// Output: Gophers rule!