1
0
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:
Otávio Fernandes
2019-10-28 11:01:00 +01:00
parent d0e1861f16
commit f5758afc40
6 changed files with 11 additions and 15 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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"

View File

@@ -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/*' \

View File

@@ -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

View File

@@ -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