Pushing a legacy app running on Tohora


I’ve inherited a legacy app that compiles Tohora from source at the start of the Dockerfile i.e.

# build tohora from source
FROM balenalib/raspberrypi3-golang as builder

RUN go get -d -v github.com/mozz100/tohora/...

WORKDIR /go/src/github.com/mozz100/tohora

RUN go build

When I try to use balena push to deploy the code to my test device I get the following error,

[main]     Step 1/33 : FROM balenalib/raspberrypi3-golang as builder
[main]      ---> 448bfdca5029
[main]     Step 2/33 : RUN go get -d -v github.com/mozz100/tohora/...
[main]     Using cache
[main]      ---> a4654c443c8f
[main]     Step 3/33 : WORKDIR /go/src/github.com/mozz100/tohora
[main]     Using cache
[main]      ---> 10c44ea6653f
[main]     Step 4/33 : RUN go build
[main]      ---> Running in 164be2f108cf
[main]     go: go.mod file not found in current directory or any parent directory; see 'go help modules'
[main]     Removing intermediate container 164be2f108cf
[main]     The command '/bin/sh -c go build' returned a non-zero code: 1

This code was deployed to other production devices and is still running on them fine. I can also run the Docker build locally too with no problems and everything just builds. Can anyone suggest why the code won’t deploy here? Should I be using a different method such as git push or something?

If anyone needs to know how to fix the issue, it appears to have come about with a change of versions in go in the base image. Later versions of go fetch packages into the pkg/mod folder rather than the src folder. To go back to the old behaviour simply add ENV GO111MODULE=off before the RUN go get command