Skip to content

Commit

Permalink
Add urfave_cli_no_docs build tag
Browse files Browse the repository at this point in the history
This removes the resulting binary dependency on cpuguy83/md2man and
russross/blackfriday, which saves more than 400 KB (more than 300 KB
once stripped) from the resulting binary.

Document this in README.
  • Loading branch information
kolyshkin committed Apr 25, 2022
1 parent aabfea8 commit 49e43be
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ import (
...
```

### Build tags

You can use the following build tags:

#### `urfave_cli_no_docs`

When set, this removes `ToMarkdown` and `ToMan` methods, so your application
won't be able to call those. This reduces the resulting binary size by about
300-400 KB (measured using Go 1.18.1 on Linux/amd64), due to less dependencies.

### GOPATH

Make sure your `PATH` includes the `$GOPATH/bin` directory so your commands can
Expand Down
3 changes: 3 additions & 0 deletions docs.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build !urfave_cli_no_docs
// +build !urfave_cli_no_docs

package cli

import (
Expand Down
3 changes: 3 additions & 0 deletions docs_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build !urfave_cli_no_docs
// +build !urfave_cli_no_docs

package cli

import (
Expand Down

0 comments on commit 49e43be

Please sign in to comment.