0

New godoc have some nice features like list of callers etc. Anyway I have problems to run it, like:

➜  ~GOPATH git:(master) ✗ ls src/github.com/coreos/etcd/
CHANGELOG       DCO             Documentation   README.md       bench           build           contrib         error           fixtures        go_version.go   http            main.go         mod             scripts         store           tests
CONTRIBUTING.md Dockerfile      LICENSE         Vagrantfile     bin             config          discovery       etcd            foo             gopath          log             metrics         pkg             server          test.sh         third_party
➜  ~GOPATH git:(master) ✗ godoc github.com/coreos/etcd/discovery -http=:6060
No match found.

Does anyone can tell me how to run it on some popular go repos like etcd, which I am using above?

Sławosz
  • 11,187
  • 15
  • 73
  • 106

3 Answers3

1

Godoc have two main functionnalities:

  1. It displays the documentation for a package
  2. It run a webserver that you can browse to see you local packages documentation

Here, you are trying to do both at the same time. Either remove the -http=:6060 option to see the package documentation in the console, or remove the package path to run the webserver and search it in your browser.

Elwinar
  • 9,103
  • 32
  • 40
0

Godoc can either run documentation on your code to create output on the terminal (running godoc without -server or -http flags), or can be run as a server with -http/-server tags (and takes no other args). Can't be both at the same time.

If you don't see your code in packages, then you need to run go install mypackage For example if you have github.com/coreos/etcd/discovery cloned, then run go install github.com/coreos/etcd/discovery and it should appear in the go docs page run by godoc -http=:port

Just ran into this problem with my code and didn't see any other answers.

EntilZha
  • 1,572
  • 3
  • 15
  • 16
0
godoc -http=:6060 &
go get github.com/coreos/etcd/discovery
open http://localhost:6060/pkg/github.com/coreos/etcd/discovery
dolmen
  • 8,126
  • 5
  • 40
  • 42
  • That's a great response, also, if you are unhappy about godoc's output, you can also use this one: https://github.com/dataf3l/go-doc – Felipe Valdes Aug 12 '18 at 23:26