diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 77865b43..2e4487d1 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - goVer: ['1.16', '1.17', '1.18', '1.19', '1.20', '1.21', '1.22'] + goVer: ['1.16', '1.17', '1.18', '1.19', '1.20', '1.21', '1.22', '1.23'] steps: - uses: actions/checkout@v2 - name: Setup go ${{ matrix.goVer }} @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - goVer: ['1.16', '1.17', '1.18', '1.19', '1.20', '1.21', '1.22'] + goVer: ['1.16', '1.17', '1.18', '1.19', '1.20', '1.21', '1.22', '1.23'] steps: - uses: actions/checkout@v2 - name: Setup go ${{ matrix.goVer }} @@ -67,7 +67,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - goVer: ['1.16', '1.17', '1.18', '1.19', '1.20', '1.21', '1.22'] + goVer: ['1.16', '1.17', '1.18', '1.19', '1.20', '1.21', '1.22', '1.23'] steps: - uses: actions/checkout@v2 - name: Setup go ${{ matrix.goVer }} diff --git a/configs.go b/configs.go index f1104dc4..206df30b 100644 --- a/configs.go +++ b/configs.go @@ -12,7 +12,7 @@ import ( "crypto/tls" "crypto/x509" "fmt" - "io/ioutil" + "io" "net/http" "os" "time" @@ -108,7 +108,7 @@ func openAndReadFile(path string) ([]byte, error) { return nil, fmt.Errorf("unable to open file %s: %s", path, err) } // read file - b, err := ioutil.ReadAll(f) + b, err := io.ReadAll(f) if err != nil { return nil, fmt.Errorf("unable to ReadAll file %s: %s", path, err) } diff --git a/connection.go b/connection.go index 5f4e108e..8028b35b 100644 --- a/connection.go +++ b/connection.go @@ -199,7 +199,8 @@ func (cn *connection) ExecuteJsonWithParameter(sessionID int64, stmt string, par jsonResp, err := cn.graph.ExecuteJsonWithParameter(sessionID, []byte(stmt), params) if err != nil { // reopen the connection if timeout - if _, ok := err.(thrift.TransportException); ok { + _, ok := err.(thrift.TransportException) + if ok { if err.(thrift.TransportException).TypeID() == thrift.TIMED_OUT { reopenErr := cn.reopen() if reopenErr != nil { diff --git a/result_set_test.go b/result_set_test.go index aaccd155..870ae28b 100644 --- a/result_set_test.go +++ b/result_set_test.go @@ -502,7 +502,7 @@ func TestNode(t *testing.T) { vertex := getVertex("Tom", 3, 5) node, err := genNode(vertex, testTimezone) if err != nil { - t.Errorf(err.Error()) + t.Error(err.Error()) } assert.Equal(t, "\"Tom\"", node.GetID().String()) @@ -517,7 +517,7 @@ func TestNode(t *testing.T) { for i := 0; i < len(keysCopy); i++ { actualVal, err := props[keysCopy[i]].AsInt() if err != nil { - t.Errorf(err.Error()) + t.Error(err.Error()) } assert.Equal(t, int64(i), actualVal) } @@ -527,7 +527,7 @@ func TestRelationship(t *testing.T) { edge := getEdge("Tom", "Lily", 5) relationship, err := genRelationship(edge, testTimezone) if err != nil { - t.Errorf(err.Error()) + t.Error(err.Error()) } assert.Equal(t, "\"Tom\"", relationship.GetSrcVertexID().String()) assert.Equal(t, "\"Lily\"", relationship.GetDstVertexID().String()) @@ -542,7 +542,7 @@ func TestRelationship(t *testing.T) { for i := 0; i < len(keysCopy); i++ { actualVal, err := props[keysCopy[i]].AsInt() if err != nil { - t.Errorf(err.Error()) + t.Error(err.Error()) } assert.Equal(t, int64(i), actualVal) } @@ -552,17 +552,17 @@ func TestPathWrapper(t *testing.T) { path := getPath("Tom", 5) pathWrapper, err := genPathWrapper(path, testTimezone) if err != nil { - t.Errorf(err.Error()) + t.Error(err.Error()) } assert.Equal(t, 5, pathWrapper.GetPathLength()) node, err := genNode(getVertex("Tom", 3, 5), testTimezone) if err != nil { - t.Errorf(err.Error()) + t.Error(err.Error()) } assert.Equal(t, true, pathWrapper.ContainsNode(*node)) relationship, err := genRelationship(getEdge("Tom", "vertex0", 5), testTimezone) if err != nil { - t.Errorf(err.Error()) + t.Error(err.Error()) } assert.Equal(t, true, pathWrapper.ContainsRelationship(relationship)) @@ -571,7 +571,7 @@ func TestPathWrapper(t *testing.T) { for i := 0; i < 5; i++ { genNode, err := genNode(getVertex(fmt.Sprintf("vertex%d", i), 3, 5), testTimezone) if err != nil { - t.Errorf(err.Error()) + t.Error(err.Error()) } nodeList = append(nodeList, *genNode) } @@ -587,7 +587,7 @@ func TestPathWrapper(t *testing.T) { } newRelationship, err := genRelationship(edge, testTimezone) if err != nil { - t.Errorf(err.Error()) + t.Error(err.Error()) } relationshipList = append(relationshipList, newRelationship) } @@ -696,7 +696,7 @@ func TestResultSet(t *testing.T) { record, err := resultSet.GetRowValuesByIndex(0) if err != nil { - t.Fatalf(err.Error()) + t.Fatal(err.Error()) } temp, _ := record.GetValueByIndex(0) _, err = temp.AsNode() @@ -839,7 +839,7 @@ func TestIntVid(t *testing.T) { vertex := getVertexInt(101, 3, 5) node, err := genNode(vertex, testTimezone) if err != nil { - t.Errorf(err.Error()) + t.Error(err.Error()) } assert.Equal(t, "101", node.GetID().String()) @@ -854,7 +854,7 @@ func TestIntVid(t *testing.T) { for i := 0; i < len(keysCopy); i++ { actualVal, err := props[keysCopy[i]].AsInt() if err != nil { - t.Errorf(err.Error()) + t.Error(err.Error()) } assert.Equal(t, int64(i), actualVal) } diff --git a/session.go b/session.go index b94d2c3c..ad896e1f 100644 --- a/session.go +++ b/session.go @@ -286,7 +286,6 @@ func (session *Session) ShowSpaces() ([]SpaceName, error) { func (session *Session) reConnect() error { newConnection, err := session.connPool.getIdleConn() if err != nil { - err = fmt.Errorf(err.Error()) return err }