Last active
September 29, 2015 00:33
-
-
Save dgnorton/cc4dcec04affc0e61f79 to your computer and use it in GitHub Desktop.
This file contains 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/sh | |
total=0 | |
# loop through all package directories in the project | |
for dir in $(go list ./...); do | |
# prepend $GOPATH src directory | |
dir="$GOPATH/src/$dir" | |
# count lines of Go code in the directory | |
cnt=$(cloc ${dir}/* | egrep "^Go" | awk '{printf $5}') | |
# print the result | |
printf "%s: %d\n" "$dir" $cnt | |
# add to the running total | |
total=$((total + cnt)) | |
done | |
# print the grand total | |
printf "total: %d\n" $total |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment