Skip to content

Instantly share code, notes, and snippets.

@kmcquade
Created December 16, 2020 18:24
Show Gist options
  • Save kmcquade/bc95826fb32123d04288859b632e2477 to your computer and use it in GitHub Desktop.
Save kmcquade/bc95826fb32123d04288859b632e2477 to your computer and use it in GitHub Desktop.
  • To list all dependencies:
go list std | tr -d "\[|\]" | tr " " "\n" | sort -u > std-library
go list -f {{.Deps}} | tr -d "\[|\]" | tr " " "\n" | sort -u > all-dependencies
sort std-library std-library all-dependencies | uniq -u

Others:

go list -f {{.Deps}} # this lists all dependencies
go list -f '{{ .Imports }}' # just list what is imported (not full transitive dependenciesdepdencnies)
go list std # list packages in the standard library you should exclude from the Deps/Imports lists
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment