Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

Topological Sort

Ordering a dependency graph so nothing is built before what it needs, demoing the p/moul/x/daily/toposort library.

A graph with a cycle

auth <- session
server <- auth
session <- auth

Sort returns an error: toposort: graph has a cycle

Ordered before giving up: nothing

Stuck on the cycle: auth, server, session

The nodes still stuck are named rather than silently dropped, so a caller can report exactly which dependencies are tangled.