Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
566e3b20
Commit
566e3b20
authored
Sep 26, 2008
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- added language with respect to init() restrictions
R=r DELTA=10 (9 added, 0 deleted, 1 changed) OCL=16016 CL=16016
parent
43c5e63c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
go_spec.txt
doc/go_spec.txt
+9
-0
No files found.
doc/go_spec.txt
View file @
566e3b20
...
@@ -2499,6 +2499,15 @@ functions defined in its source. Since a package may contain more
...
@@ -2499,6 +2499,15 @@ functions defined in its source. Since a package may contain more
than one source file, there may be more than one init() function, but
than one source file, there may be more than one init() function, but
only one per source file.
only one per source file.
Initialization code may contain "go" statements, but the functions
they invoke do not begin execution until initialization is complete.
Therefore, all initialization code is run in a single thread of
execution.
Furthermore, an "init()" function cannot be referred to from anywhere
in a program. In particular, "init()" cannot be called explicitly, nor
can a pointer to "init" be assigned to a function variable).
If a package has imports, the imported packages are initialized
If a package has imports, the imported packages are initialized
before initializing the package itself. If multiple packages import
before initializing the package itself. If multiple packages import
a package P, P will be initialized only once.
a package P, P will be initialized only once.
...
...
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