github.com/kchristidis/fabric@v1.0.4-0.20171028114726-837acd08cde1/scripts/goListFiles.sh (about) 1 #!/bin/bash 2 # 3 # Copyright Greg Haskins All Rights Reserved. 4 # 5 # SPDX-License-Identifier: Apache-2.0 6 # 7 8 9 find_golang_src() { 10 find $1 -name "*.go" -or -name "*.h" -or -name "*.c" 11 } 12 13 list_deps() { 14 target=$1 15 16 deps=`go list -f '{{ join .Deps "\n" }}' $target` 17 18 find_golang_src $GOPATH/src/$target 19 20 for dep in $deps; 21 do 22 importpath=$GOPATH/src/$dep 23 if [ -d $importpath ]; 24 then 25 find_golang_src $importpath 26 fi 27 done 28 } 29 30 list_deps $1 | sort | uniq