Skip to content

Commit 183268c

Browse files
GODRIVER-3082 Bump the minimum Go version to 1.18 (#1539)
1 parent 6ee7ffc commit 183268c

File tree

31 files changed

+63
-121
lines changed

31 files changed

+63
-121
lines changed

.evergreen/config.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,6 @@ functions:
577577
578578
# Per the LB testing spec, the URI of an LB fronting a single mongos should be used to configure internal
579579
# testing Client instances, so we set MONGODB_URI to SINGLE_MONGOS_LB_URI.
580-
581580
export GOFLAGS=-mod=vendor
582581
AUTH="${AUTH}" \
583582
SSL="${SSL}" \
@@ -1700,15 +1699,13 @@ tasks:
17001699
MONGO_GO_DRIVER_COMPRESSOR: "snappy"
17011700

17021701
# Build with the oldest supported version of Go.
1703-
- name: go1.13-build
1702+
- name: go1.18-build
17041703
tags: ["compile-check"]
17051704
commands:
17061705
- func: run-make
17071706
vars:
1708-
# We only test building the compilecheck submodule with Go 1.13 because the root module's
1709-
# go.mod file contains retract directives, which are not supported until Go 1.16.
17101707
targets: "build-compile-check"
1711-
BUILD_ENV: "PATH=/opt/golang/go1.13/bin:$PATH GOROOT=/opt/golang/go1.13"
1708+
BUILD_ENV: "PATH=/opt/golang/go1.18/bin:$PATH GOROOT=/opt/golang/go1.18"
17121709

17131710
# Build with the same Go version that we're using for tests.
17141711
- name: build

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ ______________________________________________________________________
1414

1515
## Requirements
1616

17-
- Go 1.13 or higher. We aim to support the latest versions of Go.
18-
- `go mod tidy` will error when importing the Go Driver using Go versions older than 1.15 due to dependencies that import [io/fs](https://pkg.go.dev/io/fs). See golang/go issue [#44557](https://github.com/golang/go/issues/44557) for more information.
19-
- Go 1.20 or higher is required to run the driver test suite.
17+
- Go 1.18 or higher. We aim to support the latest versions of Go.
18+
- Go 1.20 or higher is required to run the driver test suite.
2019
- MongoDB 3.6 and higher.
2120

2221
______________________________________________________________________

benchmark/multi.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func MultiFindMany(ctx context.Context, tm TimerManager, iters int) error {
2121
if err != nil {
2222
return err
2323
}
24-
defer db.Client().Disconnect(ctx)
24+
defer func() { _ = db.Client().Disconnect(ctx) }()
2525

2626
db = db.Client().Database("perftest")
2727
if err = db.Drop(ctx); err != nil {
@@ -87,7 +87,7 @@ func multiInsertCase(ctx context.Context, tm TimerManager, iters int, data strin
8787
if err != nil {
8888
return err
8989
}
90-
defer db.Client().Disconnect(ctx)
90+
defer func() { _ = db.Client().Disconnect(ctx) }()
9191

9292
db = db.Client().Database("perftest")
9393
if err = db.Drop(ctx); err != nil {

benchmark/operation_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func BenchmarkClientWrite(b *testing.B) {
4141
if err != nil {
4242
b.Fatalf("error connecting: %v", err)
4343
}
44-
defer client.Disconnect(context.Background())
44+
defer func() { _ = client.Disconnect(context.Background()) }()
4545
coll := client.Database("test").Collection("test")
4646
_, err = coll.DeleteMany(context.Background(), bson.D{})
4747
if err != nil {
@@ -85,7 +85,7 @@ func BenchmarkClientBulkWrite(b *testing.B) {
8585
if err != nil {
8686
b.Fatalf("error connecting: %v", err)
8787
}
88-
defer client.Disconnect(context.Background())
88+
defer func() { _ = client.Disconnect(context.Background()) }()
8989
coll := client.Database("test").Collection("test")
9090
_, err = coll.DeleteMany(context.Background(), bson.D{})
9191
if err != nil {
@@ -134,7 +134,7 @@ func BenchmarkClientRead(b *testing.B) {
134134
if err != nil {
135135
b.Fatalf("error connecting: %v", err)
136136
}
137-
defer client.Disconnect(context.Background())
137+
defer func() { _ = client.Disconnect(context.Background()) }()
138138
coll := client.Database("test").Collection("test")
139139
_, err = coll.DeleteMany(context.Background(), bson.D{})
140140
if err != nil {

benchmark/single.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func SingleRunCommand(ctx context.Context, tm TimerManager, iters int) error {
4949
if err != nil {
5050
return err
5151
}
52-
defer db.Client().Disconnect(ctx)
52+
defer func() { _ = db.Client().Disconnect(ctx) }()
5353

5454
cmd := bson.D{{handshake.LegacyHelloLowercase, true}}
5555

@@ -130,7 +130,7 @@ func singleInsertCase(ctx context.Context, tm TimerManager, iters int, data stri
130130
if err != nil {
131131
return err
132132
}
133-
defer db.Client().Disconnect(ctx)
133+
defer func() { _ = db.Client().Disconnect(ctx) }()
134134

135135
db = db.Client().Database("perftest")
136136
if err = db.Drop(ctx); err != nil {

cmd/testkms/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func main() {
8787
if err != nil {
8888
panic(fmt.Sprintf("Connect error: %v", err))
8989
}
90-
defer keyVaultClient.Disconnect(context.Background())
90+
defer func() { _ = keyVaultClient.Disconnect(context.Background()) }()
9191

9292
kmsProvidersMap := map[string]map[string]interface{}{
9393
provider: {},

docs/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Before starting to write code, look for existing [tickets](https://jira.mongodb.
1717
The Go Driver team uses GitHub to manage and review all code changes. Patches should generally be made against the master (default) branch and include relevant tests, if
1818
applicable.
1919

20-
Code should compile and tests should pass under all Go versions which the driver currently supports. Currently the Go Driver supports a minimum version of Go 1.13 and requires Go 1.20 for development. Please run the following Make targets to validate your changes:
20+
Code should compile and tests should pass under all Go versions which the driver currently supports. Currently the Go Driver supports a minimum version of Go 1.18 and requires Go 1.20 for development. Please run the following Make targets to validate your changes:
2121

2222
- `make fmt`
2323
- `make lint` (requires [golangci-lint](https://github.com/golangci/golangci-lint) and [lll](https://github.com/walle/lll) to be installed and available in the `PATH`)

etc/compile_check.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ function compile_check {
2020
# Change the directory to the compilecheck test directory.
2121
cd ${COMPILE_CHECK_DIR}
2222

23+
# Test vendoring
24+
go mod vendor
25+
${GC} build -mod=vendor
26+
27+
rm -rf vendor
28+
2329
MACHINE_VERSION=`${GC} version | { read _ _ v _; echo ${v#go}; }`
2430

2531
# If the version is not 1.13, then run "go mod tidy"
@@ -34,7 +40,7 @@ function compile_check {
3440
${GC} build -buildmode=plugin
3541

3642
# Check build with tags.
37-
go build $BUILD_TAGS ./...
43+
${GC} build $BUILD_TAGS ./...
3844

3945
# Check build with various architectures.
4046
GOOS=linux GOARCH=386 ${GC} build ./...

go.mod

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module go.mongodb.org/mongo-driver
22

3-
go 1.13
3+
go 1.18
44

55
retract (
66
// GODRIVER-3059: The v1.13.0 Git tag changed, causing security errors when
@@ -32,5 +32,10 @@ require (
3232
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d
3333
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d
3434
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4
35+
)
36+
37+
require (
38+
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
3539
golang.org/x/text v0.7.0 // indirect
40+
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 // indirect
3641
)

go.sum

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,19 @@ golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0
2424
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
2525
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
2626
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
27-
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
2827
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
2928
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
3029
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw=
3130
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
3231
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
3332
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
34-
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
3533
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
3634
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
3735
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
3836
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
3937
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
4038
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
4139
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
42-
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
4340
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
4441
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
4542
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=

0 commit comments

Comments
 (0)