Commit e8d1852d authored by Russ Cox's avatar Russ Cox

doc: update Effective Go init section

Goroutines are no longer excluded from init.

Fixes #3232.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5764044
parent 318465b5
...@@ -1761,10 +1761,7 @@ var ( ...@@ -1761,10 +1761,7 @@ var (
<p> <p>
Finally, each source file can define its own niladic <code>init</code> function to Finally, each source file can define its own niladic <code>init</code> function to
set up whatever state is required. (Actually each file can have multiple set up whatever state is required. (Actually each file can have multiple
<code>init</code> functions.) The only restriction is that, although <code>init</code> functions.)
goroutines can be launched during initialization, they will not begin
execution until it completes; initialization always runs as a single thread
of execution.
And finally means finally: <code>init</code> is called after all the And finally means finally: <code>init</code> is called after all the
variable declarations in the package have evaluated their initializers, variable declarations in the package have evaluated their initializers,
and those are evaluated only after all the imported packages have been and those are evaluated only after all the imported packages have been
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment