-
-
Save patrickdevivo/ca949754c1661a301b3f84705bfc3301 to your computer and use it in GitHub Desktop.
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
SELECT | |
str_split(mod, '/', 0) || '/' || str_split(mod, '/', 1) || '/' || str_split(mod, '/', 2) AS repo, -- this is a bit whacky, need to get the repo part of the module path | |
contents -- the actual LICENSE file | |
FROM | |
(select json_extract(value, '$.mod.path') AS mod from files f, json_each(go_mod_to_json(contents), '$.require') j WHERE f.path = 'go.mod') AS deps, | |
files('https://' || repo) -- this will clone every every repo to a temp directory | |
WHERE repo IS NOT NULL | |
AND path = 'LICENSE' | |
AND repo LIKE 'github.com%' -- was failing on some non-git dependencies, shortcut for now, but limits to modules only on GitHub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment