diff options
| author | Chris Broadfoot <cbro@golang.org> | 2016-03-31 16:39:39 -0700 |
|---|---|---|
| committer | Chris Broadfoot <cbro@golang.org> | 2016-04-01 00:02:52 +0000 |
| commit | a8d65457e89c62c23747e5794f35b360cc69b4ab (patch) | |
| tree | 8929a246f1677f4cee8f4c6464e3d1e5b2ee6462 | |
| parent | c4165d780c65c33fb4b6f81f32ce31612c28b0b2 (diff) | |
| download | golang-id-tour-a8d65457e89c62c23747e5794f35b360cc69b4ab.tar.xz | |
content: use Pizza/pizza as an example of exported names
In other languages, all-caps usually signifies an exported constant.
Remove that example since it conflicts with Go's naming guide.
Fixes golang/go#15047.
Change-Id: I7af4a125ad1ba4bd9dd10a0e63eff8e4125cff00
Reviewed-on: https://go-review.googlesource.com/21387
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
| -rw-r--r-- | content/basics.article | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/content/basics.article b/content/basics.article index 230ddeb..fd17b60 100644 --- a/content/basics.article +++ b/content/basics.article @@ -38,12 +38,14 @@ But it is good style to use the factored import statement. * Exported names In Go, a name is exported if it begins with a capital letter. +For example, `Pizza` is an exported name, as is `Pi`, which is exported from +the `math` package. + +`pizza` and `pi` do not start with a capital letter, so they are not exported. When importing a package, you can refer only to its exported names. Any "unexported" names are not accessible from outside the package. -`Pi` is an exported name, as is `PI`. The name `pi` is not exported. - Run the code. Notice the error message. To fix the error, rename `math.pi` to `math.Pi` and try it again. |
