Skip to content

Commit bec2c08

Browse files
authored
Merge branch 'v1' into godriver3140
2 parents 12fb07c + 8192e81 commit bec2c08

File tree

249 files changed

+5225
-2732
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

249 files changed

+5225
-2732
lines changed

.evergreen/config.yml

Lines changed: 133 additions & 122 deletions
Large diffs are not rendered by default.

.evergreen/run-tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ fi
8787

8888
AUTH=${AUTH} \
8989
SSL=${SSL} \
90+
SKIP_CSOT_TESTS=${SKIP_CSOT_TESTS} \
9091
MONGO_GO_DRIVER_CA_FILE=${MONGO_GO_DRIVER_CA_FILE} \
9192
MONGO_GO_DRIVER_KEY_FILE=${MONGO_GO_DRIVER_KEY_FILE} \
9293
MONGO_GO_DRIVER_PKCS8_ENCRYPTED_KEY_FILE=${MONGO_GO_DRIVER_PKCS8_ENCRYPTED_KEY_FILE} \

.golangci.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
run:
22
timeout: 5m
3-
skip-dirs-use-default: false
4-
skip-dirs:
5-
- (^|/)vendor($|/)
6-
- (^|/)testdata($|/)
7-
- (^|/)etc($|/)
8-
# Disable all linters for "golang.org/x/exp/rand" package in internal/rand.
9-
- internal/rand
103

114
linters:
125
disable-all: true
@@ -35,11 +28,7 @@ linters:
3528

3629
linters-settings:
3730
errcheck:
38-
exclude: .errcheck-excludes
39-
gocritic:
40-
enabled-checks:
41-
# Detects suspicious append result assignments. E.g. "b := append(a, 1, 2, 3)"
42-
- appendAssign
31+
exclude-functions: .errcheck-excludes
4332
govet:
4433
disable:
4534
- cgocall
@@ -55,6 +44,14 @@ linters-settings:
5544
]
5645

5746
issues:
47+
exclude-dirs-use-default: false
48+
exclude-dirs:
49+
- (^|/)testdata($|/)
50+
- (^|/)etc($|/)
51+
# Disable all linters for copied third-party code.
52+
- internal/rand
53+
- internal/aws
54+
- internal/assert
5855
exclude-use-default: false
5956
exclude:
6057
# Add all default excluded issues except issues related to exported types/functions not having

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ repos:
4040
rev: "v2.2.6"
4141
hooks:
4242
- id: codespell
43-
args: ["-L", "te,fo,fle,alo,nin,compres,wil,collone,asess,sav,ot,wll,dne,nulll,hellow"]
43+
args: ["-L", "te,fo,fle,alo,nin,compres,wil,collone,asess,sav,ot,wll,dne,nulll,hellow,aks"]
4444
exclude: ^(vendor/|benchmark/operation_test.go)
4545
exclude_types: [json,yaml,pem]
4646

@@ -51,6 +51,6 @@ repos:
5151
exclude: ^(vendor)
5252

5353
- repo: https://github.com/golangci/golangci-lint
54-
rev: v1.55.1
54+
rev: v1.59.1
5555
hooks:
5656
- id: golangci-lint

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ check-fmt: install-lll
6060
check-modules:
6161
go mod tidy -v
6262
go mod vendor
63-
git diff --exit-code go.mod go.sum ./vendor
63+
git diff --exit-code go.mod go.sum ./vendor # Compare to the PR / WF Branch.
6464

6565
.PHONY: doc
6666
doc:
@@ -72,7 +72,7 @@ fmt:
7272

7373
.PHONY: install-golangci-lint
7474
install-golangci-lint:
75-
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2
75+
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.1
7676

7777
# Lint with various GOOS and GOARCH targets to catch static analysis failures that may only affect
7878
# specific operating systems or architectures. For example, staticcheck will only check for 64-bit

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,18 @@
1010

1111
The MongoDB supported driver for Go.
1212

13+
> \[!NOTE\]
14+
>
15+
> Go Driver 1.17.0 is the last planned 1.x version.
16+
> It will receive critical bug fixes, but future development and features
17+
> will be in the 2.x version of the driver.
18+
1319
______________________________________________________________________
1420

1521
## Requirements
1622

1723
- 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.
24+
- Go 1.22 or higher is required to run the driver test suite.
1925
- MongoDB 3.6 and higher.
2026

2127
______________________________________________________________________

