Skip to content

Commit

Permalink
chore: replace logrus by fmt
Browse files Browse the repository at this point in the history
Signed-off-by: Olivier Vernin <[email protected]>
  • Loading branch information
olblak committed Jan 7, 2024
1 parent 1581da6 commit 4528a68
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 20 deletions.
4 changes: 2 additions & 2 deletions cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"strings"

"github.com/sirupsen/logrus"
"fmt"

"github.com/spf13/cobra"

Expand All @@ -17,7 +17,7 @@ var (
Short: "Print current application version",
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
logrus.Infof("\n%s\n", strings.ToTitle("Version"))
fmt.Printf("\n%s\n", strings.ToTitle("Version"))
version.Show()
},
}
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ require (
github.com/Masterminds/sprig/v3 v3.2.3
github.com/mitchellh/mapstructure v1.5.0
github.com/shurcooL/githubv4 v0.0.0-20231126234147-1cffa1f02456
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.8.0
golang.org/x/oauth2 v0.15.0
gopkg.in/yaml.v3 v3.0.1
Expand All @@ -26,9 +25,9 @@ require (
github.com/shurcooL/graphql v0.0.0-20230722043721-ed46e5a46466 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.7.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.31.0 // indirect
)
5 changes: 0 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ github.com/shurcooL/githubv4 v0.0.0-20231126234147-1cffa1f02456 h1:6dExqsYngGEii
github.com/shurcooL/githubv4 v0.0.0-20231126234147-1cffa1f02456/go.mod h1:zqMwyHmnN/eDOZOdiTohqIUKUrTFX62PNlu7IJdu0q8=
github.com/shurcooL/graphql v0.0.0-20230722043721-ed46e5a46466 h1:17JxqqJY66GmZVHkmAsGEkcIu0oCe3AM420QDgGwZx0=
github.com/shurcooL/graphql v0.0.0-20230722043721-ed46e5a46466/go.mod h1:9dIRpgIY7hVhoqfe0/FcYp0bpInZaT7dc3BYOprrIUE=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng=
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
Expand Down Expand Up @@ -78,11 +76,8 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
Expand Down
14 changes: 6 additions & 8 deletions internal/core/version/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"fmt"
"strings"

"github.com/sirupsen/logrus"

sv "github.com/Masterminds/semver/v3"
)

Expand All @@ -25,11 +23,11 @@ var (

// Show displays various version information
func Show() {
logrus.Infof("")
logrus.Infof("Application:\t%s", Version)
logrus.Infof("%s", strings.ReplaceAll(GoVersion, "go version go", "Golang :\t"))
logrus.Infof("Build Time :\t%s", BuildTime)
logrus.Infof("")
fmt.Printf("")
fmt.Printf("Application:\t%s", Version)
fmt.Printf("%s", strings.ReplaceAll(GoVersion, "go version go", "Golang :\t"))
fmt.Printf("Build Time :\t%s", BuildTime)
fmt.Printf("")
}

// IsGreaterThan test if an updatecli manifest required version is greater or equal to the current updatecli binary version
Expand All @@ -42,7 +40,7 @@ func IsGreaterThan(binaryVersion, manifestVersion string) (bool, error) {

if len(binaryVersion) == 0 {
if !isDevWarningDisabled {
logrus.Warningf("Updatecli binary version is unset. This means you are using a development version that ignores manifest version constraint.\n")
fmt.Printf("Updatecli binary version is unset. This means you are using a development version that ignores manifest version constraint.\n")
isDevWarningDisabled = true
}

Expand Down
8 changes: 5 additions & 3 deletions internal/plugins/github/ratelimit.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package github

import "github.com/sirupsen/logrus"
import (
"fmt"
)

/*
RateLimit is a struct that contains GitHub Api limit information
Expand All @@ -16,10 +18,10 @@ Show display GitHub Api limit usage
*/
func (a *RateLimit) Show() {
if (a.Cost * 2) > a.Remaining {
logrus.Warningf("Running out of GitHub Api resource, currently used %d remaining %d (reset at %s)",
fmt.Printf("Running out of GitHub Api resource, currently used %d remaining %d (reset at %s)",
a.Cost, a.Remaining, a.ResetAt)
} else {
logrus.Debugf("GitHub Api credit used %d, remaining %d (reset at %s)",
fmt.Printf("GitHub Api credit used %d, remaining %d (reset at %s)",
a.Cost, a.Remaining, a.ResetAt)
}
}

0 comments on commit 4528a68

Please sign in to comment.