Skip to content

Commit

Permalink
chore: unnecessary use of fmt.Sprintf (#1080)
Browse files Browse the repository at this point in the history
Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
  • Loading branch information
testwill authored Sep 12, 2023
1 parent b192bc7 commit 3de6322
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions clickhouse_std.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type stdConnOpener struct {
func (o *stdConnOpener) Driver() driver.Driver {
var debugf = func(format string, v ...any) {}
if o.opt.Debug {
debugf = log.New(os.Stdout, fmt.Sprintf("[clickhouse-std] "), 0).Printf
debugf = log.New(os.Stdout, "[clickhouse-std] ", 0).Printf
}
return &stdDriver{debugf: debugf}
}
Expand Down Expand Up @@ -125,7 +125,7 @@ func Connector(opt *Options) driver.Connector {

var debugf = func(format string, v ...any) {}
if o.Debug {
debugf = log.New(os.Stdout, fmt.Sprintf("[clickhouse-std][opener] "), 0).Printf
debugf = log.New(os.Stdout, "[clickhouse-std][opener] ", 0).Printf
}
return &stdConnOpener{
opt: o,
Expand All @@ -149,7 +149,7 @@ func OpenDB(opt *Options) *sql.DB {
settings = append(settings, "SetConnMaxLifetime")
}
if opt.Debug {
debugf = log.New(os.Stdout, fmt.Sprintf("[clickhouse-std][opener] "), 0).Printf
debugf = log.New(os.Stdout, "[clickhouse-std][opener] ", 0).Printf
}
if len(settings) != 0 {
return sql.OpenDB(&stdConnOpener{
Expand Down Expand Up @@ -189,7 +189,7 @@ func (std *stdDriver) Open(dsn string) (_ driver.Conn, err error) {
o := opt.setDefaults()
var debugf = func(format string, v ...any) {}
if o.Debug {
debugf = log.New(os.Stdout, fmt.Sprintf("[clickhouse-std][opener] "), 0).Printf
debugf = log.New(os.Stdout, "[clickhouse-std][opener] ", 0).Printf
}
o.ClientInfo.comment = []string{"database/sql"}
return (&stdConnOpener{opt: o, debugf: debugf}).Connect(context.Background())
Expand Down

0 comments on commit 3de6322

Please sign in to comment.