summaryrefslogtreecommitdiff
path: root/test/init.go
diff options
context:
space:
mode:
authorKeith Randall <khr@google.com>2019-02-05 16:22:38 -0800
committerKeith Randall <khr@golang.org>2019-03-18 20:10:55 +0000
commitd949d0b9252be1fffeadd65183a6bab3acf3de7a (patch)
tree842d96e7575d306fafd07322dbd7771ba56929ea /test/init.go
parent991c85a750574a608daf70330e26070f8cd97bb4 (diff)
downloadgo-git-d949d0b9252be1fffeadd65183a6bab3acf3de7a.tar.gz
cmd/compile: reorganize init functions
Instead of writing an init function per package that does the same thing for every package, just write that implementation once in the runtime. Change the compiler to generate a data structure that encodes the required initialization operations. Reduces cmd/go binary size by 0.3%+. Most of the init code is gone, including all the corresponding stack map info. The .inittask structures that replace them are quite a bit smaller. Most usefully to me, there is no longer an init function in every -S output. (There is an .inittask global there, but it's much less distracting.) After this CL we could change the name of the "init.ializers" function back to just "init". Update #6853 R=go1.13 Change-Id: Iec82b205cc52fe3ade4d36406933c97dbc9c01b1 Reviewed-on: https://go-review.googlesource.com/c/go/+/161337 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Diffstat (limited to 'test/init.go')
-rw-r--r--test/init.go4
1 files changed, 1 insertions, 3 deletions
diff --git a/test/init.go b/test/init.go
index f4689443cf..317f2472cb 100644
--- a/test/init.go
+++ b/test/init.go
@@ -9,13 +9,11 @@
package main
-import "runtime"
-
func init() {
}
func main() {
init() // ERROR "undefined.*init"
- runtime.init() // ERROR "unexported.*runtime\.init"
+ runtime.init() // ERROR "undefined.*runtime\.init"
var _ = init // ERROR "undefined.*init"
}