Skip to content

Commit

Permalink
feat: update bar-counter/slog v1.4.0 and move test case to *_test pac…
Browse files Browse the repository at this point in the history
…kage
  • Loading branch information
sinlov committed Jun 27, 2023
1 parent ebad44c commit df5ae83
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Please read [Contributor Guide](.github/CONTRIBUTING_DOC/CONTRIBUTING.md) for mo
|:------------------------------------|:--------|
| https://github.com/stretchr/testify | v1.8.4 |
| https://github.com/urfave/cli/ | v2.23.7 |
| https://github.com/bar-counter/slog | v1.3.0 |
| https://github.com/bar-counter/slog | v1.4.0 |

# dev

Expand Down
10 changes: 7 additions & 3 deletions command/subcommand_new/subCmdNew.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,22 @@ func flag() []cli.Flag {

func action(c *cli.Context) error {
slog.Debug("SubCommand [ new ] start")
newCommandEntry = withGlobalFlag(c)
entry, err := withEntry(c)
if err != nil {
return err
}
newCommandEntry = entry
return newCommandEntry.Exec()
}

func withGlobalFlag(c *cli.Context) *NewCommand {
func withEntry(c *cli.Context) (*NewCommand, error) {
if c.Bool("lib") {
slog.Info("new lib mode")
}
globalEntry := command.CmdGlobalEntry()
return &NewCommand{
isDebug: globalEntry.Verbose,
}
}, nil
}

var newCommandEntry *NewCommand
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package command
package command_test

import (
"github.com/stretchr/testify/assert"
Expand Down
2 changes: 1 addition & 1 deletion command/init_test.go → command_test/init_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package command
package command_test

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/bridgewwater/temp-golang-cli-fast
go 1.18

require (
github.com/bar-counter/slog v1.3.0
github.com/bar-counter/slog v1.4.0
github.com/stretchr/testify v1.8.4
github.com/urfave/cli/v2 v2.23.7
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/bar-counter/slog v1.3.0 h1:0kMiQpjNXPPY0NQJkvqqkAvcachkKmo0Eu++vnXkuo4=
github.com/bar-counter/slog v1.3.0/go.mod h1:TiYwRv1WtM4UYmJevNjc0piQmGypo0RDegcboE0NrP4=
github.com/bar-counter/slog v1.4.0 h1:Xmdri58huPZHmX+8xKILSVWtNJ2eXZNtv1v5uoaGQM4=
github.com/bar-counter/slog v1.4.0/go.mod h1:TiYwRv1WtM4UYmJevNjc0piQmGypo0RDegcboE0NrP4=
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down

0 comments on commit df5ae83

Please sign in to comment.