From d1bf60f0e76f46749e32100165574803cdf0fef6 Mon Sep 17 00:00:00 2001 From: Steven McDonald Date: Mon, 3 Oct 2011 00:05:06 +1100 Subject: [PATCH] add go-imports script this is a simple script to list stuff imported from a set of directories containing go source code. --- go-imports | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 go-imports 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 -- 2.30.2