Skip to content

Instantly share code, notes, and snippets.

@mark-rushakoff
Created September 15, 2020 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mark-rushakoff/65d587799de9f3f353055333ed907807 to your computer and use it in GitHub Desktop.
Save mark-rushakoff/65d587799de9f3f353055333ed907807 to your computer and use it in GitHub Desktop.
Find packages that are declared in your project but not referenced anywhere
go list -test ./... | sort -u > /tmp/full_list_with_tests
go list -test -json ./... | jq -r '.Deps | map(select(startswith("github.com/YOUR/PROJECT/"))) | join("\n")' | sort -u > /tmp/is_depended_with_tests
comm -23 /tmp/full_list_with_tests /tmp/is_depended_with_tests | grep -v '.test$'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment