Dep: init failed: unable to detect the containing GOPATH

Created on 10 Jan 2018  路  5Comments  路  Source: golang/dep

What version of dep are you using (dep version)?

dep:
 version     : devel
 build date  :
 git hash    :
 go version  : go1.9.2
 go compiler : gc
 platform    : windows/amd64

What dep command did you run?

dep init

go env

set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=D:\GOPATH
set GORACE=
set GOROOT=D:\Go
set GOTOOLDIR=D:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\ufo\AppData\Local\Tem
p\go-build971455519=/tmp/go-build -gno-record-gcc-switches
set CXX=g++
set CGO_ENABLED=1
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config

What did you see instead?

init failed: unable to detect the containing GOPATH: E:\Project\allproject_git\worker is not within
a known GOPATH/src

worker is an empty folder.


ASLO tried with release version :

ctx.DetectProjectGOPATH: E:\Project\allproject_git\xxx is not within a known GOPATH/src

PS: why don't you add .exe to windows binary name?

Most helpful comment

every project needs to be developed under GOPATH, it is very sucks. It's 9102 now, man.

All 5 comments

Does this mean I have to develop go program under $GOPATH ?

@eromoe Hi, you are right about developing within $GOPATH. That's how go development works right? 馃槄 You can read more about that here https://golang.org/doc/code.html#GOPATH

PS: why don't you add .exe to windows binary name?

We have done that already and the next release would have .exe suffix. Refer the changelog https://github.com/golang/dep/blob/master/CHANGELOG.md.

Closing the issue.

every project needs to be developed under GOPATH, it is very sucks. It's 9102 now, man.

every project needs to be developed under GOPATH, it is very sucks. It's 9102 now, man.

use version 1.11+
https://medium.com/mindorks/create-projects-independent-of-gopath-using-go-modules-802260cdfb51

Isn't the best practice to use Go Modules instead of GOPATH???

Was this page helpful?
0 / 5 - 0 ratings