Monosij Dutta-Roy
2014-12-02 23:22:24 UTC
Hello All -
I am coming to Go from a Python / Java background and would like some help
with pointers in setting up my environment.
I have set up Go in Ubuntu - I can compile fine from directory I am in.
...
I have set GOPATH to 2 dirs: 1 for the downloading of libraries
(GOPATH_LIBS) and 1 dir for my web-app and such projects (GOPATH_PROJECTS).
export GOPATH_LIBS=/var/monosij/golang
export GOPATH_PROJECTS=/space/trials/code.trials/golang
export GOPATH=$GOPATH_LIBS:$GOPATH_PROJECTS
export PATH=$PATH:$GOPATH_LIBS/bin
export PATH=$PATH:$GOPATH_PROJECTS/bin
export GOROOT=/usr/bin/go
...
Setting up a project in GOPATH_PROJECTS.
In GOPATH_PROJECTS (*=/space/trials/code.trials/golang*) I create file
Hello.go in package Main as in:
src/github.com/mdr/run1/Hello.go
Now as per doc, I should be able to compile a file in GOPATH (ie
GOPATH_PROJECT)
While I can compile Hello.go if I am in that particular dir I CANNOT
compile if I enter:
*go install github.com/mdr/run1/Hello.go
<http://github.com/mdr/run1/Hello.go>*
Should this not be picked up from GOPATH?
...
If I include src in GOPATH_PROJECTS as in:
export GOPATH_PROJECTS=/space/trials/code.trials/golang/src
and then export it to GOPATH - I get a different error when I run: *go
install github.com/mdr/run1/Hello.go <http://github.com/mdr/run1/Hello.go>*
It says
go: cannot find GOROOT directory: /usr/bin/go
***@devel:~$ echo $GOROOT
/usr/bin/go
which go also states: /usr/bin/go.
...
I appreciate your reading through the details to please let me know what I
may be doing wrong?
Also - *why* do I need the project to be in a directory *github.com
<http://github.com/>*? Can I not just have a regular directory structure?
Regardless I would like to be able to just type:
*go install github.com/mdr/run1/Hello.go
<http://github.com/mdr/run1/Hello.go>*
*which then creates Hello in *GOPATH_PROJECTS/bin.
Thank you.
Monosij
I am coming to Go from a Python / Java background and would like some help
with pointers in setting up my environment.
I have set up Go in Ubuntu - I can compile fine from directory I am in.
...
I have set GOPATH to 2 dirs: 1 for the downloading of libraries
(GOPATH_LIBS) and 1 dir for my web-app and such projects (GOPATH_PROJECTS).
export GOPATH_LIBS=/var/monosij/golang
export GOPATH_PROJECTS=/space/trials/code.trials/golang
export GOPATH=$GOPATH_LIBS:$GOPATH_PROJECTS
export PATH=$PATH:$GOPATH_LIBS/bin
export PATH=$PATH:$GOPATH_PROJECTS/bin
export GOROOT=/usr/bin/go
...
Setting up a project in GOPATH_PROJECTS.
In GOPATH_PROJECTS (*=/space/trials/code.trials/golang*) I create file
Hello.go in package Main as in:
src/github.com/mdr/run1/Hello.go
Now as per doc, I should be able to compile a file in GOPATH (ie
GOPATH_PROJECT)
While I can compile Hello.go if I am in that particular dir I CANNOT
compile if I enter:
*go install github.com/mdr/run1/Hello.go
<http://github.com/mdr/run1/Hello.go>*
Should this not be picked up from GOPATH?
...
If I include src in GOPATH_PROJECTS as in:
export GOPATH_PROJECTS=/space/trials/code.trials/golang/src
and then export it to GOPATH - I get a different error when I run: *go
install github.com/mdr/run1/Hello.go <http://github.com/mdr/run1/Hello.go>*
It says
go: cannot find GOROOT directory: /usr/bin/go
***@devel:~$ echo $GOROOT
/usr/bin/go
which go also states: /usr/bin/go.
...
I appreciate your reading through the details to please let me know what I
may be doing wrong?
Also - *why* do I need the project to be in a directory *github.com
<http://github.com/>*? Can I not just have a regular directory structure?
Regardless I would like to be able to just type:
*go install github.com/mdr/run1/Hello.go
<http://github.com/mdr/run1/Hello.go>*
*which then creates Hello in *GOPATH_PROJECTS/bin.
Thank you.
Monosij
--
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/d/optout.
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/d/optout.