gopkgview

command module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2025 License: GPL-3.0 Imports: 15 Imported by: 0

README

gopkgview - Go dependency visualization


Status Maintained
Stable Version GitHub tag
Go Report Card Go Report Card
CI/CD Build Status

Overview

gopkgview is an interactive tool designed to visualize and analyze Go project dependencies. It provides a rich, web-based interface for better understanding of how your project connects its components and external libraries.

Implemented with ELK's layout algorithms to arrange the graphs and React Flow to make the visualization interactive and user-friendly.

go mod graph... doesn't show... a graph.
gopkgview does.

-- The Applied Go Weekly Newsletter

Example of visualization of lazydocker:

https://github.com/user-attachments/assets/d9715b85-9f77-4b2e-8ef4-1581071f1e66

Features

  • Support latest Go version
  • Interactive web-based visualization - Real-time exploration of dependencies
  • Toggle dependencies by type - Filter standard library, external, and local packages
  • Focus on specific dependencies - Drill down into particular packages for detailed analysis
  • Multiple installation options - go install, binary download, or Docker

Installation

Option 1: Install via go install
go install github.com/grishy/gopkgview@latest
Option 2: Download the Release

Download the latest binary from the Releases Page.

Option 3: Run with Docker
docker run -p 8080:8080 -v $(pwd):/app ghcr.io/grishy/gopkgview:latest

Quick Start

Navigate to your Go project directory and run:

cd my-go-project
gopkgview

This will start a web server with the dependency visualization available in your browser. By default it opens your default browser; use --skip-browser if you prefer to launch it manually.

Parameters

Available Flags
Flag Description
--root From which directory find go.mod
‣ Default: ./
‣ Environment Variable: GO_PKGVIEW_ROOT
--gomod Path to go.mod
‣ Default: Auto-detected
‣ Environment Variable: GO_PKGVIEW_GOMOD
--addr Address to listen on
‣ Default: :0 (random port)
‣ Environment Variable: GO_PKGVIEW_ADDR
--max-goroutines Maximum number of goroutines to use for parsing in parallel
‣ Default: 20
‣ Environment Variable: GO_PKGVIEW_MAX_GOROUTINES
--skip-browser Don't open browser on start
‣ Default: false
‣ Environment Variable: GO_PKGVIEW_SKIP_BROWSER
--help, -h Show help
--version, -v Print the version
Example Usage
# Analyze a specific directory
gopkgview --root ./path/to/project

# Use a specific go.mod file
gopkgview --gomod ./path/to/go.mod

Release Process

Reminder for me, just create a tag and push it.

# Replace 1.2.0 with the new version in project
git tag -a v1.2.0 -m "Release v1.2.0"
git push origin tag v1.2.0

Alternatives

  • go-callvis - Great tool for visualizing of call, but panic on Go >= 1.21
  • godepgraph - Same idea, but output is static image
  • depgraph - Inspire me to create this tool
  • gomod

License

© 2025 Sergei G. This project is licensed under the GPL-3.0 license.

Documentation

Overview

Package main provides the CLI entry point for gopkgview, a Go dependency visualization tool.

Directories

Path Synopsis
Package graph provides functionality for building and analyzing Go dependency graphs.
Package graph provides functionality for building and analyzing Go dependency graphs.
Package trie provides a prefix tree optimized for Go import paths, offering O(m) operations where m is the path length.
Package trie provides a prefix tree optimized for Go import paths, offering O(m) operations where m is the path length.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL