-
-
Notifications
You must be signed in to change notification settings - Fork 511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: generate Go examples for new modules #1600
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 Bugs No Coverage information |
@@ -0,0 +1,36 @@ | |||
{{ $entrypoint := Entrypoint }}{{ $lower := ToLower }}{{ $title := Title }}package {{ $lower }}_test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
RunContainer
function.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.go
file, and finally linking the code snippets in the docs to the new testable Examples code blocks