entrypoint: don't change the build tags variable

Don't change the build tags variable to include the -tags option at the
start. It's a bit confusing. Replace it with a function that returns
the option + the tags themselves for use on a go command line.
This fixes the remaining shellcheck errors in entrypoint.sh.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2022-07-18 14:52:25 -04:00 committed by mergify[bot]
parent 8e8e24a81d
commit 86802199f8
1 changed files with 8 additions and 8 deletions

View File

@ -126,6 +126,10 @@ add_build_tag() {
fi fi
} }
build_tags_arg() {
echo "-tags=${BUILD_TAGS}"
}
show() { show() {
local ret local ret
echo "*** running:" "$@" echo "*** running:" "$@"
@ -222,12 +226,12 @@ test_pkg() {
# run go vet and capture the result for the package, but still execute the # run go vet and capture the result for the package, but still execute the
# test suite anyway # test suite anyway
show go vet ${BUILD_TAGS} "./${pkg}" show go vet "$(build_tags_arg)" "./${pkg}"
ret=$? ret=$?
# disable caching of tests results # disable caching of tests results
testargs=("-count=1"\ testargs=("-count=1"\
${BUILD_TAGS}) "$(build_tags_arg)")
if [[ ${TEST_RUN} != ALL ]]; then if [[ ${TEST_RUN} != ALL ]]; then
testargs+=("-run" "${TEST_RUN}") testargs+=("-run" "${TEST_RUN}")
fi fi
@ -255,7 +259,7 @@ test_pkg() {
pre_all_tests() { pre_all_tests() {
# Prepare Go code # Prepare Go code
go get -t -v ${BUILD_TAGS} ./... go get -t -v "$(build_tags_arg)" ./...
diff -u <(echo -n) <(gofmt -d -s .) diff -u <(echo -n) <(gofmt -d -s .)
make clean-implements implements make clean-implements implements
@ -270,7 +274,7 @@ find_pkgs() {
skip='^contrib' skip='^contrib'
fi fi
# saves results in array named `pkgs` # saves results in array named `pkgs`
readarray -t pkgs < <(go list ${BUILD_TAGS} ./... | \ readarray -t pkgs < <(go list "$(build_tags_arg)" ./... | \
sed -e "s,^${PKG_PREFIX}/\?,," | \ sed -e "s,^${PKG_PREFIX}/\?,," | \
grep -vE "${skip}" | grep '.' ) grep -vE "${skip}" | grep '.' )
} }
@ -352,10 +356,6 @@ if [ -z "${BUILD_TAGS}" ]; then
fi fi
fi fi
if [ -n "${BUILD_TAGS}" ]; then
BUILD_TAGS="-tags ${BUILD_TAGS}"
fi
test_go_ceph test_go_ceph
pause_if_needed pause_if_needed