Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
7ddbe798
Commit
7ddbe798
authored
Aug 24, 2010
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
effective go: fix errors caught by HaWe
R=rsc CC=golang-dev
https://golang.org/cl/1959043
parent
659966a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
doc/effective_go.html
doc/effective_go.html
+7
-5
No files found.
doc/effective_go.html
View file @
7ddbe798
...
...
@@ -207,7 +207,7 @@ have a doc comment.
</p>
<p>
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 <code>Printf</code>,
<code>
Fprintf
</code>
and
<code>
Sprintf
</code>
there is another pair
of functions, for instance
<code>
Print
</code>
and
<code>
Println
</code>
.
These functions do not take a format string but instead generate a default
format for each argument. The
<code>
ln
</code>
version also inserts a blank
between arguments if neither is a string and appends a newline to the output.
format for each argument. The
<code>
Println
</code>
versions also insert a blank
between arguments and append a newline to the output while
the
<code>
Print
</code>
versions add blanks only if the operand on neither side is a string.
In this example each line produces the same output.
</p>
<pre>
fmt.Printf("Hello %d\n", 23)
fmt.Fprint(os.Stdout, "Hello ", 23, "\n")
fmt.Println("Hello", 23)
fmt.Println(fmt.Sprint("Hello ", 23))
</pre>
<p>
...
...
@@ -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:
</p>
<pre>
// ReadWrite
is the interface that groups the basic Read and Write method
s.
// ReadWrite
r is the interface that combines the Reader and Writer interface
s.
type ReadWriter interface {
Reader
Writer
...
...
@@ -2654,7 +2656,7 @@ inside a server without killing the other executing goroutines.
<pre>
func server(workChan
<-chan
*Work
)
{
for
work
:=
range
workChan
{
safelyDo
(
work
)
go
safelyDo
(
work
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment