add option to force template .Dir be the path of a local module #21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
how it works
If we define a list of local packages (format path like in the output of
go list -f '{{ .Dir }}' ./...
) and use the output as template{{ .Dir }}/README.md
we can use one single command execution to generate the docs for all packages.Unfortunately, on versioned modules, it does not understand the package name + version (v1, v2 ...) and it generates wrong documentation.
the workaround is to add a comment in the package like
However this requires a massive rewrite on all source code and... it is kinda ugly
A better solution seems to list the packages as remote packages ( like using
go list ./...
), however if we do this, the.Dir
attribute will be hard coded.
and all files will be generated as the current README.md (last wins)by adding an new option
--force-local-dir
we:go.mod
file and parse the contentIF we want to avoid parse the
go.mod
file, we can specify the full package name with version like this, using the new option--full-package-name
:testing on project wdx2-libs:
using current go.mk
make docs
make docs_check
using current go.mk with option
-j
to run in parallelmake docs
make docs_check
new command line tool
it means