5-30 2,311 views
golang init函数
init函数有一下几点特性:
init函数在main执行之前,自动被调用执行的,不能显示调用
每个包的init函数在包被引用时,自动被调用
每个包可以有多个init函数
同一个文件中可定义多个init()函数
相当于Java的静态函数 static{}
package main
import (
"fmt"
)
func init() {
fmt.Println("1 t.go....")
}
func init() {
fmt.Println("2 t.go....")
}
func main() {
fmt.Println("main...")
}
output:
1 t.go....
2 t.go....
main...
Actually enjoyed account your blog posts. http://jumpingjoemovie.com/__media__/js/netsoltrademark.php?d=mydollhouse.info%2Fgo.php%3Fgo%3Dhttps%3A%2F%2Fwww.socialbuzz.fr%2Fgoogle-vs-facebook-un-changement-de-haut-dans-lapplication%2F
Informative article, just what I was looking
for. http://www.betfortuna1.com/188bet
Informative article, just what I was looking for. http://www.betfortuna1.com/188bet
Pretty nice post. I just stumbled upon your blog and wished to say
that I have truly enjoyed surfing around your blog posts.
In any case I will be subscribing to your feed and I hope you write again very
soon! http://alternatif188bet.com/
Pretty nice post. I just stumbled upon your blog and wished to say that I have
truly enjoyed surfing around your blog posts.
In any case I will be subscribing to your feed and I hope you write again very soon! http://alternatif188bet.com/
Nice post. I learn something totally new and challenging
on sites I stumbleupon everyday. It will always be
exciting to read through content from other writers and use
something from other websites. http://alternatif188bet.com/
Nice post. I learn something totally new and challenging on sites I
stumbleupon everyday. It will always be exciting to read through
content from other writers and use something from other websites. http://alternatif188bet.com/
I have been browsing online more than three hours today, yet I never found any interesting article like yours.
It is pretty worth enough for me. In my view, if all website owners and
bloggers made good content as you did, the internet will be much more useful than ever before. https://sinara-group.com/bitrix/rk.php?goto=http://www.helimsg3.org/UserProfile/tabid/1808/UserID/8292452/Default.aspx
I have been browsing online more than three hours today,
yet I never found any interesting article like yours.
It is pretty worth enough for me. In my view, if all website owners and bloggers made good content as you did,
the internet will be much more useful than ever before. https://sinara-group.com/bitrix/rk.php?goto=http://www.helimsg3.org/UserProfile/tabid/1808/UserID/8292452/Default.aspx
Wow, that’s what I was searching for, what a stuff!
existing here at this website, thanks admin of this web site. http://archeagebegins.org/a/index.php?title=Ageless_Information_Regarding_Anti_Aging
Wow, that’s what I was searching for, what a stuff! existing here at this
website, thanks admin of this web site. http://archeagebegins.org/a/index.php?title=Ageless_Information_Regarding_Anti_Aging