'is not within a known GOPATH/src' error on dep init

When I run dep init in project folder, the error occurs:

init failed: unable to detect the containing GOPATH: D:\projects\foo is not within a known GOPATH/src

My projects are located on another drive and not %GOPATH%/src (i.e. %USERPROFILE%\go\src ).

It’s a known error but it’s unclear what is the solution.

How can I use dep without moving Go projects to %GOPATH%/src ?

1 Like