Skip to content

Commit 3b1e25b

Browse files
committed
go: 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
1 parent f33032e commit 3b1e25b

File tree

11 files changed

+40
-36
lines changed

11 files changed

+40
-36
lines changed

.github/workflows/reusable_testing.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- name: Setup golang for connector and tests
3737
uses: actions/setup-go@v2
3838
with:
39-
go-version: 1.13
39+
go-version: '1.20'
4040

4141
- name: Setup tt
4242
run: |

.github/workflows/testing.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ jobs:
2929
fail-fast: false
3030
matrix:
3131
golang:
32-
- 1.13
32+
- '1.20'
33+
- 'stable'
3334
tarantool:
3435
- '1.10'
3536
- '2.8'
@@ -40,10 +41,10 @@ jobs:
4041
include:
4142
- tarantool: 'master'
4243
coveralls: true
43-
golang: 1.13
44+
golang: '1.20'
4445
- tarantool: 'master'
4546
fuzzing: true
46-
golang: 1.18
47+
golang: '1.20'
4748
coveralls: false
4849

4950
steps:
@@ -132,7 +133,8 @@ jobs:
132133
fail-fast: false
133134
matrix:
134135
golang:
135-
- 1.13
136+
- '1.20'
137+
- 'stable'
136138
runs-on:
137139
- macos-11
138140
- macos-12

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ Versioning](http://semver.org/spec/v2.0.0.html) except to the first release.
103103
`pool.Instance` to determinate connection options (#356)
104104
- `pool.Connect`, `pool.ConnectWithOpts` and `pool.Add` add connections to
105105
the pool even it is unable to connect to it (#372)
106+
- Required Go version from `1.11` to `1.20` (#378)
106107

107108
### Deprecated
108109

Makefile

+3-10
Original file line numberDiff line numberDiff line change
@@ -114,22 +114,15 @@ coverage:
114114
.PHONY: coveralls
115115
coveralls: coverage
116116
go get github.com/mattn/goveralls
117+
go install github.com/mattn/goveralls
117118
goveralls -coverprofile=$(COVERAGE_FILE) -service=github
118119

119120
.PHONY: bench-deps
120121
${BENCH_PATH} bench-deps:
121122
@echo "Installing benchstat tool"
122-
rm -rf ${BENCH_PATH}
123-
mkdir ${BENCH_PATH}
124123
go clean -testcache
125-
# It is unable to build a latest version of benchstat with go 1.13. So
126-
# we need to switch to an old commit.
127-
cd ${BENCH_PATH} && \
128-
git clone https://go.googlesource.com/perf && \
129-
cd perf && \
130-
git checkout 91a04616dc65ba76dbe9e5cf746b923b1402d303 && \
131-
go install ./cmd/benchstat
132-
rm -rf ${BENCH_PATH}/perf
124+
go get golang.org/x/perf/cmd/benchstat
125+
go install golang.org/x/perf/cmd/benchstat
133126

134127
.PHONY: bench
135128
${BENCH_FILE} bench: ${BENCH_PATH}

README.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ faster than other packages according to public benchmarks.
4444
We assume that you have Tarantool version 1.10+ and a modern Linux or BSD
4545
operating system.
4646

47-
You need a current version of `go`, version 1.13 or later (use `go version` to
47+
You need a current version of `go`, version 1.20 or later (use `go version` to
4848
check the version number). Do not use `gccgo-go`.
4949

50-
**Note:** If your `go` version is older than 1.13 or if `go` is not installed,
50+
**Note:** If your `go` version is older than 1.20 or if `go` is not installed,
5151
download and run the latest tarball from [golang.org][golang-dl].
5252

5353
The package `go-tarantool` is located in [tarantool/go-tarantool][go-tarantool]
@@ -72,7 +72,7 @@ This allows us to introduce new features without losing backward compatibility.
7272
```
7373
go_tarantool_decimal_fuzzing
7474
```
75-
**Note:** It crashes old Tarantool versions and requires Go 1.18+.
75+
**Note:** It crashes old Tarantool versions.
7676

7777
## Documentation
7878

@@ -223,6 +223,10 @@ is only available in Tarantool Enterprise Edition 2.10 or newer.
223223

224224
The article describes migration from go-tarantool to go-tarantool/v2.
225225

226+
#### Go version
227+
228+
Required Go version is set to `1.20`.
229+
226230
#### datetime package
227231

228232
Now you need to use objects of the Datetime type instead of pointers to it. A

connection.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -1277,9 +1277,8 @@ func (conn *Connection) NewStream() (*Stream, error) {
12771277
type watchState struct {
12781278
// value is a current value.
12791279
value interface{}
1280-
// version is a current version of the value. The only reason for uint64:
1281-
// go 1.13 has no math.Uint.
1282-
version uint64
1280+
// version is a current version of the value.
1281+
version uint
12831282
// ack true if the acknowledge is already sent.
12841283
ack bool
12851284
// cnt is a count of active watchers for the key.
@@ -1292,7 +1291,7 @@ type watchState struct {
12921291
}
12931292

12941293
// initWatchEventVersion is an initial version until no events from Tarantool.
1295-
const initWatchEventVersion uint64 = 0
1294+
const initWatchEventVersion uint = 0
12961295

12971296
// connWatcher is an internal implementation of the Watcher interface.
12981297
type connWatcher struct {

future_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"context"
66
"errors"
77
"io"
8-
"io/ioutil"
98
"sync"
109
"testing"
1110
"time"
@@ -74,7 +73,7 @@ func (resp *futureMockResponse) DecodeTyped(res interface{}) error {
7473
}
7574

7675
func createFutureMockResponse(header Header, body io.Reader) (Response, error) {
77-
data, err := ioutil.ReadAll(body)
76+
data, err := io.ReadAll(body)
7877
if err != nil {
7978
return nil, err
8079
}

go.mod

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/tarantool/go-tarantool/v2
22

3-
go 1.11
3+
go 1.20
44

55
require (
66
github.com/google/uuid v1.3.0
@@ -9,3 +9,10 @@ require (
99
github.com/tarantool/go-iproto v1.0.0
1010
github.com/vmihailenco/msgpack/v5 v5.3.5
1111
)
12+
13+
require (
14+
github.com/davecgh/go-spew v1.1.0 // indirect
15+
github.com/pmezard/go-difflib v1.0.0 // indirect
16+
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
17+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
18+
)

response.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package tarantool
33
import (
44
"fmt"
55
"io"
6-
"io/ioutil"
76

87
"github.com/tarantool/go-iproto"
98
"github.com/vmihailenco/msgpack/v5"
@@ -39,7 +38,7 @@ func createBaseResponse(header Header, body io.Reader) (baseResponse, error) {
3938
if buf, ok := body.(*smallBuf); ok {
4039
return baseResponse{header: header, buf: *buf}, nil
4140
}
42-
data, err := ioutil.ReadAll(body)
41+
data, err := io.ReadAll(body)
4342
if err != nil {
4443
return baseResponse{}, err
4544
}

test_helpers/main.go

+8-7
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"errors"
1616
"fmt"
1717
"io"
18-
"io/ioutil"
1918
"log"
2019
"os"
2120
"os/exec"
@@ -185,10 +184,7 @@ func StartTarantool(startOpts StartOpts) (TarantoolInstance, error) {
185184
inst.Dialer = startOpts.Dialer
186185

187186
if startOpts.WorkDir == "" {
188-
// Create work_dir for a new instance.
189-
// TO DO: replace with `os.MkdirTemp` when we drop support of
190-
// Go 1.16 an older
191-
dir, err = ioutil.TempDir("", "work_dir")
187+
dir, err = os.MkdirTemp("", "work_dir")
192188
if err != nil {
193189
return inst, err
194190
}
@@ -305,7 +301,7 @@ func copySslCerts(dst string, sslCertsDir string) (err error) {
305301
}
306302

307303
func copyDirectoryFiles(scrDir, dest string) error {
308-
entries, err := ioutil.ReadDir(scrDir)
304+
entries, err := os.ReadDir(scrDir)
309305
if err != nil {
310306
return err
311307
}
@@ -324,7 +320,12 @@ func copyDirectoryFiles(scrDir, dest string) error {
324320
return err
325321
}
326322

327-
if err := os.Chmod(destPath, entry.Mode()); err != nil {
323+
info, err := entry.Info()
324+
if err != nil {
325+
return err
326+
}
327+
328+
if err := os.Chmod(destPath, info.Mode()); err != nil {
328329
return err
329330
}
330331
}

test_helpers/response.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package test_helpers
33
import (
44
"bytes"
55
"io"
6-
"io/ioutil"
76
"testing"
87

98
"github.com/vmihailenco/msgpack/v5"
@@ -43,7 +42,7 @@ func CreateMockResponse(header tarantool.Header, body io.Reader) (*MockResponse,
4342
if body == nil {
4443
return &MockResponse{header: header, data: nil}, nil
4544
}
46-
data, err := ioutil.ReadAll(body)
45+
data, err := io.ReadAll(body)
4746
if err != nil {
4847
return nil, err
4948
}

0 commit comments

Comments
 (0)