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

Disable go module strict mode #2236

Merged
merged 1 commit into from Jun 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions .envrc
Expand Up @@ -63,8 +63,10 @@ fi
# Project Configuration #
#########################

# Enable Go modules
export GO111MODULE=on
# Enable Go module as 'auto' because we want people working outside the $GOPATH
# and we also want dependencies in pre-commit to use $GOPATH instead of managing them
# locally in the ~/.cache/pre-commit/repo*/ directories.
export GO111MODULE=auto

# Capture the root directory of the project. This works even if someone `cd`s
# directly into a subdirectory.
Expand Down
16 changes: 14 additions & 2 deletions scripts/check-gopath
@@ -1,15 +1,27 @@
#! /usr/bin/env bash

gpath=$GOPATH
set -eu -o pipefail

gpath=${GOPATH:-}
if [ -z "$gpath" ]; then
gpath=$HOME/go
fi

# Strip a trailing slash off of gpath if it exists (makes binpath below more robust)
gpath=${gpath%/}

goodpath=$gpath/src/github.com/transcom/mymove

# Ensure project not in GOPATH
if [ "$PWD" -ef "$goodpath" ]; then
echo "In order to build tools the project must NOT be checked out into your gopath"
echo "read more at https://github.com/golang/go/wiki/Modules"
echo "Found in: $goodpath"
exit 1
fi

# shellcheck disable=SC2154
if [[ "$gpath" == *"$home" ]]; then
if [[ "$gpath" == *"$HOME" ]]; then
if [[ ! ":$PATH:" == *":$gpath/bin:"* ]] && [[ ! ":$PATH:" == *":~${gpath#$HOME}/bin:"* ]]; then
echo "In order for go dependencies to be runnable, \$GOPATH/bin must be in your \$PATH"
echo "Please add $gpath/bin to your \$PATH in your .bash_profile"
Expand Down