Linter fixes numero 2 (#4408)
This commit is contained in:
1 parent
25bce9e8ff
commit
49803e653c
23 files changed
+172
-109
No files matched your search
@@ -10,7 +10,6 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/signal"
|
||||
"regexp"
|
||||
@@ -517,7 +516,7 @@ func NewFlagSets(ui cli.Ui) *FlagSets {
|
||||
|
||||
// Errors and usage are controlled by the CLI.
|
||||
mainSet.Usage = func() {}
|
||||
mainSet.SetOutput(ioutil.Discard)
|
||||
mainSet.SetOutput(io.Discard)
|
||||
|
||||
return &FlagSets{
|
||||
flagSets: make([]*FlagSet, 0, 6),
|
||||
|
||||
@@ -6,7 +6,6 @@ package base
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sync"
|
||||
"testing"
|
||||
@@ -52,7 +51,7 @@ func Test_oidcLogger_Errorf(t *testing.T) {
|
||||
l.Errorf(tt.fmt, tt.args...)
|
||||
sinkFileName := c.AllEvents.Name()
|
||||
defer func() { _ = os.WriteFile(sinkFileName, nil, 0o666) }()
|
||||
b, err := ioutil.ReadFile(sinkFileName)
|
||||
b, err := os.ReadFile(sinkFileName)
|
||||
require.NoError(err)
|
||||
gotEvent := &cloudevents.Event{}
|
||||
err = json.Unmarshal(b, gotEvent)
|
||||
@@ -98,7 +97,7 @@ func Test_oidcLogger_Infof(t *testing.T) {
|
||||
l.Infof(tt.fmt, tt.args...)
|
||||
sinkFileName := c.AllEvents.Name()
|
||||
defer func() { _ = os.WriteFile(sinkFileName, nil, 0o666) }()
|
||||
b, err := ioutil.ReadFile(sinkFileName)
|
||||
b, err := os.ReadFile(sinkFileName)
|
||||
require.NoError(err)
|
||||
gotEvent := &cloudevents.Event{}
|
||||
err = json.Unmarshal(b, gotEvent)
|
||||
|
||||
@@ -79,20 +79,60 @@ func (g *GRPCLogFaker) Fatalln(args ...any) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func (g *GRPCLogFaker) Print(args ...any) {
|
||||
func (g *GRPCLogFaker) Info(args ...any) {
|
||||
if g.Log && g.Logger.IsDebug() {
|
||||
g.Logger.Debug(fmt.Sprint(args...))
|
||||
}
|
||||
}
|
||||
|
||||
func (g *GRPCLogFaker) Printf(format string, args ...any) {
|
||||
func (g *GRPCLogFaker) Infof(format string, args ...any) {
|
||||
if g.Log && g.Logger.IsDebug() {
|
||||
g.Logger.Debug(fmt.Sprintf(format, args...))
|
||||
}
|
||||
}
|
||||
|
||||
func (g *GRPCLogFaker) Println(args ...any) {
|
||||
func (g *GRPCLogFaker) Infoln(args ...any) {
|
||||
if g.Log && g.Logger.IsDebug() {
|
||||
g.Logger.Debug(fmt.Sprintln(args...))
|
||||
}
|
||||
}
|
||||
|
||||
func (g *GRPCLogFaker) Warning(args ...any) {
|
||||
if g.Log && g.Logger.IsDebug() {
|
||||
g.Logger.Debug(fmt.Sprint(args...))
|
||||
}
|
||||
}
|
||||
|
||||
func (g *GRPCLogFaker) Warningf(format string, args ...any) {
|
||||
if g.Log && g.Logger.IsDebug() {
|
||||
g.Logger.Debug(fmt.Sprintf(format, args...))
|
||||
}
|
||||
}
|
||||
|
||||
func (g *GRPCLogFaker) Warningln(args ...any) {
|
||||
if g.Log && g.Logger.IsDebug() {
|
||||
g.Logger.Debug(fmt.Sprintln(args...))
|
||||
}
|
||||
}
|
||||
|
||||
func (g *GRPCLogFaker) Error(args ...any) {
|
||||
if g.Log && g.Logger.IsDebug() {
|
||||
g.Logger.Debug(fmt.Sprint(args...))
|
||||
}
|
||||
}
|
||||
|
||||
func (g *GRPCLogFaker) Errorf(format string, args ...any) {
|
||||
if g.Log && g.Logger.IsDebug() {
|
||||
g.Logger.Debug(fmt.Sprintf(format, args...))
|
||||
}
|
||||
}
|
||||
|
||||
func (g *GRPCLogFaker) Errorln(args ...any) {
|
||||
if g.Log && g.Logger.IsDebug() {
|
||||
g.Logger.Debug(fmt.Sprintln(args...))
|
||||
}
|
||||
}
|
||||
|
||||
func (g *GRPCLogFaker) V(l int) bool {
|
||||
return true
|
||||
}
|
||||
@@ -285,7 +285,7 @@ func (b *Server) SetupLogging(flagLogLevel, flagLogFormat, configLogLevel, confi
|
||||
|
||||
// create GRPC logger
|
||||
namedGRPCLogFaker := b.Logger.Named("grpclogfaker")
|
||||
grpclog.SetLogger(&GRPCLogFaker{
|
||||
grpclog.SetLoggerV2(&GRPCLogFaker{
|
||||
Logger: namedGRPCLogFaker,
|
||||
Log: os.Getenv("BOUNDARY_GRPC_LOGGING") != "",
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user