This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [libgo, build] Avoid echo -n in gotest
- From: Ian Lance Taylor <iant at google dot com>
- To: Andreas Schwab <schwab at redhat dot com>
- Cc: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>, gcc-patches at gcc dot gnu dot org, Ralf Wildenhues <Ralf dot Wildenhues at gmx dot de>, gofrontend-dev at googlegroups dot com
- Date: Tue, 05 Apr 2011 12:53:53 -0700
- Subject: Re: [libgo, build] Avoid echo -n in gotest
- References: <yddlizo4vt8.fsf@manam.CeBiTec.Uni-Bielefeld.DE> <m3hbacpxvf.fsf@redhat.com>
Andreas Schwab <schwab@redhat.com> writes:
> Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
>
>> diff --git a/libgo/testsuite/gotest b/libgo/testsuite/gotest
>> --- a/libgo/testsuite/gotest
>> +++ b/libgo/testsuite/gotest
>> @@ -231,7 +231,7 @@ mkdir _test
>>
>> case "x$gofiles" in
>> x)
>> - gofiles=$(echo -n $(ls *_test.go 2>/dev/null))
>> + gofiles=$(printf "%s" "$(ls *_test.go 2>/dev/null)")
>
> There is no reason to use "echo -n" in the first place, since command
> substitution strips trailing newlines. But the printf replacement keeps
> internal newlines, unlike the original line. If that is ok then this is
> a useless use of printf, since you can just assign the output of the
> nested command directly.
Yes, this looks entirely unnecessary. I committed this patch to remove
the echo command.
Ian
diff -r 111d36d9f5b4 libgo/testsuite/gotest
--- a/libgo/testsuite/gotest Mon Apr 04 22:52:42 2011 -0700
+++ b/libgo/testsuite/gotest Tue Apr 05 12:51:21 2011 -0700
@@ -231,7 +231,7 @@
case "x$gofiles" in
x)
- gofiles=$(echo -n $(ls *_test.go 2>/dev/null))
+ gofiles=`ls *_test.go 2>/dev/null`
esac
case "x$gofiles" in
@@ -250,7 +250,7 @@
case "x$pkgfiles" in
x)
- pkgbasefiles=$(echo -n $(ls *.go | grep -v _test.go 2>/dev/null))
+ pkgbasefiles=`ls *.go | grep -v _test.go 2>/dev/null`
;;
*)
for f in $pkgfiles; do