Skip to content

Instantly share code, notes, and snippets.

@nilium nilium/lssrc
Created Mar 27, 2019

Embed
What would you like to do?
Short script to list all non-stdlib sources used by a Go package
#!/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
You can’t perform that action at this time.