Trouble with go module version in docker build

Can you share perhaps your Dockerfile and pinpoint the location where the error occurs?

And where do you run go mod tidy? In the dockerfile? Or on your host? If the latter I’m wondering how running something on the host could affect the build in the host, unless you are copying some files over that shouldn’t be there, which would either mean your .dockerignore is not covering all the details, or even worse you are relying on a volume that holds your source code rather than using COPY/ADD.