From b26a7a2b884e334e4b1775b22f81230a755ad942 Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Tue, 6 Apr 2010 10:53:48 -0700 Subject: [PATCH] fix deps.bash. \t does not mean tab in some seds. also: add /dev/null to the ls args to repair handling of empty dependency lists. R=rsc CC=golang-dev https://golang.org/cl/883045 --- src/pkg/deps.bash | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pkg/deps.bash b/src/pkg/deps.bash index 73888dff00f..c8406d39cf6 100755 --- a/src/pkg/deps.bash +++ b/src/pkg/deps.bash @@ -18,10 +18,12 @@ dirpat=$(echo $dirs | sed 's/ /|/g; s/.*/^(&)$/') for dir in $dirs; do ( cd $dir || exit 1 - sources=$(sed -n 's/^[ \t]*\([^ \t]*\.go\)[ \t]*\\*[ \t]*$/\1/p' Makefile) + sources=$(sed -n 's/^[ ]*\([^ ]*\.go\)[ ]*\\*[ ]*$/\1/p' Makefile) sources=$(echo $sources | sed 's/\$(GOOS)/'$GOOS'/g') sources=$(echo $sources | sed 's/\$(GOARCH)/'$GOARCH'/g') - sources=$(ls $sources 2> /dev/null) # remove .s, .c, etc. + # /dev/null here means we get an empty dependency list if $sources is empty + # instead of listing every file in the directory. + sources=$(ls $sources /dev/null 2> /dev/null) # remove .s, .c, etc. deps=$( sed -n '/^import.*"/p; /^import[ \t]*(/,/^)/p' $sources /dev/null |