-
-
Notifications
You must be signed in to change notification settings - Fork 523
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
modulegen: generate md file inside internal/mkdocs #1543
modulegen: generate md file inside internal/mkdocs #1543
Conversation
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Mmm it's interesting but I think we broke the generator for examples:
It wasn't in this PR but I'm currently bisecting where the example generator was broken. |
So it seems I broke it back in April, in #1059. Will debug it and send a fix |
I get it ! The |
Could you do a local verification, and generate an example or a module, and from the root for, run |
Hi @mdelapenya , I'll revert the last commit once you saw it ;) |
docs/examples/questdb.md
Outdated
## Module reference | ||
|
||
The QuestDB module exposes one entrypoint function to create the QuestDB container, and this function receives two parameters: | ||
|
||
```golang | ||
func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*QuestDBContainer, error) | ||
``` |
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.
@mdelapenya ,
This part of documentation seems to be erronous. Shall modules and example both have an entrypoint with RunContainer
then ?
In that case it would be possible produce example_test.go with example_test package instead of example package.
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.
I have a plan to generate an example_test.go
file in every module, in which we only add Go examples code, which will be rendered in the markdown files (please see the Artemis module). An example module will not have real API, only examples.
Since we are not there yet, the example must have a private function. We could even make it simpler and name that function runContainer
so we just have to lowercase the initial upper char.
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.
I see !
If the test is compliant for you I'll keep the test/template instead of the html/template. |
Signed-off-by: Matthieu MOREL <[email protected]>
Kudos, SonarCloud Quality Gate passed!
|
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.
LGTM, thanks!
* main: modulegen: generate md file inside internal/mkdocs (testcontainers#1543) modulegen: create internal/module and internal/modfile (testcontainers#1539)
* main: modulegen: generate md file inside internal/mkdocs (testcontainers#1543)
* main: (32 commits) fix: remove wrong example from workspace (testcontainers#1556) chore(deps): bump the all group in /modules/localstack with 1 update (testcontainers#1552) modulegen: generate code-workspace with json marshal (testcontainers#1551) chore(deps): bump the all group in /modules/compose with 2 updates (testcontainers#1553) feat: add mariadb module (testcontainers#1548) feat(modulegen): print out VSCode workspace file if needed (testcontainers#1549) modulegen: generate md file inside internal/mkdocs (testcontainers#1543) modulegen: create internal/module and internal/modfile (testcontainers#1539) [Enhancement]: add ability to set repo:tag for ContainerRequest FromDockerfile (testcontainers#1508) Fix module generator for examples (testcontainers#1545) Update pulsar.md (testcontainers#1542) modulegen: create internal/make (testcontainers#1537) chore: fix workflow (testcontainers#1538) chore(deps): bump the all group in /examples/cockroachdb with 1 update (testcontainers#1522) chore(deps): bump the all group in /examples/bigtable with 1 update (testcontainers#1534) chore(deps): bump the all group in /modules/localstack with 4 updates (testcontainers#1535) chore(deps): bump the all group in /modules/k3s with 2 updates (testcontainers#1526) chore(deps): bump the all group in /examples/spanner with 2 updates (testcontainers#1532) chore(deps): bump the all group in /examples/firestore with 1 update (testcontainers#1523) chore(deps): bump the all group in /modules/redis with 1 update (testcontainers#1524) ...
What does this PR do?
This removes codeinclude function and use text/template instead of html/template.
It also moves the logic of markdown example file creation to the internal/mkdocs package.
Why is it important?
This is separating code in there domain to improve the readability and maintanability.
Related issues
Follow-ups
Remove Example functions and replace them with fields so they are calculated once.