I am getting a dependency error on my go build and I don't understand it yet. Building and compiling locally works just fine. The issue is when I try to run and build in my docker container then I get this error.
go: github.com/go-openapi/[email protected] requires
gopkg.in/[email protected]: unrecognized import path "gopkg.in/check.v1": reading https://gopkg.in/check.v1?go-get=1: 502 Bad Gateway
server response: Cannot obtain refs from GitHub: cannot talk to GitHub: Get https://github.com/go-check/check.git/info/refs?service=git-upload-pack: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
It appears that it cannot reach out to the package to get the correct version (502) but also could be some sort of version mismatch in my go packages. Not sure how to resolve.
Here is my build command:
RUN cd /go/src/webservice_redfalcon/ && go mod init && go mod tidy && go mod download
RUN cd /go/src/webservice_redfalcon/cmd/redfalcon-server && CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o /app/server
And my go version is 1.19
Any help would be much appreciated.
So the root issue appeared to be some sort of connectivity with github.com and retrieving the package. Once that networking issue was fixed then the 502 went away and it worked fine.