When is the init() function run?

前端 未结 11 666
离开以前
离开以前 2020-12-02 03:41

I\'ve tried to find a precise explanation of what the init() function does in Go. I read what Effective Go says but I was unsure if I understood fully what it s

11条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-02 04:05

    mutil init function in one package execute order:

    1. const and variable defined file init() function execute

    2. init function execute order by the filename asc

提交回复
热议问题