Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tour: point out using a non-struct package type #208

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion _content/tour/methods.article
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ In this example we see a numeric type `MyFloat` with an `Abs` method.
You can only declare a method with a receiver whose type is defined in the same
package as the method.
You cannot declare a method with a receiver whose type is defined in another
package (which includes the built-in types such as `int`).
package (which includes the built-in types such as `int` or `float64`).
Notice that the type of var `f` has been converted to type `MyFloat` so that
the `Abs` method can be called with receiver `f`.

.play methods/methods-continued.go

Expand Down