go is not the language of each project should be set GOPATH alone?

 

go is not the language of each project should be set separately GOPATH?
For example, I go all the unified management of the project in d:/workspace/go_work/the list below, there are three projects under the directory project_01, project_02, project_03:

d:/workspace/go_work/project_01
d:/workspace/go_work/project_02
d:/workspace/go_work/project_03 

Question:
1, I GOPATHwas not trying to set up three, separated by a semicolon? Like this:

d:/workspace/go_work/project_01;d:/workspace/go_work/project_02;d:/workspace/go_work/project_03 

2, there are 100 projects is not necessary in GOPATHadding 100 in?

 

========anwser=========

There are three bin pkg src directory GOPATH
1. Your project_01 can be placed under the src directory, so you do not need to set up a time
2. Your project_01 placed anywhere, as long as the absence GOPATH, use go mod, premise It is your go version 1.11

 

---------

No, on one system (a user) only a gopath.

gopath / src / item should be placed here.
gopath / pkg / go by the management, deposit some intermediate results are compiled.
gopath / bin / is used to store software programs, go install copies after the project is compiled into here, and then they can directly call the command line.

Future versions go along with the use gomodule, gopath soon abandoned, the project is no longer dependent on gopath.

 
-----------
 

A GOPATH on it, and many projects are on the inside, for example, I was like this:


➜  go echo $GOPATH
/Users/xxxx/go

➜  go tree -L 2 $GOPATH
.
├── bin
│   ├── bee
│   ├── beeHello
│   ├── cobra
│   ├── dlv
│   ├── fillstruct
│   ├── geth
│   ├── geth-tps
│   ├── glide
│   ├── go-outline
│   ├── go-symbols
│   ├── gocode
│   ├── goconvey
│   ├── godef
│   ├── godoc
│   ├── golint
│   ├── gomodifytags
│   ├── gopkgs
│   ├── goplay
│   ├── gorename
│   ├── goreturns
│   ├── gotests
│   ├── govendor
│   ├── guru
│   ├── hi
│   ├── impl
│   ├── puppeth
│   └── rlpdump
├── pkg
│   └── darwin_amd64
└── src
    ├── awesomeProject
    ├── beeHello
    ├── github.com
    ├── golang.org
    ├── gopkg.in
    ├── govendor
    └── sourcegraph.com

 

Guess you like

Origin www.cnblogs.com/fengff/p/11453992.html