machine:
  environment:
    IMPORT_PATH: "github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME"

dependencies:
  override:
    - mkdir -p "$GOPATH/src/$IMPORT_PATH"
    - rsync -azC --delete ./ "$GOPATH/src/$IMPORT_PATH/"

test:
  pre:
    - go vet ./...
  override:
    - go test ./... -race

machine:
  environment:
    IMPORT_PATH: "github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME"
    COPY_TARGET: echo $GOPATH | sed 's/:.*//'

dependencies:
  override:
    - mkdir -p "$COPY_TARGET/src/$IMPORT_PATH"
    - rsync -azC --delete ./ "$COPY_TARGET/src/$IMPORT_PATH/"

test:
  pre:
    - go vet ./...
  override:
    - go test ./... -race

Deal with multi-directory GOPATH on Circle
Deal with multi-directory GOPATH on Circle

Circle uses the non-recommended multi-directory $GOPATH, so we need to
ensure that our commands can deal with that appropriately. This adds a
COPY_TARGET ENV to the build environment which will guarantee that we
have a single directory.
