multiple gopath under Windows

578 views
Skip to first unread message

Tong Sun

unread,
Oct 11, 2013, 4:04:03 PM10/11/13
to golan...@googlegroups.com
Hi, 

I want to separate go code downloaded elsewhere and my own code. So I setup two separate directories for them both and my gopath contains two directories. Under Windows, I fount the syntax to be

 set GOPATH=D:\Go\Extn;D:\Go\Intn

However, I'm having problem compiling my code into executable under Windows.

When I tried "go build mypath\mycode.go", it builds OK without any complains, but When I tried "go install mypath\mycode.go", I get:

  go install: no install location for directory D:\Go\Intn\src\mypath outside GOPATH

Please help. 
Thanks

Kyle Lemons

unread,
Oct 11, 2013, 4:55:13 PM10/11/13
to Tong Sun, golang-nuts
On Fri, Oct 11, 2013 at 1:04 PM, Tong Sun <sunto...@gmail.com> wrote:
Hi, 

I want to separate go code downloaded elsewhere and my own code. So I setup two separate directories for them both and my gopath contains two directories. Under Windows, I fount the syntax to be

 set GOPATH=D:\Go\Extn;D:\Go\Intn

That looks right to me, but I am not a windows user so take that with a grain of salt.
 
However, I'm having problem compiling my code into executable under Windows.

When I tried "go build mypath\mycode.go", it builds OK without any complains, but When I tried "go install mypath\mycode.go", I get:

What is your PWD when you do this?  Generally you want to run "go install" when either no arguments (install the package in the current directory) or with an import path (e.g. path/to/mypath).  Perhaps try one of those?
 
  go install: no install location for directory D:\Go\Intn\src\mypath outside GOPATH

Please help. 
Thanks

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Tong Sun

unread,
Oct 11, 2013, 5:18:21 PM10/11/13
to golang-nuts
 Switching the order of the two directories in gopath won't help either. I.e., I've tried to 

set GOPATH=D:\Go\Intn;D:\Go\Extn;

When doing the"go install" but no ok.

Please help. 
Thanks

minux

unread,
Oct 11, 2013, 6:29:08 PM10/11/13
to Tong Sun, golang-nuts

go install takes a package import path, not a Go source file path.

Reply all
Reply to author
Forward
0 new messages