stoopid newbie question: where is "go" command?

1,724 views
Skip to first unread message

=JeffH

unread,
Feb 4, 2012, 12:11:46 AM2/4/12
to golang-nuts
alright, I compiled & installed go apparently successfully a few times
now, and each time have ended up with the canonical..

0 known bugs; 0 unexpected bugs

ALL TESTS PASSED

---
Installed Go for linux/amd64 in /usr/local/src/go.
Installed commands in /usr/local/src/go/bin.
The compiler is 6g.


..at the end. I'm running on linux amd64.

I've tried pulling the source using both "hg clone -u release
https://go.googlecode.com/hg/" and "hg clone https://go.googlecode.com/hg/"
with the same results both times.

The result is..

go: command not found

I have these environment varbs set..

GOROOT=/usr/local/src/go
GOARCH=amd64
GOOS=linux
GOPATH=/usr/local/src/go

plus my PATH contains "/usr/local/src/go/bin"


And this is the bin directory I end up with after a build..

$ ls /usr/local/src/go/bin
6a 6g 6prof godefs gofmt gopack gotry goyacc
6c 6l cgo godoc goinstall gopprof gotype hgpatch
6cov 6nm ebnflint gofix gomake gotest govet quietgcc


I don't see no "go" command in there. Where it sposed to be?

thanks,

=JeffH

Kyle Lemons

unread,
Feb 4, 2012, 3:36:38 AM2/4/12
to =JeffH, golang-nuts
You're only getting the release branch.  "hg update default" should get you to tip.  Use weekly instead of default to get to the weekly.

Andrew Shitov

unread,
Feb 4, 2012, 3:33:29 AM2/4/12
to =JeffH, golang-nuts
If you really need 'go', make it yourself:

$ cat > /usr/bin/go
#!/usr/bin/perl
my $name = $ARGV[0];
if ($name) {
$name =~ s/\.(go)?$//;
print `/usr/bin/6g $name.go`;
if (-f "$name.6") {
print `/usr/bin/6l $name.6`;
print `./6.out`;
}
}

There's no one by default, and you were clearly informed after the
installation process: "The compiler is 6g."

Finally (or firstly), the "Getting started" page explains it all:
http://golang.org/doc/install.html#writing

--
Andrew Shitov
______________________________________________________________________
an...@shitov.ru | http://shitov.ru

Francisco Souza

unread,
Feb 4, 2012, 8:25:44 AM2/4/12
to Andrew Shitov, =JeffH, golang-nuts
On Sat, Feb 4, 2012 at 6:33 AM, Andrew Shitov <ash...@gmail.com> wrote:
If you really need 'go', make it yourself:

$ cat > /usr/bin/go
#!/usr/bin/perl
my $name = $ARGV[0];
if ($name) {
   $name =~ s/\.(go)?$//;
   print `/usr/bin/6g $name.go`;
   if (-f "$name.6") {
       print `/usr/bin/6l $name.6`;
       print `./6.out`;
   }
}

There's no one by default, and you were clearly informed after the
installation process: "The compiler is 6g."

--
~f

=JeffH

unread,
Feb 4, 2012, 3:42:28 PM2/4/12
to golang-nuts
Thanks all for the pointers. "hg update default" got me the src/cmd
directory I was missing and a recompile yielded the distro's "go"
command.

So if one clones the code using..

hg clone -u release https://go.googlecode.com/hg/ go

..per the directions here..

http://golang.org/doc/install.html#fetch

..then one /doesn't/ get the src/cmd directory ?

This is hinted at in Adam Langly's readme for his crlset-tool here..

https://github.com/agl/crlset-tools

where he says..

See http://golang.org/doc/install.html, but don't pass "-u release"
when fetching the repository.


I think what happened is that I'd cloned and built Go originally a
while back, and had followed the install.html#fetch directions and
used "-u release" and so I was SOL until the tip to fix things with
"hg update default"

thanks again,

=JeffH

Andrew Gerrand

unread,
Feb 4, 2012, 7:10:08 PM2/4/12
to =JeffH, golang-nuts

Incidentally, your GOPATH is set incorrectly. It should be set to some directory other than goroot, where you want to keep your go code.

See "go help gopath" for details.

Andrew

John Asmuth

unread,
Feb 4, 2012, 7:25:56 PM2/4/12
to golan...@googlegroups.com
This problem is really common. Maybe a warning, or an error when this is detected?

=JeffH

unread,
Feb 4, 2012, 8:14:41 PM2/4/12
to golang-nuts


On Feb 4, 4:10 pm, Andrew Gerrand <a...@google.com> wrote:
> Incidentally, your GOPATH is set incorrectly. It should be set to some
> directory other than goroot, where you want to keep your go code.
>
> See "go help gopath" for details.

super, thanks for the tip.

=JeffH
Reply all
Reply to author
Forward
0 new messages