github.com/hashicorp/packer@v1.14.3/scripts/off_gopath.sh (about)

     1  #! /usr/bin/env bash
     2  # Copyright (c) HashiCorp, Inc.
     3  # SPDX-License-Identifier: BUSL-1.1
     4  
     5  
     6  set -eu -o pipefail
     7  
     8  gpath=${GOPATH:-}
     9  if [ -z "$gpath" ]; then
    10    gpath=$HOME/go
    11  fi
    12  
    13  reldir=`dirname $0`
    14  curdir=`pwd`
    15  cd $reldir
    16  CUR_GO_DIR=`pwd`
    17  cd $curdir
    18  
    19  if [[ $CUR_GO_DIR == *"$gpath"* ]]; then
    20    # echo "You're on the gopath"
    21    exit 1
    22  else
    23    # echo "You're not on the gopath"
    24    exit 0
    25  fi