From 75a430f66760802bf1ac5afcd716613e3cf8c77d Mon Sep 17 00:00:00 2001
From: Sören Tempel <soeren+git@soeren-tempel.net>
Date: Tue, 19 Jul 2022 07:15:25 +0200
Subject: [PATCH] libgo: make match.sh POSIX-shell compatible

The `(( expression ))` syntax is a Bash extension. However, the
arithmetic expressions used by the gobuild() function can also
be expressed using  Arithmetic POSIX Expansion with `$(( expression ))`.
Contrary to the Bash expression, the Arithmetic Expansion doesn't set
the return value if the expression is non-zero but instead just prints
the expression result. Hence, the expression also needs to be negated.
---
 libgo/match.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libgo/match.sh b/libgo/match.sh
index 7ed587ff794..b355d47429a 100755
--- a/libgo/match.sh
+++ b/libgo/match.sh
@@ -111,7 +111,7 @@ gobuild() {
     if test "$goarch" != "386"; then
 	line=$(echo "$line" | sed -e "s/\\(${wrap}\\)386\\(${wrap}\\)/\10\2/g")
     fi
-    (($line))
+    return $((!line))
 }
 
 matched=
