Skip to content

Commit

Permalink
Format shell scripts (#555)
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <tamal@appscode.com>
  • Loading branch information
tamalsaha committed Nov 22, 2020
1 parent 446734b commit 2050319
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 20 deletions.
6 changes: 3 additions & 3 deletions hack/build.sh
Expand Up @@ -35,8 +35,8 @@ export GOOS="${OS}"
export GO111MODULE=on
export GOFLAGS="-mod=vendor"

go install \
-installsuffix "static" \
go install \
-installsuffix "static" \
-ldflags " \
-X main.Version=${VERSION} \
-X main.VersionStrategy=${version_strategy:-} \
Expand All @@ -47,5 +47,5 @@ go install \
-X main.GoVersion=$(go version | cut -d " " -f 3) \
-X main.Compiler=$(go env CC) \
-X main.Platform=${OS}/${ARCH} \
" \
" \
./...
10 changes: 5 additions & 5 deletions hack/coverage.sh
Expand Up @@ -24,11 +24,11 @@ pushd $REPO_ROOT
echo "" >coverage.txt

for d in $(go list ./... | grep -v -e vendor -e test); do
go test -v -race -coverprofile=profile.out -covermode=atomic "$d"
if [ -f profile.out ]; then
cat profile.out >>coverage.txt
rm profile.out
fi
go test -v -race -coverprofile=profile.out -covermode=atomic "$d"
if [ -f profile.out ]; then
cat profile.out >>coverage.txt
rm profile.out
fi
done

popd
3 changes: 2 additions & 1 deletion hack/e2e.sh
Expand Up @@ -26,4 +26,5 @@ DOCKER_REGISTRY=${DOCKER_REGISTRY:-}

echo "Running e2e tests:"
cmd="ginkgo -r --v --progress --trace ${GINKGO_ARGS} test -- --docker-registry=${DOCKER_REGISTRY} ${TEST_ARGS}"
echo $cmd; $cmd
echo $cmd
$cmd
32 changes: 21 additions & 11 deletions hack/fmt.sh
Expand Up @@ -22,17 +22,27 @@ export GOFLAGS="-mod=vendor"

TARGETS="$@"

echo "Running reimport.py"
cmd="reimport3.py ${REPO_PKG} ${TARGETS}"
$cmd
echo
if [ -n "$TARGETS" ]; then
echo "Running reimport.py"
cmd="reimport3.py ${REPO_PKG} ${TARGETS}"
$cmd
echo

echo "Running goimports:"
cmd="goimports -w ${TARGETS}"
echo $cmd; $cmd
echo
echo "Running goimports:"
cmd="goimports -w ${TARGETS}"
echo "$cmd"
$cmd
echo

echo "Running gofmt:"
cmd="gofmt -s -w ${TARGETS}"
echo "$cmd"
$cmd
echo
fi

echo "Running gofmt:"
cmd="gofmt -s -w ${TARGETS}"
echo $cmd; $cmd
echo "Running shfmt:"
cmd="find . -path ./vendor -prune -o -name '*.sh' -exec shfmt -l -w -ci -i 4 {} \;"
echo "$cmd"
eval "$cmd" # xref: https://stackoverflow.com/a/5615748/244009
echo

0 comments on commit 2050319

Please sign in to comment.