4 ms·
> func init() isn't the only way to execute logic when a package is imported! What are other ways to execute logic when a package is imported? init() is the on
by kornish 9y ago
> func init() isn't the only way to execute logic when a package is imported!
What are other ways to execute logic when a package is imported? init() is the only one I'm aware of.
- transitorykris 9y agopackage globals var ( X = blah() ) func blah() int { return 123 }