You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's pretend I've created a generic reusable module, golang - it can build, test, lint, generate docs, etc, everything I want a module to do.
I want to install this module as a dependency to my project. Because golang is a good module, it even supports setting the version in the constructor.
But there's an issue with this - if I want to call golang at multiple points in my module, and I need to pin the version everywhere, today I have a few options:
Specify the version everywhere I construct golang. This is kinda sad, and ends up with lots of duplicates.
Call the constructor once, and then store the result. This is also kinda sad, since now I need to pass the object everywhere in my own module (which gets worse the more such objects from other modules I might have)
Write a wrapper function that wraps the constructor, and just call that everywhere (this feels like the best option with what we have right now)
However, some future options include:
Have dependency "opts" in dagger.json - then automagically feed these defaults to the constructor (similar to A config file for my modules #6323)
Not quite sure which is best, though I'm leaning towards adding more functionality to dagger.json for this. For one, it feels annoying to have to write my own wrappers everywhere, and makes it hard to update these values. Syntax like dagger install github.com/.../golang --version=v1.23 would be pretty neat.
Whatever option we pick, we need to have this based on the caller - not the dependency module. I might/might not have control over the default in the dependency golang module, and so might not be able to easily bump the version.
Activity