Created
March 27, 2019 15:49
-
-
Save nilium/92ba49be56a8c2cedb82f509a69ae2e5 to your computer and use it in GitHub Desktop.
Short script to list all non-stdlib sources used by a Go package
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
#!/usr/bin/env bash | |
comm -23 \ | |
<(go list -f '{{.ImportPath}}{{"\n"}}{{range .Deps}}{{.}}{{"\n"}}{{end}}' "$@" | sort | uniq) \ | |
<(go list std | sort) | | |
xargs go list -f '{{$dir := .Dir}}{{range .GoFiles}}{{$dir}}/{{.}}{{"\n"}}{{end}}' | | |
sort | uniq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment