Let's learn about Go's init() function
init() function looks similar to main function, but doesn't take arguments or return values
init()
init() function is the first function called when a package is loaded
Use it when you need package initialization logic!
It executes in the order: import --> const --> var --> init()
import
const
var
Last updated 7 days ago