Backing out build tag for suggestions per recommendation

from @kolyshkin 🙇
This commit is contained in:
Dan Buch 2022-05-17 08:49:15 -04:00
parent 3c923e7a44
commit f3cf7640c7
Signed by: meatballhat
GPG Key ID: A12F782281063434
9 changed files with 8 additions and 42 deletions

View File

@ -37,15 +37,9 @@ jobs:
- name: vet - name: vet
run: go run internal/build/build.go vet run: go run internal/build/build.go vet
- name: test with urfave_cli_core tag
run: go run internal/build/build.go -tags urfave_cli_core test
- name: test with urfave_cli_no_docs tag - name: test with urfave_cli_no_docs tag
run: go run internal/build/build.go -tags urfave_cli_no_docs test run: go run internal/build/build.go -tags urfave_cli_no_docs test
- name: test with urfave_cli_no_suggest tag
run: go run internal/build/build.go -tags urfave_cli_no_suggest test
- name: test - name: test
run: go run internal/build/build.go test run: go run internal/build/build.go test
@ -53,7 +47,7 @@ jobs:
run: go run internal/build/build.go check-binary-size run: go run internal/build/build.go check-binary-size
- name: check-binary-size with tags (informational only) - name: check-binary-size with tags (informational only)
run: go run internal/build/build.go -tags urfave_cli_core check-binary-size run: go run internal/build/build.go -tags urfave_cli_no_docs check-binary-size
- name: Upload coverage to Codecov - name: Upload coverage to Codecov
if: success() && matrix.go == '1.18.x' && matrix.os == 'ubuntu-latest' if: success() && matrix.go == '1.18.x' && matrix.os == 'ubuntu-latest'

View File

@ -17,11 +17,11 @@ all: generate vet tag-test test check-binary-size tag-check-binary-size gfmrun t
.PHONY: tag-test .PHONY: tag-test
tag-test: tag-test:
go run internal/build/build.go -tags urfave_cli_core test go run internal/build/build.go -tags urfave_cli_no_docs test
.PHONY: tag-check-binary-size .PHONY: tag-check-binary-size
tag-check-binary-size: tag-check-binary-size:
go run internal/build/build.go -tags urfave_cli_core check-binary-size go run internal/build/build.go -tags urfave_cli_no_docs check-binary-size
.PHONY: gfmrun .PHONY: gfmrun
gfmrun: gfmrun:

View File

@ -59,22 +59,12 @@ import (
You can use the following build tags: You can use the following build tags:
#### `urfave_cli_core`
When set, applies all `urfave_cli_no.+` build tags to minimize resulting binary
size.
#### `urfave_cli_no_docs` #### `urfave_cli_no_docs`
When set, this removes `ToMarkdown` and `ToMan` methods, so your application 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 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 fewer dependencies. 300-400 KB (measured using Go 1.18.1 on Linux/amd64), due to fewer dependencies.
#### `urfave_cli_no_suggest`
When set, the capability enabled by setting `App.Suggest` will be a no-op. This
reduces the resulting binary size due to fewer dependencies.
### GOPATH ### GOPATH
Make sure your `PATH` includes the `$GOPATH/bin` directory so your commands can Make sure your `PATH` includes the `$GOPATH/bin` directory so your commands can

View File

@ -1,5 +1,5 @@
//go:build !urfave_cli_no_docs && !urfave_cli_core //go:build !urfave_cli_no_docs
// +build !urfave_cli_no_docs,!urfave_cli_core // +build !urfave_cli_no_docs
package cli package cli

View File

@ -1,5 +1,5 @@
//go:build !urfave_cli_no_docs && !urfave_cli_core //go:build !urfave_cli_no_docs
// +build !urfave_cli_no_docs,!urfave_cli_core // +build !urfave_cli_no_docs
package cli package cli

View File

@ -242,7 +242,7 @@ func checkBinarySizeActionFunc(c *cli.Context) (err error) {
tags := c.String("tags") tags := c.String("tags")
if strings.Contains(tags, "urfave_cli_core") || strings.Contains(tags, "urfave_cli_no_docs") { if strings.Contains(tags, "urfave_cli_no_docs") {
desiredMinBinarySize = 1.39 desiredMinBinarySize = 1.39
} }

View File

@ -1,6 +1,3 @@
//go:build !urfave_cli_no_suggest && !urfave_cli_core
// +build !urfave_cli_no_suggest,!urfave_cli_core
package cli package cli
import ( import (

View File

@ -1,12 +0,0 @@
//go:build urfave_cli_no_suggest || urfave_cli_core
// +build urfave_cli_no_suggest urfave_cli_core
package cli
func (a *App) suggestFlagFromError(err error, _ string) (string, error) {
return "", err
}
func suggestCommand([]*Command, string) string {
return ""
}

View File

@ -1,6 +1,3 @@
//go:build !urfave_cli_no_suggest && !urfave_cli_core
// +build !urfave_cli_no_suggest,!urfave_cli_core
package cli package cli
import ( import (