I’ve had several situations in which it magically seemed to work for one single revisions. But as soon as I update revisions I repeat to get into the same troubles that always take hours to resolve.
Here’s what I have so far:
- Github SSH is set up and working as far as I can tell.
- Local build is working
- Go mod contains the revision I want to use
The magical couple of times it worked I had the following build process:
In a bash-script I to the following
go clean -modcache go mod tidy go mod download go mod vendor
In a Dockerfile:
FROM golang:1.16-buster AS build WORKDIR /app COPY go.mod ./ COPY go.sum ./ COPY vendor ./ COPY *.go ./ ENV GO111MODULE=on RUN go build -o /<product-name>
This continues to stop working for incomprehensible reasons with the error message:
This while local build works flawlessly and the vendor folder contains the revision, modules.txt
# github.com/.../... v0.0.3 ## explicit github.com/.../.../...
As the error keeps coming back I lost any confidence in my understanding of what I’m doing concerning the go module system.
I would be super happy if anyone could come up with a step by step guide that reliably builds go projects with private dependencies in a docker container and does that in a reproducible manner.
Thanks in advance