Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Finding cycles and hidden dependencies in go mod graph

Описание и применение

Автоматический анализ графа зависимостей Go с помощью gograph позволяет быстро находить циклы и зависимые модули.

Задача

Analyzing a large Go module dependency graph to identify cycles, dependents, and hidden dependencies is difficult with raw go mod graph output.

Результат

Cycles are detected quickly (≈10 ms on a laptop) and dependents are listed for any module. The approach scales to large graphs and replaces manual grep with automated graph traversal.

Рабочий процесс

  • Run go mod graph | go run github.com/hmdsefi/gograph/examples/gomodgraph@latest cycles to find cycles.
  • Run go run github.com/hmdsefi/gograph/examples/gomodgraph@latest dependents <module> to list dependents.
  • Use gomodgraph -f graph.txt cycles or dependents with a file for larger graphs.
  • Optionally use gograph.dev for interactive exploration of small graphs.

Доказательства

go mod graph prints every requirement in your module graph, one per line.

Источник

I loaded it into gograph, the graph library I maintain, and wrote a small program, gomodgraph, that answers those questions.

Источник

On Prometheus it finds one cycle: go.opentelemetry.io/otel/[email protected] go.opentelemetry.io/otel/[email protected] go.opentelemetry.io/[email protected]

Источник

  • Дата записи: 2026-10-12T18:41:30.582Z