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=

internal/test/compilecheck/go.mod

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
module go.mongodb.go/mongo-driver/internal/test/compilecheck
22

3-
go 1.13
3+
go 1.18
44

55
replace go.mongodb.org/mongo-driver => ../../../
66

77
// Note that the Go driver version is replaced with the local Go driver code by
88
// the replace directive above.
99
require go.mongodb.org/mongo-driver v1.11.7
10+
11+
require (
12+
github.com/golang/snappy v0.0.1 // indirect
13+
github.com/klauspost/compress v1.13.6 // indirect
14+
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
15+
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
16+
github.com/xdg-go/scram v1.1.2 // indirect
17+
github.com/xdg-go/stringprep v1.0.4 // indirect
18+
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
19+
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
20+
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
21+
golang.org/x/text v0.7.0 // indirect
22+
)

internal/test/compilecheck/go.sum

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
2-
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
32
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
43
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
54
github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=
6-
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
75
github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc=
86
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
97
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe h1:iruDEfMl2E6fbMZ9s0scYfZQ84/6SPL6zC8ACM2oIL0=
@@ -24,22 +22,19 @@ golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0
2422
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
2523
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
2624
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=
2825
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
2926
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
3027
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw=
3128
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
3229
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
3330
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=
3531
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
3632
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
3733
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
3834
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
3935
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
4036
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
4137
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=
4338
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
4439
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
4540
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
@@ -49,4 +44,3 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn
4944
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
5045
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
5146
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
52-
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

internal/test/faas/awslambda/mongodb/go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ replace go.mongodb.org/mongo-driver => ../../../../../
66

77
require (
88
github.com/aws/aws-lambda-go v1.41.0
9+
910
// Note that the Go driver version is replaced with the local Go driver code
1011
// by the replace directive above.
1112
go.mongodb.org/mongo-driver v1.11.7

internal/test/faas/awslambda/mongodb/go.sum

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
github.com/aws/aws-lambda-go v1.41.0 h1:l/5fyVb6Ud9uYd411xdHZzSf2n86TakxzpvIoz7l+3Y=
22
github.com/aws/aws-lambda-go v1.41.0/go.mod h1:jwFe2KmMsHmffA1X2R09hH6lFzJQxzI8qK17ewzbQMM=
33
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
4-
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
54
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
65
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
76
github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=
8-
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
97
github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc=
108
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
119
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe h1:iruDEfMl2E6fbMZ9s0scYfZQ84/6SPL6zC8ACM2oIL0=
@@ -28,22 +26,19 @@ golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0
2826
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
2927
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
3028
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
31-
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
3229
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
3330
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
3431
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw=
3532
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
3633
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
3734
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
38-
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
3935
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
4036
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
4137
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
4238
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
4339
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
4440
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
4541
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
46-
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
4742
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
4843
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
4944
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
@@ -53,5 +48,4 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn
5348
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
5449
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
5550
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
56-
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
5751
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

mongo/crud_examples_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@ func ExampleCollection_Find_primitiveRegex() {
10861086
panic(err)
10871087
}
10881088

1089-
defer client.Disconnect(ctx)
1089+
defer func() { _ = client.Disconnect(ctx) }()
10901090

10911091
type Pet struct {
10921092
Type string `bson:"type"`
@@ -1127,7 +1127,7 @@ func ExampleCollection_Find_regex() {
11271127
panic(err)
11281128
}
11291129

1130-
defer client.Disconnect(ctx)
1130+
defer func() { _ = client.Disconnect(ctx) }()
11311131

11321132
type Pet struct {
11331133
Type string `bson:"type"`

mongo/database_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func TestDatabase(t *testing.T) {
9898
t.Run("TransientTransactionError label", func(t *testing.T) {
9999
client := setupClient(options.Client().ApplyURI("mongodb://nonexistent").SetServerSelectionTimeout(3 * time.Second))
100100
err := client.Connect(bgCtx)
101-
defer client.Disconnect(bgCtx)
101+
defer func() { _ = client.Disconnect(bgCtx) }()
102102
assert.Nil(t, err, "expected nil, got %v", err)
103103

104104
t.Run("negative case of non-transaction", func(t *testing.T) {

mongo/integration/errors_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func TestErrors(t *testing.T) {
7777
integtest.AddTestServerAPIVersion(clientOpts)
7878
client, err := mongo.Connect(context.Background(), clientOpts)
7979
assert.Nil(mt, err, "Connect error: %v", err)
80-
defer client.Disconnect(context.Background())
80+
defer func() { _ = client.Disconnect(context.Background()) }()
8181

8282
// A connection getting closed should manifest as an io.EOF error.
8383
err = client.Ping(context.Background(), mtest.PrimaryRp)

mongo/integration/unified/admin_helpers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func runCommandOnHost(ctx context.Context, host string, commandFn func(context.C
9090
if err != nil {
9191
return fmt.Errorf("error creating client to host %q: %w", host, err)
9292
}
93-
defer client.Disconnect(ctx)
93+
defer func() { _ = client.Disconnect(ctx) }()
9494

9595
return commandFn(ctx, client)
9696
}

mongo/ocsp_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func TestOCSP(t *testing.T) {
3434
clientOpts := createOCSPClientOptions(cs.Original)
3535
client, err := Connect(bgCtx, clientOpts)
3636
assert.Nil(t, err, "Connect error: %v", err)
37-
defer client.Disconnect(bgCtx)
37+
defer func() { _ = client.Disconnect(bgCtx) }()
3838

3939
err = client.Ping(bgCtx, readpref.Primary())
4040
if shouldSucceed {
@@ -49,7 +49,7 @@ func TestOCSP(t *testing.T) {
4949
clientOpts := createInsecureOCSPClientOptions(cs.Original)
5050
client, err := Connect(bgCtx, clientOpts)
5151
assert.Nil(t, err, "Connect error: %v", err)
52-
defer client.Disconnect(bgCtx)
52+
defer func() { _ = client.Disconnect(bgCtx) }()
5353

5454
err = client.Ping(bgCtx, readpref.Primary())
5555
assert.Nil(t, err, "Ping error: %v", err)

mongo/options/example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func ExampleClientOptions_SetLoggerOptions_customLogger() {
5959
log.Fatalf("error connecting to MongoDB: %v", err)
6060
}
6161

62-
defer client.Disconnect(context.TODO())
62+
defer func() { _ = client.Disconnect(context.TODO()) }()
6363

6464
// Make a database request to test our logging solution.
6565
coll := client.Database("test").Collection("test")

vendor/github.com/golang/snappy/go.mod

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)