From 21812628e542d8f8743ee8c5dba42da14c1701db Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Thu, 21 Apr 2022 20:04:15 -0700 Subject: [PATCH] Make ToMarkdown and ToMan optional This functionality is not always used, and it brings in quite a big dependency (russross/blackfriday). Amend the documentation to make it clear that cli_docs build tag is needed to use these functions. This reduces runc size by about 318 Kb, or 3.4% (comparing stripped binaries). Signed-off-by: Kir Kolyshkin --- docs.go | 7 +++++++ docs_test.go | 3 +++ 2 files changed, 10 insertions(+) diff --git a/docs.go b/docs.go index 5b94566128..16ace931fa 100644 --- a/docs.go +++ b/docs.go @@ -1,3 +1,6 @@ +//go:build cli_docs +// +build cli_docs + package cli import ( @@ -13,6 +16,8 @@ import ( // ToMarkdown creates a markdown string for the `*App` // The function errors if either parsing or writing of the string fails. +// +// To use this functionality, you need to have cli_docs build flag set. func (a *App) ToMarkdown() (string, error) { var w bytes.Buffer if err := a.writeDocTemplate(&w); err != nil { @@ -23,6 +28,8 @@ func (a *App) ToMarkdown() (string, error) { // ToMan creates a man page string for the `*App` // The function errors if either parsing or writing of the string fails. +// +// To use this functionality, you need to have cli_docs build flag set. func (a *App) ToMan() (string, error) { var w bytes.Buffer if err := a.writeDocTemplate(&w); err != nil { diff --git a/docs_test.go b/docs_test.go index f18d12d2f9..12b9a06a34 100644 --- a/docs_test.go +++ b/docs_test.go @@ -1,3 +1,6 @@ +//go:build cli_docs +// +build cli_docs + package cli import (