Build a Dagger module in Go that exposes a function accepting a directory, runs linting and tests as parallel pipeline steps, and caches dependency layers between runs
domain: dagger.io · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
Initialize a new Dagger module with 'dagger init --sdk=go' and open the generated dagger.go file to define your module struct and functions
Define a function that accepts a *dagger.Directory parameter for the source code; inside, create a base container with the language runtime and mount the directory
Use the container's WithMountedCache method to cache the dependency download directory (e.g., Go module cache or node_modules) using a cache volume keyed by a stable name
Spawn lint and test steps as separate Container chains and return them together so the Dagger engine can execute them in parallel
Invoke the function locally with 'dagger call <function-name> --src=.' and verify both lint and test outputs appear in the terminal
Known gotchas
Cache volumes are keyed by name globally within a Dagger Engine instance; reusing the same cache volume name across unrelated modules shares the cache, which can cause corruption
Parallel execution only occurs when multiple Container values are returned or consumed without an intermediate Sync/Stdout call that forces serial evaluation
Dagger module functions must be exported (uppercase) and use only supported parameter types; unexported functions or unsupported types are silently excluded from the generated API
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp