go: Drop unnecessary backslash-escape

There's no backslash interpretation going on within single-quote strings
which means there's no need to escape the backslash. Since this was going
on within single-quote strings the $exclude variable ended up having 2
backslashes (`\\`) instead of the intended single backslash. This meant
that the regex that was built up was incorrect. For example prometheus'
exclude contents before and after this change are:

✕: \(/_\|examples\|Godeps\|testdata\\|documentation/prometheus-mixin\)
✓: \(/_\|examples\|Godeps\|testdata\|documentation/prometheus-mixin\)

This is a port of 60543c4f9e
This commit is contained in:
adisbladis 2022-06-14 19:10:44 +08:00
parent 31102e0753
commit df791b8057

View file

@ -266,7 +266,7 @@ let
IFS=' ' read -r -a excludedArr <<<$excludedPackages IFS=' ' read -r -a excludedArr <<<$excludedPackages
printf -v excludedAlternates '%s\\|' "''${excludedArr[@]}" printf -v excludedAlternates '%s\\|' "''${excludedArr[@]}"
excludedAlternates=''${excludedAlternates%\\|} # drop final \| added by printf excludedAlternates=''${excludedAlternates%\\|} # drop final \| added by printf
exclude+='\\|'"$excludedAlternates" exclude+='\|'"$excludedAlternates"
fi fi
exclude+='\)' exclude+='\)'