Created
October 16, 2024 08:55
-
-
Save renta/ffc8aad8f8d422a67110fc349f75a95a to your computer and use it in GitHub Desktop.
Find Go module names and their licenses in the 1-st level of the directory in all Golang modules with .git folder.
This file contains hidden or 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
#!/bin/sh | |
set -ex | |
go install github.com/google/go-licenses@latest | |
find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && [ -d ".git" ] && [ -f "go.mod" ] && go-licenses report --include_tests --ignore gitlab.my-company.com/my-unit --ignore my-company/awesome-unit ./... >> ../licenses.csv 2> /dev/null" \; | |
sort licenses.csv > licenses_sort.csv && rm -f licenses.csv && mv licenses_sort.csv licenses.csv | |
uniq licenses.csv > licenses_uniq.csv && rm -f licenses.csv && mv licenses_uniq.csv licenses.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment