Search code examples
gogodoc

Can't godoc create documentation for packages within internal folder?


In a common project structure there are folders like:

/cmd

/internal

/pkg

however when executing godoc

No documentation is created for the packages within the internal folder: internal is missing between cmd and pkg

Problem is: there are functions within the package and they need to be documented even for internal usage. Is there any way?


Solution

  • For instance, https://golang.org/pkg/math/big/?m=all shows the documentation for all (not just the exported) declarations of package big.

    As mentioned in this documentation, using m=all parameter in URL will list internal packages. One caveat is that it includes all declarations including unexported declarations.