Can't change Go source file (Build on custom Docker image)

Hi!

I’ve this problem: I’m using a custom Docker image to run my CircleCI build, and I need to generate a .go file during the build and use it to replace the existing one.

But it doesn’t seem to actually overwrite the file. I can even run cat command on it, and can see that the file is correctly replaced on the CircleCI build output. But the compilation result is, somehow, using the old, overwritten file.

  1. Replace File
  2. cat file.go -> It’s correct
  3. Build -> Generates a binary using the old source file.
  4. cat file.go -> Still correct

Any idea of what could be happening? This is my config file:

version: 2
jobs:
  build:
    docker:
      - image: sirikon/grumetebuild
    working_directory: /go/src/github.com/Sirikon/grumete
    steps:
      - checkout
      - run: echo 'export PATH=$PATH:/root/.nvm/versions/node/v8.9.4/bin:/go/bin' >> $BASH_ENV
      - run: echo $PATH
      - run: cd ./webui && npm install && npm run build && npm run bind && cd ..
      - run: cat ./gingonic/assets/assets.go
      - run: go get -v -t -d ./...
      - run: go build -o grumete cmd/grumete/main.go
      - run: env GOOS=windows GOARCH=amd64 go build -o grumete.exe cmd/grumete/main.go
      - run: cat ./gingonic/assets/assets.go
      - store_artifacts:
          path: ./grumete
      - store_artifacts:
          path: ./grumete.exe

Thanks in advance!

EDIT: Solved, see below.

Solved!

If anyone in the future encounters this problem: Double-check that GOPATH is correctly defined and you’re working on a directory inside it.