Hi I’m developing with Go, Dep.
When go commands something like go test
it’s necessary to checkout the git revision in the $GOPATH because Dep requires.
So I tried below.
version: 2
jobs:
test:
docker:
- image: golang
environment:
CUSTOM_WORK_DIR: /go/src/github.com/foo/bar
steps:
- run:
name: make go source directory
command: |
mkdir -p ${CUSTOM_WORK_DIR}
- checkout:
path: ${CUSTOM_WORK_DIR}
- run:
name: go get dep
command: |
go get -u github.com/golang/dep/cmd/dep
- run:
name: setting go environments
command: |
cd ${CUSTOM_WORK_DIR}
dep ensure
But error occurred at the build in CircleCI.
setting go environments00:00
Exit code: 1
#!/bin/bash -eo pipefail
cd ${CUSTOM_WORK_DIR}
dep ensure
could not find project Gopkg.toml, use dep init to initiate a manifest
Exited with code 1
It is determined that the environment variable is empty and checked out for an empty directory.
How can i use environment variables in checkout?