From: Steven McDonald Date: Sun, 2 Oct 2011 13:05:06 +0000 (+1100) Subject: add go-imports script X-Git-Url: http://git.steven-mcdonald.id.au/?p=misc.git;a=commitdiff_plain;h=d1bf60f0e76f46749e32100165574803cdf0fef6 add go-imports script this is a simple script to list stuff imported from a set of directories containing go source code. --- d1bf60f0e76f46749e32100165574803cdf0fef6 diff --git a/go-imports b/go-imports new file mode 100755 index 0000000..7423dc3 --- /dev/null +++ b/go-imports @@ -0,0 +1,12 @@ +#!/bin/sh + +# A simple script to list all imports within one or more directories +# containing Go source code. + +if test -z "$1" +then + echo >&2 "usage: go-imports DIRECTORY" + exit 1 +fi + +find "$@" -name '*.go' | xargs awk '/import \(/,/\)/ { print $NF }' | tr -d '()"' | sort -u