# Entry Point

## Main package

Пакет `main` является специальным пакетом и может иметь свое имя вне зависит от имени содержащей его директории.

* `main` package is the entry-point package for executable programs.
* Programs start running function `main()` in package `main`.
* Library packages are only reusable packages and don’t contain main package, and an entry-point (mostly).
* If your `main` function doesn’t exist in package `main`, the build tools won’t produce an executable.
* Main packages are not importable packages and you don’t need to export things from main package.

## Init function

`init` - это специальная функция, выполняющая до `main` с целью установки значения пакета:

* Function `init` is executed before `main`.
* Each source file can define its own `init` function to set up whatever state is required.
* Each file can have multiple `init` functions.
* При первом импорте пакета в первый раз будут выполнены все его `init` функции.
* Никакой порядок не гарантируется при выполнении `init` функций.
* `init` is called after all the variable declarations in the package have evaluated their initialisers, and those are evaluated only after all the imported packages have been initialised.
