Go is compiled from source; `go get` reports unrecognized import path

3,737 views
Skip to first unread message

kirz...@gmail.com

unread,
Mar 24, 2014, 3:24:45 AM3/24/14
to golan...@googlegroups.com

Trying to install goxc for go cross-compilation. I've compiled go from sources as described in docs at golang.org. Now I'm trying to do go get, but getting unrecognized import path errors...

C:\Program Files (x86)\PowerCmd>go get github.com/laher/goxc package archive/tar: unrecognized import path "archive/tar" package archive/zip: unrecognized import path "archive/zip" package bufio: unrecognized import path "bufio" package bytes: unrecognized import path "bytes" ...

Env variables seems to be ok...

C:\Program Files (x86)\PowerCmd>go env set GOARCH=386 set GOBIN=E:\Go\bin set GOCHAR=8 set GOEXE=.exe set GOHOSTARCH=386 set GOHOSTOS=windows set GOOS=windows set GOPATH=E:\Go set GORACE= set GOROOT=E:\Go\bin set GOTOOLDIR=E:\Go\bin\pkg\tool\windows_386 set TERM=dumb set CC=gcc set GOGCCFLAGS=-g -O2 -m32 -mthreads set CXX=g++ set CGO_ENABLED=1

What's wrong, what do you think?

I've tried to run go get -v github.com/laher/goxc, maybe it could help..

C:\Program Files (x86)\PowerCmd>go get -v github.com/laher/goxc import "archive/tar": import path doesn't contain a hostname package archive/tar: unrecognized import path "archive/tar" import "archive/zip": import path doesn't contain a hostname package archive/zip: unrecognized import path "archive/zip" import "bufio": import path doesn't contain a slash package bufio: unrecognized import path "bufio" import "bytes": import path doesn't contain a slash package bytes: unrecognized import path "bytes" import "compress/gzip": import path doesn't contain a hostname ...

brainman

unread,
Mar 24, 2014, 6:24:50 PM3/24/14
to golan...@googlegroups.com, kirz...@gmail.com
I think your environment variables are not correct:

set GOBIN=E:\Go\bin
set GOPATH=E:\Go
set GOROOT=E:\Go\bin
set GOTOOLDIR=E:\Go\bin\pkg\tool\windows_386

GOBIN cannot equal GOROOT. GOROOT cannot live inside of GOPATH. If you have installed Go in e:\go directory, then GOROOT should be set to it (GOROOT=E:\Go), GOBIN does not need to be set, then it would default to %GOROOT%\bin (E:\Go\bin), same for GOTOOLDIR (it will get set to E:\Go\bin\pkg\tool\windows_386). Your GOPATH should be set to directory outside of GOROOT.

You also, probably, should re-install Go, because your GOROOT directory might be full of garbage (because your GOPATH and GOROOT are clashing).

Alex
Reply all
Reply to author
Forward
0 new messages