Skip to content

grishy/gopkgview

Repository files navigation


Status: Maintained

GitHub tag Go Report Card 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:

gopkgview-lazydocker.mp4

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.

About

Interactive visualization of a Go package's dependency graph

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 2

  •  
  •