go-type-chains/README.md

24 lines
871 B
Markdown
Raw Permalink Normal View History

2025-04-05 22:28:59 +00:00
# go-type-chains
`go-type-chains` outputs [Graphviz](https://graphviz.org/) encodings of
dependencies between files in a Go package.
## Usage
Say you have a Go package in directory `foo/`. Run
```
go-type-chains -p foo/
```
to get a Graphviz encoding where each source file in `foo/` is represented by a
node, and each edge from A to B indicates that A uses a type or value that is
declared in B.
If you import outside packages, use the `-i` flag to list those packages;
otherwise the program will error.
## Details
### Why?
You *may* find this useful if you have a package with a lot of autogenerated Go
code that you want to organize into subpackages. (This is the original reason I
wrote this, although I didn't end up doing any reorganzation on the package I
was analyzing. But by the time I decided that, I had written enough code that I
thought I should share.)