Skip to content

Commit

Permalink
No longer error if e.g cli.Version is passed an empty string (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
FollowTheProcess authored Oct 25, 2024
1 parent 3cdce99 commit 777dd91
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
15 changes: 0 additions & 15 deletions command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -705,21 +705,6 @@ func TestOptionValidation(t *testing.T) {
options: []cli.Option{cli.OverrideArgs(nil)},
errMsg: "cannot set Args to nil",
},
{
name: "empty version",
options: []cli.Option{cli.Version("")},
errMsg: "cannot set Version to an empty string",
},
{
name: "empty commit",
options: []cli.Option{cli.Commit("")},
errMsg: "cannot set Commit to an empty string",
},
{
name: "empty build date",
options: []cli.Option{cli.BuildDate("")},
errMsg: "cannot set BuildDate to an empty string",
},
{
name: "nil VersionFunc",
options: []cli.Option{cli.VersionFunc(nil)},
Expand Down
9 changes: 0 additions & 9 deletions option.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,6 @@ func OverrideArgs(args []string) Option {
// cli.New("test", cli.Version("v1.2.3"))
func Version(version string) Option {
f := func(cfg *config) error {
if version == "" {
return errors.New("cannot set Version to an empty string")
}
cfg.version = version
return nil
}
Expand All @@ -289,9 +286,6 @@ func Version(version string) Option {
// [ldflags]: https://www.digitalocean.com/community/tutorials/using-ldflags-to-set-version-information-for-go-applications
func Commit(commit string) Option {
f := func(cfg *config) error {
if commit == "" {
return errors.New("cannot set Commit to an empty string")
}
cfg.commit = commit
return nil
}
Expand All @@ -311,9 +305,6 @@ func Commit(commit string) Option {
// [ldflags]: https://www.digitalocean.com/community/tutorials/using-ldflags-to-set-version-information-for-go-applications
func BuildDate(date string) Option {
f := func(cfg *config) error {
if date == "" {
return errors.New("cannot set BuildDate to an empty string")
}
cfg.buildDate = date
return nil
}
Expand Down

0 comments on commit 777dd91

Please sign in to comment.