From 3cb64eb0bb1f9d83ce09aec81fb70a980d71b286 Mon Sep 17 00:00:00 2001 From: DerekBum Date: Thu, 8 Feb 2024 15:50:30 +0300 Subject: [PATCH] api: bump go to 1.20 Bump go version to 1.20. Update ci to use go version 1.20 and newer. Remove usage of the deprecated libraries. Part of #378 --- .github/workflows/testing.yml | 9 +++++---- future_test.go | 3 +-- go.mod | 9 ++++++++- response.go | 3 +-- test_helpers/main.go | 12 ++++++++---- test_helpers/response.go | 3 +-- 6 files changed, 24 insertions(+), 15 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index d70f3b962..e50e7dcd0 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -29,7 +29,8 @@ jobs: fail-fast: false matrix: golang: - - 1.13 + - 1.20 + - stable tarantool: - '1.10' - '2.8' @@ -40,10 +41,10 @@ jobs: include: - tarantool: 'master' coveralls: true - golang: 1.13 + golang: 1.20 - tarantool: 'master' fuzzing: true - golang: 1.18 + golang: 1.20 coveralls: false steps: @@ -132,7 +133,7 @@ jobs: fail-fast: false matrix: golang: - - 1.13 + - 1.20 runs-on: - macos-11 - macos-12 diff --git a/future_test.go b/future_test.go index 6efda10a1..0c8bb79cc 100644 --- a/future_test.go +++ b/future_test.go @@ -5,7 +5,6 @@ import ( "context" "errors" "io" - "io/ioutil" "sync" "testing" "time" @@ -74,7 +73,7 @@ func (resp *futureMockResponse) DecodeTyped(res interface{}) error { } func createFutureMockResponse(header Header, body io.Reader) (Response, error) { - data, err := ioutil.ReadAll(body) + data, err := io.ReadAll(body) if err != nil { return nil, err } diff --git a/go.mod b/go.mod index 4f97af1a6..802b8412c 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/tarantool/go-tarantool/v2 -go 1.11 +go 1.20 require ( github.com/google/uuid v1.3.0 @@ -9,3 +9,10 @@ require ( github.com/tarantool/go-iproto v1.0.0 github.com/vmihailenco/msgpack/v5 v5.3.5 ) + +require ( + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) diff --git a/response.go b/response.go index db88c743c..2c287f8bb 100644 --- a/response.go +++ b/response.go @@ -3,7 +3,6 @@ package tarantool import ( "fmt" "io" - "io/ioutil" "github.com/tarantool/go-iproto" "github.com/vmihailenco/msgpack/v5" @@ -39,7 +38,7 @@ func createBaseResponse(header Header, body io.Reader) (baseResponse, error) { if buf, ok := body.(*smallBuf); ok { return baseResponse{header: header, buf: *buf}, nil } - data, err := ioutil.ReadAll(body) + data, err := io.ReadAll(body) if err != nil { return baseResponse{}, err } diff --git a/test_helpers/main.go b/test_helpers/main.go index 200c3f474..e97fbc631 100644 --- a/test_helpers/main.go +++ b/test_helpers/main.go @@ -15,7 +15,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "log" "os" "os/exec" @@ -188,7 +187,7 @@ func StartTarantool(startOpts StartOpts) (TarantoolInstance, error) { // Create work_dir for a new instance. // TO DO: replace with `os.MkdirTemp` when we drop support of // Go 1.16 an older - dir, err = ioutil.TempDir("", "work_dir") + dir, err = os.MkdirTemp("", "work_dir") if err != nil { return inst, err } @@ -305,7 +304,7 @@ func copySslCerts(dst string, sslCertsDir string) (err error) { } func copyDirectoryFiles(scrDir, dest string) error { - entries, err := ioutil.ReadDir(scrDir) + entries, err := os.ReadDir(scrDir) if err != nil { return err } @@ -324,7 +323,12 @@ func copyDirectoryFiles(scrDir, dest string) error { return err } - if err := os.Chmod(destPath, entry.Mode()); err != nil { + info, err := entry.Info() + if err != nil { + return err + } + + if err := os.Chmod(destPath, info.Mode()); err != nil { return err } } diff --git a/test_helpers/response.go b/test_helpers/response.go index 4a28400c0..f8757f563 100644 --- a/test_helpers/response.go +++ b/test_helpers/response.go @@ -3,7 +3,6 @@ package test_helpers import ( "bytes" "io" - "io/ioutil" "testing" "github.com/vmihailenco/msgpack/v5" @@ -43,7 +42,7 @@ func CreateMockResponse(header tarantool.Header, body io.Reader) (*MockResponse, if body == nil { return &MockResponse{header: header, data: nil}, nil } - data, err := ioutil.ReadAll(body) + data, err := io.ReadAll(body) if err != nil { return nil, err }