Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Hmm according to the guide I have to set path as:

export PATH=$GOBIN:$PATH

But then I realised that there is no such directory... I'm not sure what I should do...
 
$GOBIN is an environmental variable itself. You need to know what path it refers to in order to find out whether that path exists or not.

Well that doesn't really help, can you tell me what I should do now? Should I renew the definition of $PATH without using $GOBIN and reinstall Go?
 
Well that doesn't really help, can you tell me what I should do now? Should I renew the definition of $PATH without using $GOBIN and reinstall Go?

No you should do as the documentation says. If you don't know what path $GOBIN refers too then you can not state whether the path exists or not which was the original point of my post.

Type "echo $GOBIN" (without the quotes) to see where it points too. My guess would be /usr/local/bin
 
I installed this and got it working.

I added this to my .bash_profile:

Code:
# Mercurial
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

# Go
export GOROOT="$HOME/Projects/go/root"
export GOBIN="$HOME/Projects/go/bin"
export GOOS="darwin"
export GOARCH="amd64"
export PATH="$GOBIN:$PATH"

Not sure if the Mercurial part was required but I did it anyway. If you know you're not on a 64-bit machine use i386 instead of amd64. ~/Projects/go/root is where the code is downloaded to, and ~/Projects/go/bin is where the binaries are placed once you compile them (of course this is how I set it up. You can put them anywhere you want).

Only error I came across was "FAIL: net.TestDialGoogle" but that was because my ISP is fail and switching to another network fixed it (thanks neighbors ;)).
 
So I decided to uninstall everything (rm -r the go directories) and tried installing it again. This time I tried adding the mercurial part on my bash profile.

I downloaded go and I tried installing it by going to $GOROOT/src and then running ./all.bash

However I got this error message now, tried it three times and the same error message keeps happening:

Code:
--- FAIL: http.TestClient
	Get http://www.google.com/robots.txt: dial tcp www.google.com:http: lookup www.google.com. on 192.168.1.1:53: no answer from server
--- FAIL: http.TestRedirect
	Get http://codesearch.google.com/: dial tcp codesearch.google.com:http: lookup codesearch.google.com. on 192.168.1.1:53: no answer from server
FAIL
make[1]: *** [test] Error 1
make: *** [http.test] Error 2

Any clue, anyone? :(
 
Try it on another network if you have one available. But it should be good now, as it's just running through the tests. Try continuing with the tutorial and see if the hello world compiles.
 
Thank you, that fixed the problem of installing it.

Now I'm trying to compile a source code with the 6g command, but I can not seem to find 6g in my terminal!

-bash: 6g: command not found

I went to ~/go/bin/ and I found the following commands:

Code:
6nm		8c		8l		ebnflint	godoc		gopack		goyacc		quietgcc
8a		8g		cgo		godefs		gofmt		gotest		hgpatch

According to the tutorial, I need to use 6g, 6l, or gccgo, but where do I find those? I tried locating gccgo in the terminal, but had no luck!

Code:
~/go/.hg/store/data/doc/gccgo__contribute.html.i
~/go/.hg/store/data/doc/gccgo__install.html.i
~/go/.hg/store/data/doc/go__gccgo__setup.html.i
~/go/doc/gccgo_contribute.html
~/go/doc/gccgo_install.html
 
From the Google Go language web site:

6g is the Go compiler for amd64; it will write the output in file.6. The ‘6’ identifies files for the amd64 architecture. The identifier letters for 386 and arm are ‘8’ and ‘5’. That is, if you were compiling for 386, you would use 8g and the output would be named file.8.

You'll want to use the '8' ones because I presume you're using the i386 architecture.

Good luck!
 
I see, thank you very much! I have just ran my hello world program =)

Btw why isn't gccgo working for me? is it working for any of you?
 
I see, from the documentation I have got the impression that gccgo shouldn't be used for now. I think that's also the reason why they didn't include it by default...

Thank you then, I'll continue working through the tutorials and hopefully I could make something good out of this =)

Have a nice weekend everyone!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.