gosec.sh: avoid code dup
Code duplication is evil in any language; It's even more evil in bash,
because it's bash.
@@ -7,10 +7,10 @@ mkdir -p $ARTIFACTS
echo "Run go sec in pkg"
cd $KUBEVIRT_DIR/pkg
-if [ -z $GOSEC ]; then
- gosec -sort -quiet -out=${ARTIFACTS}/junit-gosec.xml -exclude-dir=testutils -fmt=junit-xml ./...
-else
+ARGS="-sort -quiet -out=${ARTIFACTS}/junit-gosec.xml -exclude-dir=testutils -fmt=junit-xml ./..."
+if [ ! -z $GOSEC ]; then
echo "Running subset"
echo $GOSEC
- gosec -include=$GOSEC -sort -quiet -out=${ARTIFACTS}/junit-gosec.xml -exclude-dir=testutils -fmt=junit-xml ./...
+ ARGS="-include=$GOSEC $ARGS"
fi
+gosec $ARGS
