github.com/edxfund/validator@v1.8.16-0.20181020093046-c1def72855da/build/env.sh (about)

     1  #!/bin/sh
     2  
     3  set -e
     4  
     5  if [ ! -f "build/env.sh" ]; then
     6      echo "$0 must be run from the root of the repository."
     7      exit 2
     8  fi
     9  
    10  # Create fake Go workspace if it doesn't exist yet.
    11  workspace="$PWD/build/_workspace"
    12  root="$PWD"
    13  ethdir="$workspace/src/github.com/EDXFund"
    14  rm -fr "$ethdir/Validator"
    15  if [ ! -L "$ethdir/Validator" ]; then
    16      mkdir -p "$ethdir"
    17      cd "$ethdir"
    18      ln -svf ../../../../../. Validator
    19      cd "$root"
    20  fi
    21  
    22  # Set up the environment to use the workspace.
    23  GOPATH="$workspace"
    24  export GOPATH
    25  
    26  # Run the command inside the workspace.
    27  echo "$ethdir/Validator"
    28  cd "$ethdir/Validator"
    29  PWD="$ethdir/Validator"
    30  
    31  # Launch the arguments with the configured environment.
    32  exec "$@"