You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Go 1.13 or higher. We aim to support the latest versions of Go.
17
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.
18
19
- Go 1.20 or higher is required to run the driver test suite.
Check out the [project page](https://jira.mongodb.org/browse/GODRIVER) for tickets that need completing. See our [contribution guidelines](docs/CONTRIBUTING.md) for details.
Copy file name to clipboardExpand all lines: docs/CONTRIBUTING.md
+24-4Lines changed: 24 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,7 @@ The Go Driver team uses GitHub to manage and review all code changes. Patches sh
18
18
applicable.
19
19
20
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:
21
+
21
22
-`make fmt`
22
23
-`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`)
23
24
-`make test`
@@ -29,6 +30,23 @@ If any tests do not pass, or relevant tests are not included, the patch will not
29
30
30
31
If you are working on a bug or feature listed in Jira, please include the ticket number prefixed with GODRIVER in the commit message and GitHub pull request title, (e.g. GODRIVER-123). For the patch commit message itself, please follow the [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/) guide.
31
32
33
+
### Linting on commit
34
+
35
+
The Go team uses [pre-commit](https://pre-commit.com/#installation) to lint both source and text files.
36
+
37
+
To install locally, run:
38
+
39
+
```bash
40
+
brew install pre-commit
41
+
pre-commit install
42
+
```
43
+
44
+
After that, the checks will run on any changed files when committing. To manually run the checks on all files, run:
45
+
46
+
```bash
47
+
pre-commit run --all-files
48
+
```
49
+
32
50
### Cherry-picking between branches
33
51
34
52
You must first install the `gh` cli (`brew install gh`), then set your GitHub username:
@@ -77,6 +95,7 @@ mongod \
77
95
```
78
96
79
97
To run the tests with `make`, set:
98
+
80
99
-`MONGO_GO_DRIVER_CA_FILE` to the location of the CA file used by the database
81
100
-`MONGO_GO_DRIVER_KEY_FILE` to the location of the client key file
82
101
-`MONGO_GO_DRIVER_PKCS8_ENCRYPTED_KEY_FILE` to the location of the pkcs8 client key file encrypted with the password string: `password`
@@ -98,6 +117,7 @@ make
98
117
```
99
118
100
119
Notes:
120
+
101
121
- The `--tlsAllowInvalidCertificates` flag is required on the server for the test suite to work correctly.
102
122
- The test suite requires the auth database to be set with `?authSource=admin`, not `/admin`.
103
123
@@ -120,7 +140,7 @@ The requirements for testing FaaS implementations in the Go Driver vary dependin
120
140
The following are the requirements for running the AWS Lambda tests locally:
121
141
122
142
1.[AWS SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html)
Local testing requires exporting the `MONGODB_URI` environment variables. To build the AWS Lambda image and invoke the `MongoDBFunction` lambda function use the `build-faas-awslambda` make target:
126
146
@@ -134,15 +154,15 @@ There is currently no arm64 support for the go1.x runtime, see [here](https://do
134
154
135
155
### Testing in Docker
136
156
137
-
We support local testing in Docker. Ensure ``docker`` is installed and running, and then run:
157
+
We support local testing in Docker. Ensure `docker` is installed and running, and then run:
138
158
139
159
```bash
140
160
bash etc/run_docker.sh
141
161
```
142
162
143
-
The script takes an optional argument for the ``MAKEFILE_TARGET`` and allows for some environment variable overrides.
163
+
The script takes an optional argument for the `MAKEFILE_TARGET` and allows for some environment variable overrides.
144
164
The docker container has the required binaries, including libmongocrypt.
145
-
The entry script starts a MongoDB topology, and then executes the desired ``MAKEFILE_TARGET``.
165
+
The entry script starts a MongoDB topology, and then executes the desired `MAKEFILE_TARGET`.
146
166
147
167
For example, to test against a sharded cluster, using enterprise auth, run:
0 commit comments