🦩 Go Recipes
Handy well-known and lesser-known tools for Go projects
Know some cool tool or one-liner? Have a feature request or an idea?
Feel free to edit this page or create an Issue!
Contents
- AI tools
- Testing
- Make treemap of coverage with
go-cover-treemap
- Browse coverage
- Browse coverage with
gocov-html
- Browse coverage in terminal with
gocovsh
- Pretty print coverage in terminal with
nikandfor/cover
- Run coverage collector server with
goc
- Visualize live coverage in VSCode with
goc
- :confetti_ball: Shuffle tests
- Run tests sequentially
- Run tests in parallel
- Detect goroutine leaks with
goleak
- Detect goroutine leaks with
leaktest
- Summarize
go test
withtparse
- Decorate
go test
withrichgo
- Decorate
go test
withgotest
- Decorate
go test
withgotestsum
- Format
go test
results as documentation withgotestdox
- Get slowest tests with
gotestsum
- Auto-Instrument skipping slowest tests with
gotestsum
- Automatically re-run failed tests with
gotestsum
- Make
JSUnit
test report withgotestsum
- Make
JSUnit
test report withgo-junit-report
- Get packages without tests
- Perform Mutation Testing with
ooze
- Perform Mutation Testing with
avito-tech/go-mutesting
- Perform Mutation Testing with
go-mutesting
- Trace tests with
go-test-trace
- Speedup tests for large codebases
- Make treemap of coverage with
- Dependencies
- Get Go version of current module
- Get Go versions of upstream modules
- Get directly dependent modules that can be upgraded
- Get upstream modules without Go version
- Get available module versions
- Make graph of upstream modules with
modgraphviz
- Make graph of upstream modules with
gmchart
- Make graph of upstream packages with
import-graph
- Scrape details about upstream modules and make graph with
import-graph
- Scrape licenses of upstream dependencies with
go-licenses
- Explore dependencies with
goda
- Explore dependencies interactively with
spaghetti
- Use
go mod
directives - Enforce Go code architecture with
go-arch-lint
- Code Visualization
- Make C4 diagram with
go-structurizr
- Make graph of function calls with
callgraph
- Make graph of function calls in package with
go-callvis
- Make PlantUML diagram with
goplantuml
- Make PlantUML diagram with
go-plantuml
- Make 3D chart of Go codebase with
gocity
- Make histogram of Go files per package
- Explore Go code in browser powered by
go-guru
withpythia
- :derelict_house: Interactively visualize packages with
goexplorer
- Make D2 graph of architecture and dependencies with
go-arch-lint graph
- Make C4 diagram with
- Code Generation
- Run
go:generate
in parallel - Generate
String
method for enum types - Generate enums encoding with
go-enum-encoding
- Generate enums with
goenums
- :confetti_ball: Generate data types from JSON Schema with
go-jsonschema
- :confetti_ball: Generate constructor for a struct with
gonstructor
- Generate Table Driven Tests with
gotests
- Generate mocks with
mockgen
- Generate interface for a struct with
ifacemaker
- Generate interface for a struct with
interfacer
- Generate interface for a struct with
struct2interface
- Generate interface for
CSV
file withstructer
- Modify struct field tags with
gomodifytags
- Generate code from OpenAPI 3 specification with
oapi-codegen
- Run
- Refactoring
- Replace symbol with
gofmt
- :confetti_ball: Apply refactoring patches with
gopatch
- Keep consistent ordering of imports with
goimports
- Keep consistent ordering of imports with
gci
- Keep consistent ordering of imports with
goimportx
- :confetti_ball: Replace unkeyed struct literals into keyed ones with
keyify
- Replace symbol with
- Errors
- Building
- Show compiler optimization decisions on heap and inlining
- Disable inlining
- Aggressive inlining
- Profile-guided optimization
- Manually disable or enable
cgo
- Include metadata in binary during compilation with
ldflags
- Visualise dependencies size in compiled binaries with
go-size-analyzer
- Make treemap breakdown of Go executable binary with
go-binsize-treemap
- Custom import path
- Custom import path with
govanityurls
- Custom import path with
sally
- Custom import path with
kkn.fi/vanity
- Custom import path enforcement
- :confetti_ball: Manage multiple Go versions with
Goenv
- Assembly
- Get assembly of Go code snippets online
- Get Go SSA intermediary representation with
ssaplayground
- View Go assembly interactively with
lensm
- :confetti_ball: View Go assembly with color annotation with
pat/disfunc
- Generate Go assembly in Go with
avo
- Generate AST for code snippets with
go/ast
- Generate AST for code snippets with
go2ast
- Visualize Go SSA function using Graphviz with
go-ssaviz
- :derelict_house: Make graph of AST with
astgraph
- :derelict_house: Convert C assembly to Go assembly with
c2goasm
- Execution
- Embed Go Playground to your blog with
goplay
- Run alternative Go Playground with
goplay.tools
- Run interactive Go kernels in Jupyter Notebook with
gophernotes
- Run interactive Go interpreter with
yaegi
- Run interactive Go interpreter with
gomacro
- Run Go function in shell with
gorram
- Run Go function in shell with
gosh
- Run simple fileserver with
net/http
- Create 3D visualization of concurrency traces with
gotrace
- Wrap command with
os/exec
- Capture output of command to file with
os/exec
- Capture output of command and process it with
os/exec
- Piping between processes with
os/exec
-
errgroup
and CommandContext withos/exec
- Embed Go Playground to your blog with
- Monitoring
- Monitor goroutines with
grmon
- Monitor Go processes with
gops
- Visualise Go runtime metrics in browser with
statsviz
- Auto-Instrument all functions with
go-instrument
- Auto-Instrument all functions with
otelinji
- :confetti_ball: Auto-Instrument functions for DataDog with
orchestrion
- Continious Profiling with
Pyroscope
- Monitor goroutines with
- Benchmarking
- Run benchmarks
- Table-driven benchmarks
- Generate benchmak CPU and Memory profiles with
go test
- Visualize callgraph of profiles with
pprof
- Visualize flamegraphs of profiles with
pprof
- Visualize profiles online
- Get delta between two benchmarks with
benchstat
- Get summary of benchmarks with
benchstat
- :confetti_ball: Benchmark against git commit with
pat/ba
- Continuous benchmarking
- Continuous benchmarking with
gobenchdata
- Continuous benchmarking with
benchdiff
- Continuous benchmarking with
cob
- Generate live traces with
net/http/trace
- Generate traces with
go test
- [ View traces with `go tool