Create static documents with godoc

I’ve been developing a solution about edge with golang. During three month, i developed lots of features and i started thinking about document for the project. Go has a wonderful tool "godoc!!"
I cloud check our comments with this tool use “godoc -http=:6060”. However, In order to make static documents, i need to static files included all of our packages. So i need to change the contexts on the server to static html files… but i could not foubd the way.

Is there a way to make that thing as use godoc or others?

Otherewise, golang seeks the way i used only?

As far as I know, the godoc server ignores HTML files. I can imagine two possible approaches to include static documentation:

  1. Put the godoc server behind a reverse proxy. The Caddy server is a good choice - incredibly simple to set up as a proxy server, and capable of serving static HTML files and even Markdown files.
    You could, for example, advise Caddy to forward all /pkg paths to godoc and server all /doc requests from static HTML/Markdown files.

  2. If the godoc format is sufficient for static documentation, use an “empty” go file to hold the documentation. “Empty” means that the go file contains nothing but a package comment and a package declaration but no further code, like this:

    /* This is a package document.
    Write some static documentation here. Use godoc features to get some structure, e.g.
        indenting lines to have them formatted in monospace font
    Remember to leave no blank likne between comment and package statement.
    package somepkg
1 Like

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