Running go doc only for my code

I would like create documentation only for my code with godoc, how to do it (I dont see right option in help)?


Since you are asking this here, I suspect that godoc <yourpackageorcommandname> does not meet your needs, right?
What exactly do you want to achieve?

1 Like

I want to generate docs for all of my packages, for example like here:

I just wonder if I should use some custom solution, or godoc is enough?

Ok so you want to something like godoc's HTTP mode or something like but only for your packages?

I see three options here. They neither are particularly elegant, nor do they meet your needs perfectly (I guess), but they might be a start.

First, you could run godoc -http=:6060 and then navigate to your package tree. curl or wget can help extracting the HTML pages if you want that.

Or you could write a shell script that iterates over all of your packages and calls godoc -html <path/to/package> for each of them. This produces an HTML file for each of your packages (but just raw HTML without CSS styling).

What you also could try (I haven’t yet): get the source code of and run it locally for your packages. The wiki describes how to run the server locally in developer mode.

Can’t you use the commandline version of godoc?


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