From 7ddbe798425306dccfebd7d1842720cc3c273b9c Mon Sep 17 00:00:00 2001
From: Rob Pike
-Doc comments work best as complete English sentences, which allow
+Doc comments work best as complete sentences, which allow
a wide variety of automated presentations.
The first sentence should be a one-sentence summary that
starts with the name being declared.
@@ -1326,13 +1326,15 @@ You don't need to provide a format string. For each of Printf
,
Fprintf
and Sprintf
there is another pair
of functions, for instance Print
and Println
.
These functions do not take a format string but instead generate a default
-format for each argument. The ln
version also inserts a blank
-between arguments if neither is a string and appends a newline to the output.
+format for each argument. The Println
versions also insert a blank
+between arguments and append a newline to the output while
+the Print
versions add blanks only if the operand on neither side is a string.
In this example each line produces the same output.
fmt.Printf("Hello %d\n", 23) fmt.Fprint(os.Stdout, "Hello ", 23, "\n") +fmt.Println("Hello", 23) fmt.Println(fmt.Sprint("Hello ", 23))
@@ -2014,7 +2016,7 @@ two methods explicitly, but it's easier and more evocative to embed the two interfaces to form the new one, like this:
-// ReadWrite is the interface that groups the basic Read and Write methods. +// ReadWriter is the interface that combines the Reader and Writer interfaces. type ReadWriter interface { Reader Writer @@ -2654,7 +2656,7 @@ inside a server without killing the other executing goroutines.func server(workChan <-chan *Work) { for work := range workChan { - safelyDo(work) + go safelyDo(work) } }