-
-
Notifications
You must be signed in to change notification settings - Fork 503
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
feat: support for go.work #2849
base: main
Are you sure you want to change the base?
Conversation
See context package
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
* main: chore: use require.(No)Error(t,err) instead of t.Fatal(err) (testcontainers#2851)
@@ -14,7 +14,5 @@ TEST-*.xml | |||
|
|||
tcvenv | |||
|
|||
**/go.work |
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.
question: do we want it committed or part of a setup process? Typically its not standard to add this, but I wonder if this is a good example for it?
return Write(rootGoWorkFilePath, rootGoWork) | ||
} | ||
|
||
func newWorkFile(goWork *modfile.WorkFile, examples []string, modules []string) 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.
question: is the intent to exclude other modules like test, and wait? If not using a find for go.mod
might be simpler.
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.
but wait is a package, not a module, right?
* main: chore: use require.Len instead of assert.Len (testcontainers#2854) chore: bump ryuk to 0.11.0 (testcontainers#2853) chore: enable usestdlibvars linter (testcontainers#2850) fix(compose): container initialisation (testcontainers#2844) fix!: data races (testcontainers#2843) fix: mongodb replicaset should work with auth (testcontainers#2847)
This reverts commit e4b8d22.
* main: chore: use require instead of t.Fatal (testcontainers#2855)
@mmorel-35 pinging you for a review (if possible), as you worked in the modulegen a lot 🙏 |
What does this PR do?
This PR adds support for creating a go.work file and managing it when new modules are created using the
modulegen
tool.During this process, we had to rework a bit this code generation tool, using the
modfile
package to handle the workfile programatically.Besides that, we updated the existing tests to check the work files are properly generated, also moving tests to the right package and even
removing duplicated tests (e.g. for validation).
Finally, we are improving the error messages, following recent patterns we are adopting in the library.
Important to notice the amount of lines in the changeset comes from running
go work sync
, which updated all the dependencies.Why is it important?
Now the go toolchain will be able to handle the core module and its submodules in a proper manner, so it would be much easier to setup the IDE when working on the project.
In the past, we generated code for VSCode and handle all the submodules, now it would be possible to just open the root dir, and because of the existence of the
go.work
file,the IDE would be able to follow all links across the entire code base.
Related issues