[GODRIVER-2010] Clean up documentation examples Created: 14/May/21 Updated: 20/Apr/22 Resolved: 20/Apr/22 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | Documentation |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Trivial - P5 |
| Reporter: | Benji Rewis (Inactive) | Assignee: | Benji Rewis (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Documentation Changes: | Not Needed |
| Description |
|
documentation_examples/examples.go is getting pretty large (~2700 LoC). Depending on how the Docs team references these examples, we could split the file into smaller files within the same directory. This might make these examples more accessible to users. Furthermore, we should make sure that all examples are actually being run through example_test.go. RunTransactionWithRetry(), CommitWithRetry(), and WithTransactionExample() are not actually tested. Finally add a README or at least document that these examples are pulled in automatically by the Docs team. Also, try to adhere to the new document on Go driver example code (e.g. use context.TODO() everywhere. |
| Comments |
| Comment by Benji Rewis (Inactive) [ 20/Apr/22 ] |
|
Added a README to examples/documentation_examples explaining the purpose of examples.go and examples_test.go. Replaced context.Background() with context.TODO() in actual example code. Actually ran WithTransactionExample. Used mtest.ClusterURI() instead of hard-coding URIs. Reorganized examples_test.go to use mtest for server version/topology logic. Added links to examples pointing to where they appear/will appear on www.mongodb.com/docs. |
| Comment by Githook User [ 20/Apr/22 ] |
|
Author: {'name': 'Benjamin Rewis', 'email': '32186188+benjirewis@users.noreply.github.com', 'username': 'benjirewis'}Message: |
| Comment by Benji Rewis (Inactive) [ 19/Apr/22 ] |