Last active
January 23, 2022 08:22
-
-
Save execjosh/2e62908c6d2ee1da6ea9419d19d21789 to your computer and use it in GitHub Desktop.
A better way to install Go tool dependencies
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
#!/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