1// run 2 3// Copyright 2019 The Go Authors. All rights reserved. 4// Use of this source code is governed by a BSD-style 5// license that can be found in the LICENSE file. 6 7// Test that empty init functions are skipped. 8 9package main 10 11import _ "unsafe" // for go:linkname 12 13type initTask struct { 14 state uintptr 15 ndeps uintptr 16 nfns uintptr 17} 18 19//go:linkname main_inittask main..inittask 20var main_inittask initTask 21 22func main() { 23 if nfns := main_inittask.nfns; nfns != 0 { 24 println(nfns) 25 panic("unexpected init funcs") 26 } 27} 28 29func init() { 30} 31 32func init() { 33 if false { 34 } 35} 36 37func init() { 38 for false { 39 } 40} 41