4

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 ?

Rayn D
  • 579
  • 1
  • 13
  • 29

1 Answers1

6

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Shoud go project be `/usr/local/go` as its default installed folder? – alper Apr 16 '22 at 12:18
  • 1
    @alper `go install` goes to `$GOPATH/bin`, which by default is `~/go/bin`: https://stackoverflow.com/a/54429573/6309 – VonC Apr 16 '22 at 20:36