在Docker映像上显式更改Go路径

when I run dep ensure

/home/jenkins/workspace/myproject-voter is not within a known GOPATH/src

we have go installed on this docker image , I know that the project is not cloned to go/src but my question is if via set env or something I can do some trick to overcome this issue ?

my question is if via set env or something I can do some trick to overcome this issue ?

Not "set env", but ENV:

ENV GOPATH=/path/to/your/Go/project

That would ensure any Go command is using the right workspace.