As you start working with Go, one other thing you may want to add to your 
~/.bash_profile (on linux and mac, not sure about others) is



CDPATH=.:$GOPATH/src/code.google.com/p:$GOPATH/src/github.com:$GOPATH/src/bitbucket.org
export CDPATH

so let's say you have $GOPATH as 

/home/my-name/work/golang

and a project at $GOPATH/src/github.com/fmpwizard/my-project

without the CDPATH, you would have to do :

cd $GOPATH/src/github.com/fmpwizard/my-project to go in there

with CDPATH you simply do

cd fmp (press tab and autocomplete will fill in the rest)

(not my original idea, got it From Rob 
Pike https://twitter.com/rob_pike/status/467367507305574400 )


Thanks

On Friday, September 23, 2016 at 7:48:06 AM UTC-4, leon.j...@gmail.com 
wrote:
>
> Thanks for the response, it makes sense now.
>
> On Friday, September 23, 2016 at 12:13:30 AM UTC-4, leon.j...@gmail.com 
> wrote:
>>
>> I'm new to golang, and I'm trying to understand the role of GOPATH. The 
>> OS X package from https://golang.org/dl/ installs to 
>> `/usr/local/go/bin/go`. 
>>
>> Do I have to manually symlink /usr/local/go/bin/go to my PATH because the 
>> GOPATH docs lead me to believe that GOPATH to need to be set to the 
>> directory where my go code is located. 
>>
>> Example of my code directories:
>>
>> git
>> ├── bitbucket
>> │   └── demo1
>> ├── github
>> │   ├── notes
>> │   ├── scripts
>> │   └── snippets
>> ├── github-work
>> │   ├── ruby-app1
>> │   ├── ruby-app2
>> │   └── ruby-app3
>> └── gitlab
>>     ├── javascript-app1
>>     ├── python-app1
>>     └── (go-app1)
>>
>> I'd like to be able to keep this structure the same, but I don't see how 
>> this is possible with GOPATH pointing to a single directory. 
>>
>> What if I want to organize my code by version control location and not by 
>> language?
>>
>>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to