import cycle

A situation where two or more packages import each other, directly or in a loop, which the Go compiler refuses to build.

In more detail

Go reports import cycle not allowed and stops. The rule forces clear layering: shared types move to a lower package that both sides import. It is annoying the first time and saves you from tangled designs later.

Related terms

Taught in

References