mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 03:03:59 +00:00
Merge pull request #123647 from thockin/use_go_-C_instead_of_pushd_popd
Change `pushd $d; go ...; popd` to `go -C $d ...`
This commit is contained in:
commit
19df52c41a
@ -48,10 +48,8 @@ export PATH=${GOPATH}/bin:${PWD}/third_party/etcd:/usr/local/go/bin:${PATH}
|
|||||||
export GO111MODULE=off
|
export GO111MODULE=off
|
||||||
|
|
||||||
# Install tools we need
|
# Install tools we need
|
||||||
pushd "${KUBE_ROOT}/hack/tools" >/dev/null
|
GO111MODULE=on go -C "${KUBE_ROOT}/hack/tools" install github.com/cespare/prettybench
|
||||||
GO111MODULE=on go install github.com/cespare/prettybench
|
GO111MODULE=on go -C "${KUBE_ROOT}/hack/tools" install gotest.tools/gotestsum
|
||||||
GO111MODULE=on go install gotest.tools/gotestsum
|
|
||||||
popd >/dev/null
|
|
||||||
|
|
||||||
# Disable the Go race detector.
|
# Disable the Go race detector.
|
||||||
export KUBE_RACE=" "
|
export KUBE_RACE=" "
|
||||||
|
@ -32,9 +32,7 @@ export PATH=${GOPATH}/bin:${PWD}/third_party/etcd:/usr/local/go/bin:${PATH}
|
|||||||
export GO111MODULE=off
|
export GO111MODULE=off
|
||||||
|
|
||||||
# Install tools we need
|
# Install tools we need
|
||||||
pushd "./hack/tools" >/dev/null
|
GO111MODULE=on go -C "./hack/tools" install gotest.tools/gotestsum
|
||||||
GO111MODULE=on go install gotest.tools/gotestsum
|
|
||||||
popd >/dev/null
|
|
||||||
|
|
||||||
# Disable coverage report
|
# Disable coverage report
|
||||||
export KUBE_COVER="n"
|
export KUBE_COVER="n"
|
||||||
|
@ -599,11 +599,7 @@ kube::golang::setup_gomaxprocs() {
|
|||||||
# when running in a container, please see https://github.com/golang/go/issues/33803
|
# when running in a container, please see https://github.com/golang/go/issues/33803
|
||||||
if [[ -z "${GOMAXPROCS:-}" ]]; then
|
if [[ -z "${GOMAXPROCS:-}" ]]; then
|
||||||
if ! command -v ncpu >/dev/null 2>&1; then
|
if ! command -v ncpu >/dev/null 2>&1; then
|
||||||
# shellcheck disable=SC2164
|
go -C "${KUBE_ROOT}/hack/tools" install ./ncpu || echo "Will not automatically set GOMAXPROCS"
|
||||||
pushd "${KUBE_ROOT}/hack/tools" >/dev/null
|
|
||||||
go install ./ncpu || echo "Will not automatically set GOMAXPROCS"
|
|
||||||
# shellcheck disable=SC2164
|
|
||||||
popd >/dev/null
|
|
||||||
fi
|
fi
|
||||||
if command -v ncpu >/dev/null 2>&1; then
|
if command -v ncpu >/dev/null 2>&1; then
|
||||||
GOMAXPROCS=$(ncpu)
|
GOMAXPROCS=$(ncpu)
|
||||||
|
@ -190,10 +190,8 @@ produceJUnitXMLReport() {
|
|||||||
junit_xml_filename="${junit_filename_prefix}.xml"
|
junit_xml_filename="${junit_filename_prefix}.xml"
|
||||||
|
|
||||||
if ! command -v gotestsum >/dev/null 2>&1; then
|
if ! command -v gotestsum >/dev/null 2>&1; then
|
||||||
kube::log::status "gotestsum not found; installing from hack/tools"
|
kube::log::status "gotestsum not found; installing from ./hack/tools"
|
||||||
pushd "${KUBE_ROOT}/hack/tools" >/dev/null
|
go -C "${KUBE_ROOT}/hack/tools" install gotest.tools/gotestsum
|
||||||
go install gotest.tools/gotestsum
|
|
||||||
popd >/dev/null
|
|
||||||
fi
|
fi
|
||||||
gotestsum --junitfile "${junit_xml_filename}" --raw-command cat "${junit_filename_prefix}"*.stdout
|
gotestsum --junitfile "${junit_xml_filename}" --raw-command cat "${junit_filename_prefix}"*.stdout
|
||||||
if [[ ! ${KUBE_KEEP_VERBOSE_TEST_OUTPUT} =~ ^[yY]$ ]]; then
|
if [[ ! ${KUBE_KEEP_VERBOSE_TEST_OUTPUT} =~ ^[yY]$ ]]; then
|
||||||
@ -201,10 +199,8 @@ produceJUnitXMLReport() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if ! command -v prune-junit-xml >/dev/null 2>&1; then
|
if ! command -v prune-junit-xml >/dev/null 2>&1; then
|
||||||
kube::log::status "prune-junit-xml not found; installing from hack/tools"
|
kube::log::status "prune-junit-xml not found; installing from ./cmd"
|
||||||
pushd "${KUBE_ROOT}/cmd/prune-junit-xml" >/dev/null
|
go -C "${KUBE_ROOT}/cmd/prune-junit-xml" install .
|
||||||
go install .
|
|
||||||
popd >/dev/null
|
|
||||||
fi
|
fi
|
||||||
prune-junit-xml "${junit_xml_filename}"
|
prune-junit-xml "${junit_xml_filename}"
|
||||||
|
|
||||||
|
@ -27,9 +27,7 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
|
|||||||
kube::golang::setup_env
|
kube::golang::setup_env
|
||||||
|
|
||||||
echo 'installing mockgen'
|
echo 'installing mockgen'
|
||||||
pushd "${KUBE_ROOT}/hack/tools" >/dev/null
|
go -C "${KUBE_ROOT}/hack/tools" install github.com/golang/mock/mockgen
|
||||||
go install github.com/golang/mock/mockgen
|
|
||||||
popd >/dev/null
|
|
||||||
|
|
||||||
function git_grep() {
|
function git_grep() {
|
||||||
git grep --untracked --exclude-standard \
|
git grep --untracked --exclude-standard \
|
||||||
|
@ -36,9 +36,7 @@ PATH="${GOBIN}:${PATH}"
|
|||||||
|
|
||||||
# Install golangci-lint
|
# Install golangci-lint
|
||||||
echo 'installing net parser converter'
|
echo 'installing net parser converter'
|
||||||
pushd "${KUBE_ROOT}/hack/tools" >/dev/null
|
go -C "${KUBE_ROOT}/hack/tools" install github.com/aojea/sloppy-netparser
|
||||||
go install github.com/aojea/sloppy-netparser
|
|
||||||
popd >/dev/null
|
|
||||||
|
|
||||||
cd "${KUBE_ROOT}"
|
cd "${KUBE_ROOT}"
|
||||||
|
|
||||||
|
@ -26,9 +26,7 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
|
|||||||
|
|
||||||
kube::golang::verify_go_version
|
kube::golang::verify_go_version
|
||||||
|
|
||||||
pushd "${KUBE_ROOT}/hack/tools" >/dev/null
|
go -C "${KUBE_ROOT}/hack/tools" install github.com/jcchavezs/porto/cmd/porto
|
||||||
go install github.com/jcchavezs/porto/cmd/porto
|
|
||||||
popd >/dev/null
|
|
||||||
|
|
||||||
porto --restrict-to-dirs="staging" --restrict-to-files="doc\\.go$" -w "${KUBE_ROOT}"
|
porto --restrict-to-dirs="staging" --restrict-to-files="doc\\.go$" -w "${KUBE_ROOT}"
|
||||||
|
|
||||||
|
@ -127,15 +127,13 @@ done
|
|||||||
|
|
||||||
# Install golangci-lint
|
# Install golangci-lint
|
||||||
echo "installing golangci-lint and logcheck plugin from hack/tools into ${GOBIN}"
|
echo "installing golangci-lint and logcheck plugin from hack/tools into ${GOBIN}"
|
||||||
pushd "${KUBE_ROOT}/hack/tools" >/dev/null
|
go -C "${KUBE_ROOT}/hack/tools" install github.com/golangci/golangci-lint/cmd/golangci-lint
|
||||||
go install github.com/golangci/golangci-lint/cmd/golangci-lint
|
if [ "${golangci_config}" ]; then
|
||||||
if [ "${golangci_config}" ]; then
|
# This cannot be used without a config.
|
||||||
# This cannot be used without a config.
|
# This uses `go build` because `go install -buildmode=plugin` doesn't work
|
||||||
# This uses `go build` because `go install -buildmode=plugin` doesn't work
|
# (on purpose: https://github.com/golang/go/issues/64964).
|
||||||
# (on purpose: https://github.com/golang/go/issues/64964).
|
go -C "${KUBE_ROOT}/hack/tools" build -o "${GOBIN}/logcheck.so" -buildmode=plugin sigs.k8s.io/logtools/logcheck/plugin
|
||||||
go build -o "${GOBIN}/logcheck.so" -buildmode=plugin sigs.k8s.io/logtools/logcheck/plugin
|
fi
|
||||||
fi
|
|
||||||
popd >/dev/null
|
|
||||||
|
|
||||||
if [ "${golangci_config}" ]; then
|
if [ "${golangci_config}" ]; then
|
||||||
# The relative path to _output/local/bin only works if that actually is the
|
# The relative path to _output/local/bin only works if that actually is the
|
||||||
|
@ -32,9 +32,7 @@ export GOBIN="${KUBE_OUTPUT_BIN}"
|
|||||||
PATH="${GOBIN}:${PATH}"
|
PATH="${GOBIN}:${PATH}"
|
||||||
|
|
||||||
# Install tools we need
|
# Install tools we need
|
||||||
pushd "${KUBE_ROOT}/hack/tools" >/dev/null
|
go -C "${KUBE_ROOT}/hack/tools" install github.com/client9/misspell/cmd/misspell
|
||||||
go install github.com/client9/misspell/cmd/misspell
|
|
||||||
popd >/dev/null
|
|
||||||
|
|
||||||
# Spell checking
|
# Spell checking
|
||||||
# All the skipping files are defined in hack/.spelling_failures
|
# All the skipping files are defined in hack/.spelling_failures
|
||||||
|
Loading…
Reference in New Issue
Block a user