Skip to content

Instantly share code, notes, and snippets.

@rusq
Created May 1, 2019 11:12
Show Gist options
  • Save rusq/785756b3655e4928d2fca67d7cf3e1c9 to your computer and use it in GitHub Desktop.
Save rusq/785756b3655e4928d2fca67d7cf3e1c9 to your computer and use it in GitHub Desktop.
List all gofiles in current package without vendor subdirectory.
#!/bin/sh
# List all gofiles with full path in the current package without vendor subdirectory.
# Useful for dependency tracking in Makefiles.
# License: WTFPL
go list -f "{{.Dir}}:{{.GoFiles}}" ./... \
| tr -d '[]' \
| awk 'BEGIN{FS=":"}{n=split($2,files," "); for (i=1; i<=n; i++) { printf ("%s/%s ",$1, files[i]); } ; };'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment