Skip to content

Commit

Permalink
Merge pull request #24 from testwill/fmt
Browse files Browse the repository at this point in the history
chore: unnecessary use of fmt.Sprintf
  • Loading branch information
dingfeng authored Oct 20, 2023
2 parents 9050ec5 + 8d33039 commit 996e35e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pkg/hpfs/filestream/flowcontrol.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (f *FlowControlManger) Stop() {

func (f *FlowControlManger) LimitFlow(reader io.Reader, writer io.Writer, notifyWriter io.Writer) (int64, error) {
if !f.tryAcquire() {
return 0, errors.New(fmt.Sprintf("Throttled"))
return 0, errors.New("Throttled")
}
ctx, cancel := context.WithCancel(context.Background())
tokensChan := make(chan int, 2)
Expand Down
2 changes: 1 addition & 1 deletion pkg/meta/core/gms/manager_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -1219,7 +1219,7 @@ func (meta *manager) ListCdcNodes() ([]CdcNodeInfo, error) {
}
defer dbutil.DeferClose(conn)

selectStmt := fmt.Sprintf("SELECT container_id, ip, daemon_port FROM binlog_node_info")
selectStmt := "SELECT container_id, ip, daemon_port FROM binlog_node_info"

rs, err := conn.QueryContext(meta.ctx, selectStmt)
if err != nil {
Expand Down
14 changes: 7 additions & 7 deletions pkg/meta/core/group/group_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ func (m *groupManager) ListSchemas() ([]string, error) {
return nil, err
}

rs, err := db.QueryContext(m.ctx, fmt.Sprintf("SHOW DATABASES"))
rs, err := db.QueryContext(m.ctx, "SHOW DATABASES")
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -466,7 +466,7 @@ func (m *groupManager) ListAllGroups() (map[string][]Group, error) {
}
defer dbutil.DeferClose(conn)

rs, err := conn.QueryContext(m.ctx, fmt.Sprintf("SHOW DS"))
rs, err := conn.QueryContext(m.ctx, "SHOW DS")
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -741,7 +741,7 @@ func (m *groupManager) getCnVersion() (string, error) {
}

ver := ""
rs, err := db.Query(fmt.Sprint("select version()"))
rs, err := db.Query("select version()")
if err != nil {
return "", err
}
Expand All @@ -765,7 +765,7 @@ func (m *groupManager) getDnVersion() (string, error) {
}

ver := ""
rs, err := db.Query(fmt.Sprint("select @@version"))
rs, err := db.Query("select @@version")
if err != nil {
return "", err
}
Expand Down Expand Up @@ -800,7 +800,7 @@ func (m *groupManager) GetBinlogOffset() (string, error) {
if err != nil {
return "", err
}
rs, err := db.Query(fmt.Sprint("show master status"))
rs, err := db.Query("show master status")
if err != nil {
return "", err
}
Expand Down Expand Up @@ -899,7 +899,7 @@ func (m *groupManager) ShowSlaveStatus() (*SlaveStatus, error) {
}
defer dbutil.DeferClose(conn)

rs, err := conn.QueryContext(m.ctx, fmt.Sprintf("SHOW SLAVE STATUS"))
rs, err := conn.QueryContext(m.ctx, "SHOW SLAVE STATUS")
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -929,7 +929,7 @@ func (m *groupManager) ShowClusterStatus() ([]*ClusterStatus, error) {
}
defer dbutil.DeferClose(conn)

rs, err := conn.QueryContext(m.ctx, fmt.Sprintf("SELECT * FROM INFORMATION_SCHEMA.ALISQL_CLUSTER_GLOBAL"))
rs, err := conn.QueryContext(m.ctx, "SELECT * FROM INFORMATION_SCHEMA.ALISQL_CLUSTER_GLOBAL")
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/operator/v1/xstore/change/driver/plan/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (step *Step) Priority() int {
func (step *Step) Description() string {
switch step.Type {
case StepTypeSnapshot:
return fmt.Sprintf("Snapshot")
return "Snapshot"
case StepTypeBumpGen:
return fmt.Sprintf(
"BumpGen(%s, from: %d, to: %d)",
Expand Down
1 change: 0 additions & 1 deletion pkg/pitr/restore_binlog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ func TestOssAliyunTest(t *testing.T) {
if err == nil {
err = ft.Wait()
}
fmt.Sprintf("sd")
}

func TestTimeZone(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/webhook/polardbxcluster/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ func (v *PolarDBXClusterV1Validator) validate(ctx context.Context, polardbx *pol
errList = append(errList, field.Invalid(
field.NewPath("spec", "primaryCluster"),
spec.PrimaryCluster,
fmt.Sprintf(`primaryCluster cannot be empty for readonly pxc`),
`primaryCluster cannot be empty for readonly pxc`,
))
}
}
Expand Down

0 comments on commit 996e35e

Please sign in to comment.