# Unexpected environment variable value

**URL:** <https://discuss.circleci.com/t/unexpected-environment-variable-value/28495>\
**Category:** Build Environment\
**Tags:** go, 2.0, golang\
**Created:** [February 20, 2019, 10:54am UTC](https://discuss.circleci.com/t/unexpected-environment-variable-value/28495 "2019-02-20T10:54:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sashayakovtseva](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@sashayakovtseva](https://discuss.circleci.com/u/sashayakovtseva)\
**Post date:** [February 20, 2019, 10:54am UTC](https://discuss.circleci.com/t/unexpected-environment-variable-value/28495/1 "2019-02-20T10:54:54Z")

</div>

Hello! I face weird behavior when setting GOCACHE=off.  
When I use

```auto
      - run:
          name: Setup environment
          command: |
            echo 'export GOPATH=$HOME/go' >> $BASH_ENV
            echo 'export GOROOT=/usr/local/go' >> $BASH_ENV
            echo 'export GOCACHE=off' >> $BASH_ENV
            echo 'export PATH=$PATH:$GOPATH/bin:$GOROOT/bin' >> $BASH_ENV
      - run:
          name: Check envs
          command: go env

```

GOCACHE is set correctly to “of”, but when doing

```auto
      - run:
          name: Setup environment
          command: |
            echo 'export GOPATH=$HOME/go' >> $BASH_ENV
            echo 'export GOROOT=/usr/local/go' >> $BASH_ENV
            echo 'export PATH=$PATH:$GOPATH/bin:$GOROOT/bin' >> $BASH_ENV
      - run:
          name: Check envs
          environment:
            GOCACHE: off
          command: go env

```

I see GOCACHE=“0” which then leads to build errors as go tries to access directory named “0”.  
Any suggestions?

---

<div class="post-metadata">

**Author:** ![drazisil](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/drazisil/32/24029_2.png) [@drazisil](https://discuss.circleci.com/u/drazisil)\
**Post date:** [February 20, 2019, 3:16pm UTC](https://discuss.circleci.com/t/unexpected-environment-variable-value/28495/2 "2019-02-20T15:16:48Z")

</div>

What happens if you put it in quotes, such as `GOCACHE: "off"` ?

I’m wondering if the build agent (which is written in golang) is treating `off` as a boolean instead of a string for some strange reason.

---

<div class="post-metadata">

**Author:** ![sashayakovtseva](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@sashayakovtseva](https://discuss.circleci.com/u/sashayakovtseva)\
**Post date:** [February 20, 2019, 4:37pm UTC](https://discuss.circleci.com/t/unexpected-environment-variable-value/28495/3 "2019-02-20T16:37:13Z")

</div>

Yep, with quotes that works as expected, thanks!

---

<div class="post-metadata">

**Author:** ![drazisil](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/drazisil/32/24029_2.png) [@drazisil](https://discuss.circleci.com/u/drazisil)\
**Post date:** [February 20, 2019, 4:38pm UTC](https://discuss.circleci.com/t/unexpected-environment-variable-value/28495/4 "2019-02-20T16:38:00Z")

</div>

Awesome! Very glad to hear.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [March 2, 2019, 4:45pm UTC](https://discuss.circleci.com/t/unexpected-environment-variable-value/28495/5 "2019-03-02T16:45:09Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
