lean

command module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2020 License: MIT Imports: 13 Imported by: 0

README

lean

lean helps users understand their module dependency graph, and find low-cost, high-value cuts that can be made to reduce the dependency graph size.

Running

go install github.com/jadekler/lean
cd /path/to/my/project
go mod graph | lean

Developing

Install and run (for development of lean):

go generate github.com/jadekler/lean/static && \
go install github.com/jadekler/lean && \
go mod graph | lean

This is an MVP and is not production ready

This is an MVP. There are several parts of this that are not fully fleshed out. An incomplete list:

  • Shorten hashes.
  • Always return sorted graph, so that graph is more consistently rendered same way across edge adds/deletes.
  • Calculate # vertices removed by cut per edge.
  • Calculate # bytes removed by cut per edge.
  • Calculate # usages of 'to' by 'from' per edge.
  • Refactor connectedness algorithm to use dominator tree for better performance.
  • Tests, especially around connectedness algorithms.
  • Check $GOPATH, vendor, replace directives when calculating module size & ast.

Immediate TODO

re: https://fasterthanli.me/blog/2020/i-want-off-mr-golangs-wild-ride/

Immediate things that need fixing:

  • Module size should be cumulative to makethe sorting / figuring out which to cut actually useful.
  • We should by default only show the direct dependencies of the root.
  • Finding cloud.google.com/go is not working (I think because submodules).

Test by,

git clone https://github.com/getlantern/idletiming
cd idletiming
git checkout f356a3557cf3bd4c3f2fd10101bfb0728d0ce695
go mod graph | lean

Documentation

Overview

lean displays "go mod graph" output as an interactable graph. lean allows you to see how your dependencies would change if you deleted one or more edges.

While existing tools (e.g. golang.org/x/cmd/digraph) are good at answering questions about the actual graph, they're not so helpful with the kind of hypothetical questions you have when you're about to undertake a refactoring. lean can help you see the scope of the work ahead of you.

Usage:

go mod graph | lean
go mod graph | digraph transpose | lean

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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