1

Instead of comments written in the code itself, is it possible to pass an external reference file to the godoc command containing the documentation for any uncommented code?

The requirement here is that we need to generate documentation for a codebase that does not have any proper comments within the code and we also want to keep changes to the source files to a minimum.

Any other approach which fits this requirement is welcome. No strict rule to use godoc

user9492428
  • 603
  • 1
  • 9
  • 25
  • 1
    Godoc, pkg.go.dev, and the go doc command all expect to find documentation for an identifier in a comment before the identifier. You can write a tool that weaves together [parsed Go source files](https://pkg.go.dev/go/parser) and your sidecar documentation to create output that looks similar to those other tools. You may find the [go/doc](https://pkg.go.dev/go/doc@go1.19beta1) package helpful in writing such a tool. If possible, use the Go 1.19 version of the go/doc package. –  Jun 20 '22 at 23:09

0 Answers0