Fetch license information for all direct and indirect dependencies of your Golang project

gocomply logo

gocomply beta

Give open source Golang developers the credit they deserve, follow your legal obligations, and save time with gocomply.

This tiny little 300-line program scans the Go module in the current directory for all direct and indirect dependencies, and attempts to download and write all of their license files to stdout. Progress or warnings are written to stderr.

Use

Install gocomply (you only need to do this once)

$ go install tawesoft.co.uk/gopkg/gocomply@latest

Then, go (pun not intended) to the directory of some Go module

$ cd path/to/some/module

Then just run gocomply. You probably want to redirect its output to a file, like so. This will overwrite that file each time. You'll see some progress on the terminal.

$ gocomply > 3rd-party-licenses.txt

Important caveats

Licenses of indirect dependencies will be included, regardless of whether they end up being used by your project or in the resulting binary. You can and should review and trim the output as appropriate.

A human must manually check the output for compliance. Just because you have included the text of a license file, it does not mean you're allowed to use the code or that the license is open source. It does not mean that the author of the module that you depend on is using the license properly.

The tool only checks the currently published version of a license. You might be using an old version that comes under a different license.

The tool doesn't yet support private repos.

Because git archive isn't widely supported (shame!) the method of obtaining a single license file from a git repo is something that must be hard-coded for each provider. The provider you use might be missing from this hard-coded list - if so, open an issue.

The gocomply program also operates in a different mode where it accepts a list of modules to check as command-line arguments. Subtly, it is assumed that this is a complete list of modules and dependencies - the dependencies of modules provided on the command-line are NOT checked. This mode is intended for users who parse the output of go list -m all themselves.

Troubleshooting

panic: error: go list error: exit status 1

The current directory is not a Go module.

Feedback

This is early software, so feel free to open an issue or contact a maintainer:

Owner
Tawesoft
Software engineering excellence — made in Wales.
Tawesoft
Similar Resources

🦄 Easy, fast and open-source local package manager for Python!

Unikorn 🦄 Easy, fast and open-source local package manager for Python! Key Features Speed: You can add a package in one second.

Dec 11, 2021

GoFish is a cross-platform systems package manager, bringing the ease of use of Homebrew to Linux and Windows.

GoFish is a cross-platform systems package manager, bringing the ease of use of Homebrew to Linux and Windows.

Dec 11, 2022

A full-featured license tool to check and fix license headers and resolve dependencies' licenses.

A full-featured license tool to check and fix license headers and resolve dependencies' licenses.

SkyWalking Eyes A full-featured license tool to check and fix license headers and resolve dependencies' licenses. Usage You can use License-Eye in Git

Dec 26, 2022

License-cli - simple LICENSE file generator

📝 license-cli simple LICENSE file generator 2022-01-04.12-28-26.mp4 Install / U

Jun 2, 2022

License-API - Basic license based authentication API with discord account integration

License-API Basic license based authentication API with discord account integrat

Feb 18, 2022

The Direct Route GO SDK provides a thin wrapper around the Direct Route API for sending private transactions

Direct Route Go SDK The Direct Route GO SDK provides a thin wrapper around the D

Dec 8, 2022

Go-fetch-words - Fetch 5 letter words from dictionary.com

Go-fetch-words This GO app fetches 5 letter words from dictionary.com and saves

Oct 16, 2022

Fetch-npm-package - A small utility that can be used to fetch a given version of a NPM package

Use fetch-npm-package package version output-dir E.g. fetch-npm-package is

May 21, 2022

estruct traverses javascript projects and maps all the dependencies and relationships to a JSON. the output can be used to build network visualizations of the project and document the architecture.

estruct traverses javascript projects and maps all the dependencies and relationships to a JSON. the output can be used to build network visualizations of the project and document the architecture.

EStruct traverses javascript projects and maps all the dependencies and relationships to a JSON. The output can be used to build network visualizations of the project and document the architecture.

Jan 27, 2022

Fetch All Links And Compare From Prior Fetches For golang

Fetch All Links And Compare From Prior Fetches This program can be run with go r

Jan 1, 2022

A Go client used to fetch information from the Go API

Hilo Client Go Hilo API Go client, Introduction This is a (partial) Go client used to fetch information from the Go API, most of the reverse engineeri

Nov 27, 2021

Write your SQL queries in raw files with all benefits of modern IDEs, use them in an easy way inside your application with all the profit of compile time constants

About qry is a general purpose library for storing your raw database queries in .sql files with all benefits of modern IDEs, instead of strings and co

Dec 25, 2022

Fetch web pages using headless Chrome, storing all fetched resources including JavaScript files

Fetch web pages using headless Chrome, storing all fetched resources including JavaScript files. Run arbitrary JavaScript on many web pages and see the returned values

Dec 29, 2022

Pi-fetch - get a summary of your pi-hole stats from your terminal

pi-fetch get a summary of your pi-hole stats from your terminal _ ___ _ _ ___|_|___| _|___| |_ ___| |_ | . | |___| _| -_| _

Jan 9, 2022

Proxywv - Simplified Widevine license proxy server written in Go (Golang)

