aboutsummaryrefslogtreecommitdiff
path: root/content/examples.article
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2020-03-09 23:23:49 -0400
committerRuss Cox <rsc@golang.org>2020-03-11 14:10:22 +0000
commit7fd29cb024126de10a90c54427e050e7928c54b4 (patch)
tree42498c25ba0669a5914b2d883419e5d15b7a7a8c /content/examples.article
parent9dd3d9b97af3dba2bd18f1a5e18bd8e8edf78962 (diff)
content: make spacing consistent + remove comments
Remove repeated blank lines, trailing spaces, trailing blank lines Remove comments from survey2018.article (only article using them). Remove blank lines between successive ".commands". For golang/go#33955. Change-Id: I90cae37a859a8e39549520569d5f10bc455415d3 Reviewed-on: https://go-review.googlesource.com/c/blog/+/222841 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'content/examples.article')
-rw-r--r--content/examples.article6
1 files changed, 2 insertions, 4 deletions
diff --git a/content/examples.article b/content/examples.article
index a8d5aba..dc24423 100644
--- a/content/examples.article
+++ b/content/examples.article
@@ -107,10 +107,9 @@ then the example function is compiled but not executed:
ok github.com/golang/example/stringutil 0.009s
Examples without output comments are useful for demonstrating code that cannot
-run as unit tests, such as that which accesses the network,
+run as unit tests, such as that which accesses the network,
while guaranteeing the example at least compiles.
-
* Example function names
Godoc uses a naming convention to associate an example function with a
@@ -131,13 +130,12 @@ Each of these examples documents the `Reverse` function:
func ExampleReverse_second()
func ExampleReverse_third()
-
* Larger examples
Sometimes we need more than just a function to write a good example.
For instance, to demonstrate the [[https://golang.org/pkg/sort/][`sort` package]]
-we should show an implementation of `sort.Interface`.
+we should show an implementation of `sort.Interface`.
Since methods cannot be declared inside a function body, the example must
include some context in addition to the example function.