bson/bson_corpus_spec_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,14 @@ func unescapeUnicode(s, bsonType string) string {
187187

188188
func formatDouble(f float64) string {
189189
var s string
190-
if math.IsInf(f, 1) {
190+
switch {
191+
case math.IsInf(f, 1):
191192
s = "Infinity"
192-
} else if math.IsInf(f, -1) {
193+
case math.IsInf(f, -1):
193194
s = "-Infinity"
194-
} else if math.IsNaN(f) {
195+
case math.IsNaN(f):
195196
s = "NaN"
196-
} else {
197+
default:
197198
// Print exactly one decimalType place for integers; otherwise, print as many are necessary to
198199
// perfectly represent it.
199200
s = strconv.FormatFloat(f, 'G', -1, 64)

bson/bsoncodec/bsoncodec_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
)
1919

2020
func ExampleValueEncoder() {
21-
var _ ValueEncoderFunc = func(ec EncodeContext, vw bsonrw.ValueWriter, val reflect.Value) error {
21+
var _ ValueEncoderFunc = func(_ EncodeContext, vw bsonrw.ValueWriter, val reflect.Value) error {
2222
if val.Kind() != reflect.String {
2323
return ValueEncoderError{Name: "StringEncodeValue", Kinds: []reflect.Kind{reflect.String}, Received: val}
2424
}
@@ -28,7 +28,7 @@ func ExampleValueEncoder() {
2828
}
2929

3030
func ExampleValueDecoder() {
31-
var _ ValueDecoderFunc = func(dc DecodeContext, vr bsonrw.ValueReader, val reflect.Value) error {
31+
var _ ValueDecoderFunc = func(_ DecodeContext, vr bsonrw.ValueReader, val reflect.Value) error {
3232
if !val.CanSet() || val.Kind() != reflect.String {
3333
return ValueDecoderError{Name: "StringDecodeValue", Kinds: []reflect.Kind{reflect.String}, Received: val}
3434
}

bson/bsoncodec/default_value_encoders_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,7 @@ func TestDefaultValueEncoders(t *testing.T) {
11591159
},
11601160
{
11611161
"WriteArrayElement Error",
1162-
bsoncore.Array(buildDocumentArray(func(doc []byte) []byte {
1162+
bsoncore.Array(buildDocumentArray(func([]byte) []byte {
11631163
return bsoncore.AppendNullElement(nil, "foo")
11641164
})),
11651165
nil,
@@ -1169,7 +1169,7 @@ func TestDefaultValueEncoders(t *testing.T) {
11691169
},
11701170
{
11711171
"encodeValue error",
1172-
bsoncore.Array(buildDocumentArray(func(doc []byte) []byte {
1172+
bsoncore.Array(buildDocumentArray(func([]byte) []byte {
11731173
return bsoncore.AppendNullElement(nil, "foo")
11741174
})),
11751175
nil,

bson/bsoncodec/registry_examples_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func ExampleRegistry_customEncoder() {
2525
negatedIntType := reflect.TypeOf(negatedInt(0))
2626

2727
negatedIntEncoder := func(
28-
ec bsoncodec.EncodeContext,
28+
_ bsoncodec.EncodeContext,
2929
vw bsonrw.ValueWriter,
3030
val reflect.Value,
3131
) error {
@@ -83,7 +83,7 @@ func ExampleRegistry_customDecoder() {
8383
lenientBoolType := reflect.TypeOf(lenientBool(true))
8484

8585
lenientBoolDecoder := func(
86-
dc bsoncodec.DecodeContext,
86+
_ bsoncodec.DecodeContext,
8787
vr bsonrw.ValueReader,
8888
val reflect.Value,
8989
) error {
@@ -160,7 +160,7 @@ func ExampleRegistry_RegisterKindEncoder() {
160160
// encoder for kind reflect.Int32. That way, even user-defined types with
161161
// underlying type int32 will be encoded as a BSON int64.
162162
int32To64Encoder := func(
163-
ec bsoncodec.EncodeContext,
163+
_ bsoncodec.EncodeContext,
164164
vw bsonrw.ValueWriter,
165165
val reflect.Value,
166166
) error {
@@ -215,7 +215,7 @@ func ExampleRegistry_RegisterKindDecoder() {
215215
// "kind" decoder for kind reflect.Int64. That way, we can even decode to
216216
// user-defined types with underlying type int64.
217217
flexibleInt64KindDecoder := func(
218-
dc bsoncodec.DecodeContext,
218+
_ bsoncodec.DecodeContext,
219219
vr bsonrw.ValueReader,
220220
val reflect.Value,
221221
) error {

0 commit comments

Comments
 (0)