#ahhh yes, this is tricky ๐ i've tended
1 messages ยท Page 1 of 1 (latest)
I am not sure I understand, are you recommending to put everything in a single module (GoLang App + dagger code) ?
oh i see! no i'd keep those separate
I think the initial mental model I had was the following:
- One module with multiple packages for the app
- One module for Dagger automation
by default, we have a ./dagger directory at the top-level - but other options exist, you can put your dagger code wherever you like
now the problem is, what if the module for Dagger automation needs features that are in the app (i.e. configuration of containers to be used for testing?)
aha, we do this ๐ it's a pain, sorry
so, you can have a dependency - but it can only be a one-way direction. i'd recommend having your dagger module depend on your app instead of the other way round if you can
Yes, makes sense. Though I believe that it can't depend on anything that is _test in GoLang
yup, i think that's right
that's why I have a problem
so now I either move the helper code from the test package into the main package, or I create a separate module for common code that I needs both in Dagger and in my app
we have this for consts - our solution is just to split out the consts into a separate file/package, and then it's very easy to do the dep
Can you share a link maybe?
yeah sure:
- our top-level https://github.com/dagger/dagger/blob/main/go.mod
- our internal package (that has dagger code) https://github.com/dagger/dagger/blob/main/internal/mage/go.mod
so here there are only two packages, the dagger code and the app. Do you have an example of three packages? app code, common utilities, dagger code?
hm, so for those common utilities, we just have a common package in the top-level module
we have 2 modules, but each module has multiple packages
Oh i see. You have a top level module, the dagger code that depends on the top level module, and then you have another module that depends on the top level module?
we just have two modules - a module is defined by the go.mod, while a package is just any old directory
so i think internal/distconsts is the shared package between them
but that package is part of the top-level module
got it, thanks