Playground and Godoc


I’m running godoc in the following manner in order to have a godoc server that is only for my company but has runnable examples:

`nohup ./godoc -http=:8071 -goroot=/godoc -play=true &

but when I try to play the examples in my docs in the Playground I’m getting the error:

“Error communicating with remote server.”

So I tried also running:

`nohup go tool tour &

Still no luck!

Are there ports or anything I have to have open? I would think things are routed through localhost for this…

Any pointers?



Try the chrome network console and double check where the playground request is going. If it’s going to the main site it might be related to

OK, so one problem was fixed when I upgraded to 1.7 from 1.5…

Now, I have a local godoc running and I start it with the following bash script:


export GOROOT=/go
export GOHOME=/go

/usr/local/go/bin/godoc -http=:8071 -play=true -index

I have the the packages I want to index in the /go directory.

It works fine except for when I want to run an example:

package main

import (


from within the godoc site, I get the following error:

tmp/sandbox896493756/main.go:5:2: cannot find package “server/media-systems/timeutils” in any of:
/usr/local/go/src/server/media-systems/timeutils (from $GOROOT)
/go/src/server/media-systems/timeutils (from $GOPATH)

But when I look in those directories, /usr/local/go/src and /go/src, the package server/media-systems/timeutils is definitely there…

I assume that there is a sandbox being created and that somehow I need to get my package into the sandbox?


There is no environment variable called GOHOME

You are also setting GOROOT to an incorrect value. You do not need to set GOROOT, the default value is correct.

Made those changes, but I still get the same error with any package other than the standard library… Also, if I don’t change GOROOT I get all the standard library packages as well…

I’m having the same issue. My $GOPATH/$GOROOT is not standard. I’m on go 1.7.4 and the godoc command doesn’t seem to respect either the $GOROOT environment variable or the -goroot parameter. Seems that others are having the issue too see:stack overflow

I also attempted to ln -s $GOPATH /usr/local/go and ln -s $GOPATH /go to resolve the issue and neither worked.

Do not use symlink, that is not the correct answer. You probably have multiple versions of Go installed, check and remove all but the latest.

I think I know why this is happening. It appears that the playground tool just proxies all compile requests to, which would not have access to private packages.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.