Skip to content

Instantly share code, notes, and snippets.

@execjosh
Last active January 23, 2022 08:22
Show Gist options
  • Save execjosh/2e62908c6d2ee1da6ea9419d19d21789 to your computer and use it in GitHub Desktop.
Save execjosh/2e62908c6d2ee1da6ea9419d19d21789 to your computer and use it in GitHub Desktop.
A better way to install Go tool dependencies
#!/bin/bash
# Assuming ./tools/tools.go, the following will give you a list of your tools:
#
# go list -f '{{ join .Imports "\n" }}' -tags tools ./tools
#
# No need for the likes of grep, awk, sed, cut, etc.
while read -r i; do
echo "## go install ${i}"
go install "${i}"
done < <(go list -f '{{ join .Imports "\n" }}' -tags tools ./tools)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment