Skip to content

Commit 981c0f8

Browse files
author
Divjot Arora
committed
Use Go 1.15 in Evergreen (mongodb#492)
This commit also fixes errors from "go vet" and "gofmt". GODRIVER-1729 GODRIVER-1730
1 parent 5b5e6c9 commit 981c0f8

File tree

6 files changed

+48
-30
lines changed

6 files changed

+48
-30
lines changed

.evergreen/config.yml

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,14 @@ functions:
134134
working_dir: src/go.mongodb.org/mongo-driver
135135
script: |
136136
${PREPARE_SHELL}
137-
# any go tools that we need
137+
138+
# Install any go tools that we need. Do this in a temp directory because running "go get" inside the driver
139+
# repo will update the driver's go.mod/go.sum files. This puts the contents of go.mod/go.sum out of sync with
140+
# the vendor directory and tests fail to compile due to inconsistent vendoring.
141+
cd $(mktemp -d)
138142
go get -u golang.org/x/lint/golint
139143
go get -u github.com/kisielk/errcheck
144+
cd -
140145
141146
# initialize submodules
142147
git submodule init
@@ -1526,61 +1531,61 @@ axes:
15261531
- id: os-ssl-legacy
15271532
display_name: OS
15281533
values:
1529-
- id: "ubuntu1404-go-1-13"
1534+
- id: "ubuntu1404-go-1-15"
15301535
display_name: "Ubuntu 14.04"
15311536
run_on: ubuntu1404-test
15321537
variables:
1533-
GO_DIST: "/opt/golang/go1.13"
1538+
GO_DIST: "/opt/golang/go1.15"
15341539

15351540
# OSes that require >= 3.2 for SSL
15361541
- id: os-ssl-32
15371542
display_name: OS
15381543
values:
1539-
- id: "windows-64-go-1-13"
1544+
- id: "windows-64-go-1-15"
15401545
display_name: "Windows 64-bit"
15411546
run_on:
15421547
- windows-64-vs2017-test
15431548
variables:
15441549
GCC_PATH: "/cygdrive/c/mingw-w64/x86_64-4.9.1-posix-seh-rt_v3-rev1/mingw64/bin"
1545-
GO_DIST: "C:\\golang\\go1.13"
1550+
GO_DIST: "C:\\golang\\go1.15"
15461551
PYTHON3_BINARY: "C:/python/Python38/python.exe"
15471552
VENV_BIN_DIR: "Scripts"
1548-
- id: "ubuntu1604-64-go-1-13"
1553+
- id: "ubuntu1604-64-go-1-15"
15491554
display_name: "Ubuntu 16.04"
15501555
run_on: ubuntu1604-build
15511556
variables:
1552-
GO_DIST: "/opt/golang/go1.13"
1557+
GO_DIST: "/opt/golang/go1.15"
15531558
PYTHON3_BINARY: "/opt/python/3.8/bin/python3"
1554-
- id: "osx-go-1-13"
1559+
- id: "osx-go-1-15"
15551560
display_name: "MacOS 10.14"
15561561
run_on: macos-1014
15571562
variables:
1558-
GO_DIST: "/opt/golang/go1.13"
1563+
GO_DIST: "/opt/golang/go1.15"
15591564
PYTHON3_BINARY: python3
15601565

15611566
- id: os-aws-auth
15621567
display_name: OS
15631568
values:
1564-
- id: "windows-64-vsMulti-small-go-1-13"
1569+
- id: "windows-64-vsMulti-small-go-1-15"
15651570
display_name: "Windows 64-bit"
15661571
run_on:
15671572
- windows-64-vsMulti-small
15681573
variables:
15691574
GCC_PATH: "/cygdrive/c/mingw-w64/x86_64-4.9.1-posix-seh-rt_v3-rev1/mingw64/bin"
1570-
GO_DIST: "C:\\golang\\go1.13"
1575+
GO_DIST: "C:\\golang\\go1.15"
15711576
SKIP_ECS_AUTH_TEST: true
15721577
PYTHON3: "C:/python/Python38/python.exe"
1573-
- id: "ubuntu1804-64-go-1-13"
1578+
- id: "ubuntu1804-64-go-1-15"
15741579
display_name: "Ubuntu 18.04"
15751580
run_on: ubuntu1804-test
15761581
variables:
1577-
GO_DIST: "/opt/golang/go1.13"
1582+
GO_DIST: "/opt/golang/go1.15"
15781583
PYTHON3: python3
1579-
- id: "osx-go-1-13"
1584+
- id: "osx-go-1-15"
15801585
display_name: "MacOS 10.14"
15811586
run_on: macos-1014
15821587
variables:
1583-
GO_DIST: "/opt/golang/go1.13"
1588+
GO_DIST: "/opt/golang/go1.15"
15841589
SKIP_ECS_AUTH_TEST: true
15851590
SKIP_EC2_AUTH_TEST: true
15861591
PYTHON3: python3
@@ -1591,7 +1596,7 @@ buildvariants:
15911596
run_on:
15921597
- ubuntu1604-build
15931598
expansions:
1594-
GO_DIST: "/opt/golang/go1.13"
1599+
GO_DIST: "/opt/golang/go1.15"
15951600
tasks:
15961601
- name: ".static-analysis"
15971602

@@ -1600,7 +1605,7 @@ buildvariants:
16001605
run_on:
16011606
- ubuntu1604-build
16021607
expansions:
1603-
GO_DIST: "/opt/golang/go1.13"
1608+
GO_DIST: "/opt/golang/go1.15"
16041609
tasks:
16051610
- name: ".performance"
16061611

@@ -1609,7 +1614,7 @@ buildvariants:
16091614
run_on:
16101615
- ubuntu1604-test
16111616
expansions:
1612-
GO_DIST: "/opt/golang/go1.13"
1617+
GO_DIST: "/opt/golang/go1.15"
16131618
tasks:
16141619
- name: ".compile-check"
16151620

@@ -1618,7 +1623,7 @@ buildvariants:
16181623
run_on:
16191624
- ubuntu1604-build
16201625
expansions:
1621-
GO_DIST: "/opt/golang/go1.13"
1626+
GO_DIST: "/opt/golang/go1.15"
16221627
tasks:
16231628
- name: "atlas-test"
16241629

@@ -1672,22 +1677,22 @@ buildvariants:
16721677
- name: "aws-auth-test"
16731678

16741679
- matrix_name: "ocsp-test"
1675-
matrix_spec: { version: ["4.4", "latest"], os-ssl-32: ["ubuntu1604-64-go-1-13"] }
1680+
matrix_spec: { version: ["4.4", "latest"], os-ssl-32: ["ubuntu1604-64-go-1-15"] }
16761681
display_name: "OCSP ${version} ${os-ssl-32}"
16771682
batchtime: 20160 # 14 days
16781683
tasks:
16791684
- name: ".ocsp"
16801685

16811686
- matrix_name: "ocsp-test-windows"
1682-
matrix_spec: { version: ["4.4", "latest"], os-ssl-32: ["windows-64-go-1-13"] }
1687+
matrix_spec: { version: ["4.4", "latest"], os-ssl-32: ["windows-64-go-1-15"] }
16831688
display_name: "OCSP ${version} ${os-ssl-32}"
16841689
batchtime: 20160 # 14 days
16851690
tasks:
16861691
# Windows MongoDB servers do not staple OCSP responses and only support RSA.
16871692
- name: ".ocsp-rsa !.ocsp-staple"
16881693

16891694
- matrix_name: "ocsp-test-macos"
1690-
matrix_spec: { version: ["4.4", "latest"], os-ssl-32: ["osx-go-1-13"] }
1695+
matrix_spec: { version: ["4.4", "latest"], os-ssl-32: ["osx-go-1-15"] }
16911696
display_name: "OCSP ${version} ${os-ssl-32}"
16921697
batchtime: 20160 # 14 days
16931698
tasks:

bson/bson_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ func noerr(t *testing.T, err error) {
3030
}
3131
}
3232

33-
func requireErrEqual(t *testing.T, err1 error, err2 error) { require.True(t, compareErrors(err1, err2)) }
33+
func requireErrEqual(t *testing.T, err1 error, err2 error) {
34+
require.True(t, compareErrors(err1, err2))
35+
}
3436

3537
func TestTimeRoundTrip(t *testing.T) {
3638
val := struct {

bson/raw_value.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ func (rv RawValue) UnmarshalWithContext(dc *bsoncodec.DecodeContext, val interfa
104104
}
105105

106106
func convertFromCoreValue(v bsoncore.Value) RawValue { return RawValue{Type: v.Type, Value: v.Data} }
107-
func convertToCoreValue(v RawValue) bsoncore.Value { return bsoncore.Value{Type: v.Type, Data: v.Value} }
107+
func convertToCoreValue(v RawValue) bsoncore.Value {
108+
return bsoncore.Value{Type: v.Type, Data: v.Value}
109+
}
108110

109111
// Validate ensures the value is a valid BSON value.
110112
func (rv RawValue) Validate() error { return convertToCoreValue(rv).Validate() }
@@ -176,7 +178,9 @@ func (rv RawValue) ObjectID() primitive.ObjectID { return convertToCoreValue(rv)
176178

177179
// ObjectIDOK is the same as ObjectID, except it returns a boolean instead of
178180
// panicking.
179-
func (rv RawValue) ObjectIDOK() (primitive.ObjectID, bool) { return convertToCoreValue(rv).ObjectIDOK() }
181+
func (rv RawValue) ObjectIDOK() (primitive.ObjectID, bool) {
182+
return convertToCoreValue(rv).ObjectIDOK()
183+
}
180184

181185
// Boolean returns the boolean value the Value represents. It panics if the
182186
// value is a BSON type other than boolean.
@@ -214,7 +218,9 @@ func (rv RawValue) RegexOK() (pattern, options string, ok bool) {
214218

215219
// DBPointer returns the BSON dbpointer value the Value represents. It panics if the value is a BSON
216220
// type other than DBPointer.
217-
func (rv RawValue) DBPointer() (string, primitive.ObjectID) { return convertToCoreValue(rv).DBPointer() }
221+
func (rv RawValue) DBPointer() (string, primitive.ObjectID) {
222+
return convertToCoreValue(rv).DBPointer()
223+
}
218224

219225
// DBPointerOK is the same as DBPoitner, except that it returns a boolean
220226
// instead of panicking.

mongo/mongo_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func TestMongoHelpers(t *testing.T) {
116116
got, id, err := transformAndEnsureID(bson.DefaultRegistry, doc)
117117
assert.Nil(t, err, "transformAndEnsureID error: %v", err)
118118
_, ok := id.(string)
119-
assert.True(t, ok, "expected returned id type %T, got %T", string(0), id)
119+
assert.True(t, ok, "expected returned id type string, got %T", id)
120120
assert.Equal(t, got, want, "expected document %v, got %v", got, want)
121121
})
122122
})

x/bsonx/bsoncore/bsoncore.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,14 @@ import (
3939
// EmptyDocumentLength is the length of a document that has been started/ended but has no elements.
4040
const EmptyDocumentLength = 5
4141

42+
// nullTerminator is a string version of the 0 byte that is appended at the end of cstrings.
43+
const nullTerminator = string(byte(0))
44+
4245
// AppendType will append t to dst and return the extended buffer.
4346
func AppendType(dst []byte, t bsontype.Type) []byte { return append(dst, byte(t)) }
4447

4548
// AppendKey will append key to dst and return the extended buffer.
46-
func AppendKey(dst []byte, key string) []byte { return append(dst, key+string(0x00)...) }
49+
func AppendKey(dst []byte, key string) []byte { return append(dst, key+nullTerminator...) }
4750

4851
// AppendHeader will append Type t and key to dst and return the extended
4952
// buffer.
@@ -427,7 +430,7 @@ func AppendNullElement(dst []byte, key string) []byte { return AppendHeader(dst,
427430

428431
// AppendRegex will append pattern and options to dst and return the extended buffer.
429432
func AppendRegex(dst []byte, pattern, options string) []byte {
430-
return append(dst, pattern+string(0x00)+options+string(0x00)...)
433+
return append(dst, pattern+nullTerminator+options+nullTerminator...)
431434
}
432435

433436
// AppendRegexElement will append a BSON regex element using key, pattern, and

x/mongo/driver/wiremessage/wiremessage.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,9 @@ func ReadCompressedOriginalOpCode(src []byte) (opcode OpCode, rem []byte, ok boo
490490

491491
// ReadCompressedUncompressedSize reads the uncompressed size of a
492492
// compressed wiremessage to dst.
493-
func ReadCompressedUncompressedSize(src []byte) (size int32, rem []byte, ok bool) { return readi32(src) }
493+
func ReadCompressedUncompressedSize(src []byte) (size int32, rem []byte, ok bool) {
494+
return readi32(src)
495+
}
494496

495497
// ReadCompressedCompressorID reads the ID of the compressor to dst.
496498
func ReadCompressedCompressorID(src []byte) (id CompressorID, rem []byte, ok bool) {

0 commit comments

Comments
 (0)