From 51353096bdbad575397378205a1e1f15f9fc0d2c Mon Sep 17 00:00:00 2001 From: Xin Hao Date: Tue, 27 Feb 2024 15:36:15 +0800 Subject: [PATCH] chore: fix warning (#318) Co-authored-by: Anqi --- result_set.go | 6 +++--- result_set_test.go | 4 ++-- session.go | 2 +- session_pool.go | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/result_set.go b/result_set.go index 02f0b3e1..d7ba3f2c 100644 --- a/result_set.go +++ b/result_set.go @@ -714,7 +714,7 @@ func (relationship Relationship) String() string { dst = ValueWrapper{edge.Src, relationship.timezoneInfo}.String() } return fmt.Sprintf(`[:%s %s->%s @%d {%s}]`, - string(edge.Name), src, dst, edge.Ranking, fmt.Sprintf("%s", strings.Join(kvStr, ", "))) + string(edge.Name), src, dst, edge.Ranking, strings.Join(kvStr, ", ")) } func (r1 Relationship) IsEqualTo(r2 *Relationship) bool { @@ -814,7 +814,7 @@ func (pathWrap *PathWrapper) String() string { dirChar1, string(step.Name), step.Ranking, - fmt.Sprintf("%s", strings.Join(kvStr, ", ")), + strings.Join(kvStr, ", "), dirChar2, ValueWrapper{&nebula.Value{VVal: step.Dst}, pathWrap.timezoneInfo}.String()) } @@ -1379,7 +1379,7 @@ func MakeProfilingData(planNodeDesc *graph.PlanNodeDescription, isTckFmt bool) s } var buffer bytes.Buffer json.Indent(&buffer, []byte(allProfiles), "", " ") - return string(buffer.Bytes()) + return buffer.String() } // generate operator info for Row format. diff --git a/result_set_test.go b/result_set_test.go index 5238b222..e7d6a248 100644 --- a/result_set_test.go +++ b/result_set_test.go @@ -696,10 +696,10 @@ func TestResultSet(t *testing.T) { if err != nil { t.Fatalf(err.Error()) } - temp, err := record.GetValueByIndex(0) + temp, _ := record.GetValueByIndex(0) _, err = temp.AsNode() assert.EqualError(t, err, "failed to convert value int to Node, value is not an vertex") - temp, err = record.GetValueByColName("col2") + _, err = record.GetValueByColName("col2") assert.EqualError(t, err, "failed to get values, given column name 'col2' does not exist") val, _ := record.GetValueByColName("col2_vertex") node, _ := val.AsNode() diff --git a/session.go b/session.go index 6a7da2af..149955f8 100644 --- a/session.go +++ b/session.go @@ -327,7 +327,7 @@ func value2Nvalue(any interface{}) (value *nebula.Value, err error) { value.SetGgVal(&v) } else { // unsupported other Value type, use this function carefully - err = fmt.Errorf("Only support convert boolean/float/int/string/map/list to nebula.Value but %T", any) + err = fmt.Errorf("only support convert boolean/float/int/string/map/list to nebula.Value but %T", any) } return } diff --git a/session_pool.go b/session_pool.go index 43f1aef9..f8c97b93 100644 --- a/session_pool.go +++ b/session_pool.go @@ -281,7 +281,7 @@ func (pool *SessionPool) ExecuteAndCheck(q string) (*ResultSet, error) { errCode := rs.GetErrorCode() if errCode != ErrorCode_SUCCEEDED { errMsg := rs.GetErrorMsg() - return nil, fmt.Errorf("Fail to execute query. %s", errMsg) + return nil, fmt.Errorf("fail to execute query. %s", errMsg) } return rs, nil