machine:
  environment:
    PATH: "/usr/local/go/bin:/usr/local/go_workspace/bin:~/.go_workspace/bin:${PATH}"

dependencies:
  override:
    - mkdir -p ~/.go_project/src/github.com/${CIRCLE_PROJECT_USERNAME}
    - ln -s ${HOME}/${CIRCLE_PROJECT_REPONAME} ${HOME}/.go_project/src/github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}
    # './...' is a relative pattern which means all subdirectories
    - go get github.com/mitchellh/gox
    - go get github.com/aktau/github-release
    - go get -t -d -v ./...
    - gox -output="srcds_exporter_{{.OS}}_{{.Arch}}" -verbose ./...
    - github-release release --draft -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -t ${CIRCLE_BRANCH}-build
    - find . -name "srcds_exporter_*" -exec sh -c 'github-release upload -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -t "${CIRCLE_BRANCH}" -n "${1/.\/}" -f "$1"' _ {} \;

test:
  override:
    # './...' is a relative pattern which means all subdirectories
    - go test -v -race ./...

machine:
  environment:
    PATH: "/usr/local/go/bin:/usr/local/go_workspace/bin:~/.go_workspace/bin:${PATH}"

dependencies:
  override:
    - mkdir -p ~/.go_project/src/github.com/${CIRCLE_PROJECT_USERNAME}
    - ln -s ${HOME}/${CIRCLE_PROJECT_REPONAME} ${HOME}/.go_project/src/github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}
    # './...' is a relative pattern which means all subdirectories
    - go get github.com/mitchellh/gox
    - go get github.com/aktau/github-release
    - go get -t -d -v ./...
    - gox -output="srcds_exporter_{{.OS}}_{{.Arch}}" -verbose ./...
    - github-release release --draft -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -t ${CIRCLE_BRANCH}-build
    - for file in "srcds_exporter_*"; do github-release upload -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -t ${CIRCLE_BRANCH}-build -n "${file}" -f "$${file}"; done

test:
  override:
    # './...' is a relative pattern which means all subdirectories
    - go test -v -race ./...

Use for loop for the upload
Use for loop for the upload
