machine:
  environment:
    GO15VENDOREXPERIMENT: 1
    GOROOT: "/home/ubuntu/go"
    PATH: "/home/ubuntu/go/bin:$PATH"

dependencies:
  cache_directories:
    - "/home/ubuntu/.go"
  pre:
    - >
      case $CIRCLE_NODE_INDEX in 0) export GOVERSION=1.5.1 ;; 1) export GOVERSION=1.6.1 ;; esac;
      cd /home/ubuntu;
      if [[ ! -e /home/ubuntu/.go/$GOERSION/bin/go ]]; then
        curl https://storage.googleapis.com/golang/go$GOVERSION.linux-amd64.tar.gz | tar -xz;
        go get -u github.com/jstemmer/go-junit-report;
        mkdir -p ~/.go;
        cp -rp ~/go ~/.go/$GOVERSION;
      else
        cp -rp ~/.go/$GOVERSION ~/go;
      fi
    - go version



test:
  override:
    - mkdir -p $CIRCLE_TEST_REPORTS/golang:
        parallel: true    
    - go test -v $(go list ./...|grep -v vendor) | go-junit-report set-exit-code=true > $CIRCLE_TEST_REPORTS/golang/$CIRCLE_NODE_INDEX.xml:
        parallel: true

gist