Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/imjasonh/golicenses
License lookup for Go packages
https://github.com/imjasonh/golicenses
license license-management
Last synced: about 1 month ago
JSON representation
License lookup for Go packages
- Host: GitHub
- URL: https://github.com/imjasonh/golicenses
- Owner: imjasonh
- License: apache-2.0
- Created: 2022-07-15T15:31:01.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-08T02:02:15.000Z (9 months ago)
- Last Synced: 2024-04-08T03:22:59.422Z (9 months ago)
- Topics: license, license-management
- Language: Go
- Homepage:
- Size: 327 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `golicenses`
[![Go Reference](https://pkg.go.dev/badge/github.com/imjasonh/golicenses.svg)](https://pkg.go.dev/github.com/imjasonh/golicenses)
[![Update](https://github.com/imjasonh/golicenses/actions/workflows/update.yaml/badge.svg)](https://github.com/imjasonh/golicenses/actions/workflows/update.yaml)This is an **experimental** package to lookup the license for a Go package.
This is not guaranteed to work, to update regularly, or to continue to have the same API.
At a minimum, I'll probably change the repo name if I can think of something better.For example:
```golang
lic, _ := golicenses.Get("github.com/google/go-containerregistry")
fmt.Println(lic)
```prints
```
Apache-2.0
```This is based on the public BigQuery dataset provided by https://deps.dev/.
See [How are licenses determined?](https://deps.dev/faq#how-are-licenses-determined) for more information.This repo periodically queries the public dataset and regenerates `licenses.csv`, which is gzipped and `//go:embed`ed into the package.
The result is a ~3MB dependency that can be loaded and queried in ~200ms the first time -- subsequent calls take microseconds.
There are almost certainly more optimizations that could improve both size and query time. PRs welcome!