-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More robust version of estimate based on go mod graph
The technique previously used for retrieving the module graph was costly and britle, with many errors returned from importgraph.Build for unknown reasons. As go modules now provide a simple API to fetch the import graph of a packages we can now use this more reliable interface instead. It is faster and delivers more accurate results. For example: Before $ go run . estimate github.com/charmbracelet/vhs 2> /dev/null github.com/charmbracelet/vhs github.com/go-rod/rod github.com/charmbracelet/ssh $ go run . estimate github.com/go-rod/rod 2> /dev/null github.com/go-rod/rod github.com/ysmood/goob github.com/ysmood/gson github.com/ysmood/got github.com/ysmood/gotrace github.com/ysmood/fetchup github.com/ysmood/leakless github.com/gobwas/ws After $ go run . estimate github.com/charmbracelet/vhs 2> /dev/null github.com/charmbracelet/vhs github.com/charmbracelet/ssh github.com/erikgeiser/coninput github.com/go-rod/rod github.com/ysmood/fetchup github.com/ysmood/got github.com/ysmood/gop github.com/ysmood/goob github.com/ysmood/gotrace github.com/ysmood/gson github.com/ysmood/leakless github.com/mattn/go-localereader See that previously github.com/go-rod/rod was indicated as a single dependency of github.com/charmbracelet/vhs, when in fact it had itself multiple missing dependencies. The new implementation reports all of them from the beginning. It is still quite imprecise, probably due to module graph pruning [1], but also because sometimes go mod graph returns a little bit too much direct dependencies for an unknown reason. [1] https://go.dev/ref/mod#graph-pruning
- Loading branch information
Showing
1 changed file
with
76 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters