Fixing golangci-lint errors[1]:
Error: SA1019: "io/ioutil" has been deprecated since Go 1.19: As of
Go 1.16, the same functionality is now provided by package [io] or
package [os], and those implementations should be preferred in new
code. See the specific function documentation for details.
(staticcheck)
[1] https://github.com/spf13/cobra/actions/runs/10535452454/job/29194442289?pr=2180
The `see_also` section for child commands would include only the name of
the commands. This adds the whole path, similar to how it's done for the
other documentation formats.
full diff: https://github.com/cpuguy83/go-md2man/compare/v2.0.0...v2.0.1
- Fix handling multiple definition descriptions
- Fix inline markup causing table cells to split
- Remove escaping tilde character (prevents tildes (`~`) from disappearing).
- Do not escape dash, underscore, and ampersand (prevents ampersands (`&`) from disappearing).
- Ignore unknown HTML tags to prevent noisy warnings
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This patch modifies the GenMarkdownCustom to skip writing a Synopsis
header with the `cmd.Short` duplicated both before and after the header.
Instead, it only writes the `### Synopsis` header and the paragraph when
a `cmd.Long` has some kind of content in it.
Adds `TestGenMdDocWithNoLongOrSynopsis` as the test case.
Signed-off-by: Marc Lopez <marc5.12@outlook.com>
Previously if a cobra user didn't specify an explicit .Date header, the
current time would be included in all of the generated man pages each
time they were built. This causes an issue for reproducible builds,
since each re-build of a package that includes the man pages will have
different times listed in the man pages.
To fix this, add support for SOURCE_DATE_EPOCH (which is a standardised
packaging environment variable, designed to be used specifically for
this purpose[1]).
[1]: https://reproducible-builds.org/specs/source-date-epoch/
Signed-off-by: Aleksa Sarai <asarai@suse.de>
benchmark old ns/op new ns/op delta
BenchmarkGenYamlToFile-4 62488 61622 -1.39%
benchmark old allocs new allocs delta
BenchmarkGenYamlToFile-4 121 120 -0.83%
benchmark old bytes new bytes delta
BenchmarkGenYamlToFile-4 26706 26280 -1.60%
The default pflag error is to only print the bad flag. This enables an application
to include a usage message or other details about the error.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>