diff options
| author | Trung Nguyen <trung.n.k@gmail.com> | 2017-04-18 22:20:30 +0800 |
|---|---|---|
| committer | Chris Broadfoot <cbro@golang.org> | 2017-04-21 01:50:13 +0000 |
| commit | 97f0ee8b016282b578395cd0dda1f9c3aabf81ec (patch) | |
| tree | 890f9486a11442506f1503b3a17effcd4b1a86ef | |
| parent | cd978b761ea990975ef36825a6a1831b0c2f29c1 (diff) | |
| download | golang-id-tour-97f0ee8b016282b578395cd0dda1f9c3aabf81ec.tar.xz | |
tour: method call not correct
Fixes golang/tour#202.
Change-Id: Ibffa127f6bdbe9c2ce8d47f358d355795e214a2b
Reviewed-on: https://go-review.googlesource.com/40897
Reviewed-by: Chris Broadfoot <cbro@golang.org>
| -rw-r--r-- | content/methods.article | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/content/methods.article b/content/methods.article index bb40024..7475369 100644 --- a/content/methods.article +++ b/content/methods.article @@ -82,8 +82,8 @@ Comparing the previous two programs, you might notice that functions with a pointer argument must take a pointer: var v Vertex - ScaleFunc(v) // Compile error! - ScaleFunc(&v) // OK + ScaleFunc(v, 5) // Compile error! + ScaleFunc(&v, 5) // OK while methods with pointer receivers take either a value or a pointer as the receiver when they are called: @@ -291,7 +291,7 @@ For instance, `IPAddr{1,`2,`3,`4}` should print as `"1.2.3.4"`. * Errors -Go programs express error state with `error` values. +Go programs express error state with `error` values. The `error` type is a built-in interface similar to `fmt.Stringer`: @@ -353,7 +353,7 @@ The `io.Reader` interface has a `Read` method: populated and an error value. It returns an `io.EOF` error when the stream ends. -The example code creates a +The example code creates a [[//golang.org/pkg/strings/#Reader][`strings.Reader`]] and consumes its output 8 bytes at a time. |