license-proxy Simplified Widevine license proxy server written in Go (Golang). U

Feb 13, 2022

Keygen SDK for Go. Integrate license activation and automatic updates for Go binaries.

Keygen Go SDK Package keygen allows Go programs to license and remotely update themselves using the keygen.sh service. Usage keygen.Validate(fingerpri

Dec 18, 2022

A GitHub CLI extension to view and generate license files.

gh-license A GitHub CLI extension to view and generate license files. All license information is obtained from the GitHub API. NOTE: The only purpose

Oct 8, 2022

A License Classifier

License Classifier Introduction The license classifier is a library and set of tools that can analyze text to determine what type of license it contai

Dec 22, 2022
Comments
  • Add support for gitea

    Add support for gitea

    Hey folks, I was trying out your tool and it asked me to raise an issue!

    unable to find a license for module "code.gitea.io/sdk/gitea": no known license URL for module "code.gitea.io/sdk/gitea": repo "https://gitea.com/gitea/go-sdk" not supported (please open an issue)
    

    As far as I understand gitea is a self-hostable github alternative.

  • Design: Why isn't gocomply looking in

    Design: Why isn't gocomply looking in "$GOPATH/go/pkg/mod"?

    The "$GOPATH/go/pkg/mod" directory already has license files for modules. If we could use that, gocomply becomes much, much simpler and faster.

    gocomply is currently sidestepping the "$GOPATH/go/pkg/mod" directory because (emphasis mine):

    The module download is split into two parts: downloading the go.mod and downloading the actual code. If you have dependencies only needed for tests, then they will show up in your go.mod, and go get will download their go.mods, but it will not download their code. The test-only dependencies get downloaded only when you need it, such as the first time you run go test.

    This applies not just to test-only dependencies but also os-specific dependencies. For example if you use logrus but don't use Solaris, then the golang.org/x/sys go.mod needs to be downloaded, but not the code in that repo.

    When you do split things out explicitly, then you'd have different version selection results for the different "scopes". You could potentially be using one version for a build and then get a different version for a test. That would be quite unfortunate. Having one unified go.mod avoids that potential problem.

    So you're getting the fine-grained separation you want already, for free*, without having to maintain any explicit scopes, and without any possibility of inconsistency.

    • The asterisk is that right now because we're still fetching git repos, even to get the go.mod, what I said isn't true. But once we have a better story for a proxy, it will become true, all with no effort. Because we do have a plan to get there, though, we're not planning to add any of these kinds of scopes as a temporary workaround. They'd just cause needless pain in the long run.

    https://github.com/golang/go/issues/26913#issuecomment-411976222 (10 Aug 2018)

    • That proxy now exists
    • However, it seems like go mod tidy is still fetching full git repos even for dependencies that aren't required
      • I don't think it is supposed to?
      • Can we rely on this?
Vendor Go dependencies

nut Gophers love nuts. nut is a tool that allows Go projects to declare dependencies, download dependencies, rewrite import paths and ensure that depe

Sep 27, 2022
Gohack: mutable checkouts of Go module dependencies

Gohack: mutable checkouts of Go module dependencies The new Go module system is awesome. It ensures repeatable, deterministic builds of Go code.

Dec 12, 2022
Go-htutil - Go HTTP utilities, with no dependencies

snai.pe/go-htutil go get snai.pe/go-htutil Go HTTP utilities with no dependenci

Jan 26, 2022
Checks if there are any updates for imports in your module.

Go Up goup checks if there are any updates for imports in your module. It parses go.mod files to get dependencies with their version, uses go-git to r

Jul 7, 2022
Package Management for Golang
Package Management for Golang

Glide: Vendor Package Management for Golang Are you used to tools such as Cargo, npm, Composer, Nuget, Pip, Maven, Bundler, or other modern package ma

Dec 27, 2022
A simple dependency manager for Go (golang), inspired by Bundler.
A simple dependency manager for Go (golang), inspired by Bundler.

Goop A dependency manager for Go (golang), inspired by Bundler. It is different from other dependency managers in that it does not force you to mess w

Sep 27, 2022
Golang Version Manager

g 注意:master分支可能处于开发之中并非稳定版本,请通过tag下载稳定版本的源代码,或通过release下载已编译的二进制可执行文件。 g是一个Linux、macOS、Windows下的命令行工具,可以提供一个便捷的多版本go环境的管理和切换。 特性 支持列出可供安装的go版本号 支持列出已安

Dec 30, 2022
Go Package Manager (gopm) is a package manager and build tool for Go.

?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? In favor of Go Modules Proxy since Go 1.11, this pr

Dec 14, 2022
Create and manage Isolated Virtual Environments for Go
Create and manage Isolated Virtual Environments for Go

VenGO Create and manage Isolated Virtual Environments for Golang. Motivation Why a tool to generate and manage virtual environments in Go?. Well, some

Jan 6, 2023
Package core is a service container that elegantly bootstrap and coordinate twelve-factor apps in Go.

Package core is a service container that elegantly bootstrap and coordinate twelve-factor apps in Go. Background The twelve-factor methodology has pro

Nov 3, 2022