Glice v2 - Adding support for go.mod
Want to connect? Find me on LinkedIn or the Contact page.
Glice is a very simple Go project I wrote four years ago while still being new to the language. Previously it used Go's built-in tooling (go-list) to parse imports of every .go file in a project, and output a list of all dependencies (including standard library ones), their count, and license and URL for third-party ones.
The problems started once Go Modules were introduced. As Glice relied on GOPATH and Go Modules got rid of that, Glice stopped working on projects utilizing the new modules. With time more and more projects adopted Go Modules and Glice became obsolete.
Due to a lack of time and motivation, I haven't updated it for three years. Last week I was given a task to get all licenses our projects are using, which was ideal for updating Glice. It took me a couple of hours to rewrite it and add go.mod support. The actual code is now much simpler, parsing the go.mod file using modfile and fetching license information for all third-party dependencies.
To simplify the project, I removed support for standard library dependencies and counting the number of times a dependency was imported. The previous version is available as v1.0.0 tag. Part of the API has been externalized which allows importing glice as a dependency and using it within your project.
Apart from replacing Travis (that apparently went through some changes) with GitHub Actions, there are a few things that could be improved - parallelizing dependency fetching and fetching the license for the exact version, not from master.