Skip to content

Commit d308368

Browse files
authored
Merge pull request kubernetes#76417 from SataQiu/fix-shell-update-generated-runtime-dockerized-20190411
Fix shellcheck failures of hack/update-generated-runtime-dockerized.sh
2 parents 888d26d + bd7f7fe commit d308368

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

hack/.shellcheck_failures

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
./hack/pin-dependency.sh
4545
./hack/test-integration.sh
4646
./hack/test-update-storage-objects.sh
47-
./hack/update-generated-runtime-dockerized.sh
4847
./hack/update-vendor.sh
4948
./hack/verify-api-groups.sh
5049
./hack/verify-boilerplate.sh

hack/update-generated-runtime-dockerized.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ set -o errexit
1818
set -o nounset
1919
set -o pipefail
2020

21-
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
21+
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
2222
KUBE_REMOTE_RUNTIME_ROOT="${KUBE_ROOT}/staging/src/k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
2323
source "${KUBE_ROOT}/hack/lib/init.sh"
2424

@@ -40,22 +40,24 @@ if [[ -z "$(which protoc)" || "$(protoc --version)" != "libprotoc 3."* ]]; then
4040
fi
4141

4242
function cleanup {
43-
rm -f ${KUBE_REMOTE_RUNTIME_ROOT}/api.pb.go.bak
43+
rm -f "${KUBE_REMOTE_RUNTIME_ROOT}/api.pb.go.bak"
44+
rm -f "${KUBE_REMOTE_RUNTIME_ROOT}/api.pb.go.tmp"
4445
}
4546

4647
trap cleanup EXIT
4748

48-
gogopath=$(dirname $(kube::util::find-binary "protoc-gen-gogo"))
49+
gogopath=$(dirname "$(kube::util::find-binary "protoc-gen-gogo")")
4950

5051
PATH="${gogopath}:${PATH}" \
5152
protoc \
5253
--proto_path="${KUBE_REMOTE_RUNTIME_ROOT}" \
5354
--proto_path="${KUBE_ROOT}/vendor" \
54-
--gogo_out=plugins=grpc:${KUBE_REMOTE_RUNTIME_ROOT} ${KUBE_REMOTE_RUNTIME_ROOT}/api.proto
55+
--gogo_out=plugins=grpc:"${KUBE_REMOTE_RUNTIME_ROOT}" "${KUBE_REMOTE_RUNTIME_ROOT}/api.proto"
5556

5657
# Update boilerplate for the generated file.
57-
echo "$(cat hack/boilerplate/boilerplate.generatego.txt ${KUBE_REMOTE_RUNTIME_ROOT}/api.pb.go)" > ${KUBE_REMOTE_RUNTIME_ROOT}/api.pb.go
58+
cat hack/boilerplate/boilerplate.generatego.txt "${KUBE_REMOTE_RUNTIME_ROOT}/api.pb.go" > "${KUBE_REMOTE_RUNTIME_ROOT}/api.pb.go.tmp"
59+
mv "${KUBE_REMOTE_RUNTIME_ROOT}/api.pb.go.tmp" "${KUBE_REMOTE_RUNTIME_ROOT}/api.pb.go"
5860

5961
# Run gofmt to clean up the generated code.
6062
kube::golang::verify_go_version
61-
gofmt -l -s -w ${KUBE_REMOTE_RUNTIME_ROOT}/api.pb.go
63+
gofmt -l -s -w "${KUBE_REMOTE_RUNTIME_ROOT}/api.pb.go"

0 commit comments

Comments
 (0)