mirror of
https://github.com/openshift/source-to-image.git
synced 2026-02-05 03:45:02 +01:00
chore(hack): Go Modules based scripts.
This commit is contained in:
2
Makefile
2
Makefile
@@ -32,7 +32,7 @@ verify: build
|
||||
hack/verify-gofmt.sh
|
||||
hack/verify-golint.sh
|
||||
hack/verify-govet.sh
|
||||
hack/verify-godeps.sh || true # remove this to make godepchecker's warnings actionable
|
||||
hack/verify-deps.sh
|
||||
hack/verify-bash-completion.sh
|
||||
.PHONY: verify
|
||||
|
||||
|
||||
@@ -92,6 +92,7 @@ s2i::build::build_binaries() {
|
||||
CGO_ENABLED=0 go install "${goflags[@]:+${goflags[@]}}" \
|
||||
-pkgdir "${S2I_OUTPUT_PKGDIR}" \
|
||||
-ldflags "${version_ldflags} ${RELEASE_LDFLAGS}" \
|
||||
-mod vendor \
|
||||
"${binaries[@]}"
|
||||
s2i::build::unset_platform_envs "${platform}"
|
||||
done
|
||||
@@ -175,7 +176,6 @@ s2i::build::create_gopath_tree() {
|
||||
#
|
||||
# Input Vars:
|
||||
# S2I_EXTRA_GOPATH - If set, this is included in created GOPATH
|
||||
# S2I_NO_GODEPS - If set, we don't add 'vendor' to GOPATH
|
||||
#
|
||||
# Output Vars:
|
||||
# export GOPATH - A modified GOPATH to our created tree along with extra
|
||||
@@ -195,6 +195,9 @@ EOF
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Enabling support for Go Modules.
|
||||
export GO111MODULE=on
|
||||
|
||||
# For any tools that expect this to be set (it is default in golang 1.6),
|
||||
# force vendor experiment.
|
||||
export GO15VENDOREXPERIMENT=1
|
||||
@@ -206,12 +209,6 @@ EOF
|
||||
GOPATH="${GOPATH}:${S2I_EXTRA_GOPATH}"
|
||||
fi
|
||||
|
||||
# Append the tree maintained by `godep` to the GOPATH unless S2I_NO_GODEPS
|
||||
# is defined.
|
||||
if [[ -z ${S2I_NO_GODEPS:-} ]]; then
|
||||
GOPATH="${GOPATH}:${S2I_ROOT}/vendor"
|
||||
fi
|
||||
|
||||
if [[ "$OSTYPE" == "cygwin" ]]; then
|
||||
GOPATH=$(cygpath -w -p $GOPATH)
|
||||
fi
|
||||
|
||||
@@ -8,6 +8,6 @@ STARTTIME=$(date +%s)
|
||||
|
||||
echo $(go version)
|
||||
|
||||
go get github.com/tools/godep golang.org/x/lint/golint
|
||||
GO111MODULE=off go get golang.org/x/lint/golint
|
||||
|
||||
ret=$?; ENDTIME=$(date +%s); echo "$0 took $(($ENDTIME - $STARTTIME)) seconds"; exit "$ret"
|
||||
|
||||
@@ -16,8 +16,7 @@ find_test_dirs() {
|
||||
cd "${S2I_ROOT}"
|
||||
find . -not \( \
|
||||
\( \
|
||||
-wholename './Godeps' \
|
||||
-o -wholename './release' \
|
||||
-wholename './release' \
|
||||
-o -wholename './target' \
|
||||
-o -wholename './vendor' \
|
||||
-o -wholename '*/_output/*' \
|
||||
|
||||
@@ -7,6 +7,6 @@ set -o pipefail
|
||||
S2I_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
source "${S2I_ROOT}/hack/common.sh"
|
||||
|
||||
s2i::build::build_binaries tools/depchecker
|
||||
|
||||
_output/local/go/bin/depchecker
|
||||
# double check the dependencies stored in vendor directory with the described dependency list in
|
||||
# local Go Module files, go.mod and go.sum.
|
||||
go mod verify
|
||||
@@ -8,7 +8,7 @@ echo $(go version)
|
||||
|
||||
if ! which golint &>/dev/null; then
|
||||
echo "Unable to detect 'golint' package"
|
||||
echo "To install it, run: 'go get github.com/golang/lint/golint'"
|
||||
echo "To install it, run: 'go get -u golang.org/x/lint/golint'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user