Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a default GOFLAGS for specific cases 🌔 #232

Merged
merged 1 commit into from
Feb 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions scripts/presubmit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ WORK_DIR=""
# yamllint config file to override some rules, see https://git.io/JvLom
YAML_LINT_CONFIG=${YAML_LINT_CONFIG:-}

# goflags to use to override default behavior (if a go.mod file and a vendor folder exists, set it "-mod=vendor")
GOFLAGS=${GOFLAGS:-}

# Returns true if PR only contains the given file regexes.
# Parameters: $1 - file regexes, space separated.
function pr_only_contains() {
Expand Down Expand Up @@ -326,6 +329,8 @@ function main() {
extra_initialization
fi

[[ -z "${GOFLAGS}" ]] && [[ -e go.mod ]] && [[ -d vendor/ ]] && export GOFLAGS="-mod=vendor"

[[ -z $1 ]] && set -- "--all-tests"

local TEST_TO_RUN=""
Expand Down