初级会员
  • 第 16455 位会员
  • tangmo
  • 2018-03-01 09:38:51
  • Offline
  • 20 91

最近发布的主题

    暂无

最近发布的文章

    暂无

最近分享的资源

    暂无

最近发布的项目

    暂无

最近的评论

  • 有几处实践相似
  • 尝试了下,代码如下: ``` package main import ( "fmt" "test" ) func init() { fmt.Println("1st init print in main package") } func init() { fmt.Println("2nd init print in main package") } func main() { fmt.Println("1st print in main func") fmt.Println("2nd print in main func") test.TestFunc() } ``` ``` package test import "fmt" func init() { fmt.Println("1st init print in test package") } func init() { fmt.Println("2nd init print in test package") } func TestFunc() { fmt.Println("TestFunc in test package") } ``` 多次运行,实际输出均如下: ``` 1st init print in test package 2nd init print in test package 1st init print in main package 2nd init print in main package 1st print in main func 2nd print in main func TestFunc in test package ```