Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Go 1.2 (devel) doesn't install godoc into bin #23281

Closed
prencher opened this issue Oct 15, 2013 · 9 comments
Closed

Go 1.2 (devel) doesn't install godoc into bin #23281

prencher opened this issue Oct 15, 2013 · 9 comments

Comments

@prencher
Copy link
Contributor

When building using brew install --devel go, the godoc command is not installed with go and gofmt into bin.

@adamv
Copy link
Contributor

adamv commented Oct 26, 2013

Would review a pull request to fix this, but if they're not being installed then they probably aren't being build to the expected place. Do the 1.2 pre-release Go docs make any mention of a change here?

@adamv
Copy link
Contributor

adamv commented Nov 5, 2013

We've had a newer developer release go into this repo since this was opened; I don't know if it solves this problem, but the solution is to modify the formula to do what you want.

@adamv adamv closed this as completed Nov 5, 2013
@intel352
Copy link

intel352 commented Dec 3, 2013

godoc was separated from the Go installation (as was the vet tool).
Commands are provided in the Go post-install output for installing godoc & vet, but those commands don't provide the full picture.

The commands provided to install godoc & vet:

go install code.google.com/p/go.tools/cmd/godoc
go install code.google.com/p/go.tools/cmd/vet

What's happening is that godoc & vet are not installed into a known bin path, as they are installed into $GOROOT instead of $GOPATH ($GOPATH is what most devs would export in their .bashrc or manually from terminal, as well as add to their $PATH).

Solution is to add $GOROOT export to .bashrc and $PATH, like so:

export GOROOT=`go env GOROOT`
export PATH=$PATH:$GOROOT/bin

After exporting that updated $PATH into your shell env (via .bashrc or manual), you should then be able to access the godoc command.

@Yasushi
Copy link

Yasushi commented Dec 4, 2013

@rofrol
Copy link

rofrol commented Mar 20, 2014

go get worked for me

# go install code.google.com/p/go.tools/cmd/godoc
can't load package: package code.google.com/p/go.tools/cmd/godoc: cannot find package "code.google.com/p/go.tools/cmd/godoc" in any of:
    /usr/lib64/go/src/pkg/code.google.com/p/go.tools/cmd/godoc (from $GOROOT)
    /root/projects/go/src/code.google.com/p/go.tools/cmd/godoc (from $GOPATH)
# go get code.google.com/p/go.tools/cmd/godoc
# $(go env GOROOT)/bin/godoc
usage: godoc package [name ...]

http://golang.org/doc/go1.2#go_tools_godoc

@intel352
Copy link

@rofrol, as I noted above, it's not that godoc isn't available, it's that what is installed isn't immediately available in your PATH. Haven't tested latest, but at the time of my post (4 months ago), updating PATH made godoc available to me, similar to how you're having to call godoc using $(go env GOROOT)

@momer
Copy link

momer commented Apr 18, 2014

👍 @rofrol

I installed go via Homebrew, and ended up running

go get code.google.com/p/go.tools/cmd/godoc
go get code.google.com/p/go.tools/cmd/vet

then

#~/.bashrc
export PATH=$PATH:/usr/local/Cellar/go/1.2.1/libexec/bin

and finally in your open shells:

$ source ~/.bashrc

Note, godoc required me to install Mercurial (though I thought it'd been installed a long time ago for some other dependency

@mattes
Copy link
Contributor

mattes commented May 2, 2014

instead of using export PATH=$PATH:/usr/local/Cellar/go/1.2.1/libexec/bin i would use
export PATH=$PATH:/usr/local/opt/go/libexec/bin

@netpoetica
Copy link

Anyone know why using go get on godoc and vet doesn't autogenerate an executable in bin/?

@Homebrew Homebrew locked and limited conversation to collaborators Jul 9, 2014
MikeMcQuaid pushed a commit that referenced this issue Feb 26, 2015
Bottles and installs `godoc` and `go vet` unless requested otherwise.

Closes #37133

Past references:

1) #23281
2) #25210

Closes #37159.

Signed-off-by: Mike McQuaid <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants