chore: generate Go examples for new modules#1600
chore: generate Go examples for new modules#1600mdelapenya merged 3 commits intotestcontainers:mainfrom
Conversation
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
|
Kudos, SonarCloud Quality Gate passed!
|
| @@ -0,0 +1,36 @@ | |||
| {{ $entrypoint := Entrypoint }}{{ $lower := ToLower }}{{ $title := Title }}package {{ $lower }}_test | |||
There was a problem hiding this comment.
The examples will live in the _test package so that the module has to be imported. See https://github.com/testcontainers/testcontainers-go/pull/1600/files#diff-1d36cae7dca15635127b16fa205b958f9700c573e57d9fd494fb6652e770b689R7 and https://github.com/testcontainers/testcontainers-go/pull/1600/files#diff-1d36cae7dca15635127b16fa205b958f9700c573e57d9fd494fb6652e770b689R14
|
Merging, as the generator tests passed |
* chore: rename templates to module * chore: support generating Go Examples * fix: test
|
For some reason the merge happened but the PR was kept open 🤷 |
* main: chore: always generate the examples including a explicit image (testcontainers#1611) chore: support linting all modules locally (testcontainers#1609) ci(sonarcloud): run only when not root-less (testcontainers#1608) remove extra equal in sonar.organization (testcontainers#1607) chore(ci): enable code coverage on Sonarcloud (testcontainers#1518) docs: use Go testable examples in modules (testcontainers#1603) ci(lint): enable errorlint linter (testcontainers#1604) ci(lint): enable gocritic linter (testcontainers#1605) chore(deps): bump github.com/hashicorp/vault-client-go in /modules/vault (testcontainers#1566) ci(security): setup codeql scan (testcontainers#1606) chore(deps): bump github.com/cyphar/filepath-securejoin (testcontainers#1601) chore: generate Go examples for new modules (testcontainers#1600) chore: generate Go examples for new modules (testcontainers#1600)
What does this PR do?
This PR adds a new Go template for including a dedicated Go file for Go examples. This examples file will include just an example on how to run the module, with the
RunContainerfunction.We have updated the tests, modifying the docs template to embed the code snippet to run a container from the examples, instead of from the test code.
Why is it important?
It will open the gate to add executable code snippets as Go examples:
Related issues
Follow-ups
Visit all modules and example modules, adding an
examples_test.gofile, and finally linking the code snippets in the docs to the new testable Examples code blocks