Dependencies
When you add a dependency to your module with dagger install
, the dependent module will be added to the code-generation routines and can be accessed from your own module's code.
The entrypoint to accessing dependent modules from your own module's code is dag
, the Dagger client, which is pre-initialized. It contains all the core types (like Container
, Directory
, etc.), as well as bindings to any dependencies your module has declared.
Here is an example:
dagger install github.com/shykes/daggerverse/helloWorld@26f8ed9f1748ec8c9345281add850fd392441990
This module can be accessed from your own module's code, as shown below:
- Go
- Python
- TypeScript
func (m *MyModule) HelloWorld(ctx context.Context) (string, error) {
return dag.HelloWorld().Message(ctx)
}
@function
async def hello_world(self) -> str:
return await dag.hello_world().message()
@func()
async helloWorld(): Promise<string> {
return await dag.helloWorld().message()
}