Unexpected environment variable value

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

      - 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

      - 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?

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.

Yep, with quotes that works as expected, thanks!

Awesome! Very glad to hear.

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