Skip to content

CLI tool to analyze Go module dependencies and their size impact before installation

License

Notifications You must be signed in to change notification settings

Apollo87z/go-bloat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-bloat

Test Build Go 1.22+ License: MIT

Know the cost before you go get

A CLI tool that analyzes Go module dependencies and shows their impact before installation.


🎯 The Problem

When you run go get github.com/gin-gonic/gin, you don't know:

  • How big is gin itself?
  • What dependencies does it pull in?
  • Total download size?

go-bloat answers these questions before you install.


✨ Features

Status Feature
Fetch latest version from Go proxy
List all transitive dependencies
CI/CD with GitHub Actions
Cross-platform builds (Linux, macOS, Windows)
🚧 Size calculation per dependency
🚧 Compare alternative packages
🚧 Suggest lighter alternatives

📦 Installation

Option 1: Run directly

go run github.com/apollo87z/go-bloat/cmd@latest analyze <module>

Option 2: Install locally

go install github.com/apollo87z/go-bloat/cmd@latest
go-bloat analyze <module>

Option 3: Download binary

Download pre-built binaries from Releases


🚀 Quick Start

# Analyze a module
go run cmd/main.go analyze github.com/gin-gonic/gin

Output:

🔍 go-bloat - Know the cost before you go get

📦 Analyzing: github.com/gin-gonic/gin

Fetching: https://proxy.golang.org/github.com/gin-gonic/gin/@latest
Found version: v1.9.1
Fetching dependencies from: https://proxy.golang.org/github.com/gin-gonic/gin/@v/v1.9.1.mod
Found 10 dependencies

Latest version: v1.9.1

Dependencies (10):
  1. github.com/bytedance/sonic
  2. github.com/gabriel-vasile/mimetype
  3. github.com/gin-contrib/sse
  4. github.com/go-playground/validator/v10
  5. github.com/goccy/go-json
  6. github.com/json-iterator/go
  7. github.com/mattn/go-isatty
  8. github.com/pelletier/go-toml/v2
  9. github.com/ugorji/go/codec
  10. google.golang.org/protobuf

✅ Analysis complete!

📚 Use Cases

Compare Web Frameworks

go-bloat analyze github.com/gin-gonic/gin
go-bloat analyze github.com/gorilla/mux
go-bloat analyze github.com/labstack/echo/v4

Check Dependency Count

See how many transitive dependencies a package pulls in before adding it to your project.

Audit Dependencies

Discover what your dependencies depend on - useful for security audits and license compliance.


🔧 Development

Project Structure

go-bloat/
├── cmd/
│   ├── main.go           # CLI entry point
│   └── main_test.go      # Tests
├── pkg/
│   └── registry/
│       ├── types.go      # Data structures
│       └── proxy.go      # Go proxy client
├── .github/
│   └── workflows/
│       ├── test.yml      # Test pipeline
│       └── build.yml     # Build pipeline
├── go.mod
└── README.md

Running Locally

git clone https://github.com/apollo87z/go-bloat.git
cd go-bloat
go run cmd/main.go analyze <module>

Running Tests

go test ./...

🛣️ Roadmap

  • Calculate actual download size per dependency
  • Show dependency tree visualization
  • Compare multiple packages side-by-side
  • Suggest lighter alternatives
  • Cache results for faster lookups
  • REST API endpoint
  • Support for private modules

🤝 Contributing

Contributions welcome! Open an issue or submit a PR.


📄 License

MIT License - see LICENSE for details.


🔗 Related Projects


Built by Shehan Horadagoda

⭐ Star this repo if you find it useful!

About

CLI tool to analyze Go module dependencies and their size impact before installation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages