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

  1. Initialize a new Dagger module with 'dagger init --sdk=go' and open the generated dagger.go file to define your module struct and functions
  2. 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
  3. 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
  4. Spawn lint and test steps as separate Container chains and return them together so the Dagger engine can execute them in parallel
  5. Invoke the function locally with 'dagger call <function-name> --src=.' and verify both lint and test outputs appear in the terminal

Known gotchas

Related routes

Build and run a Dagger pipeline in Go that containerizes an application, runs tests in isolation, and pushes to a registry only if tests pass, using Dagger's native caching
Dagger · 6 steps · unrated
Use Dagger to define a portable CI pipeline in Go that builds, tests, and pushes a container image using the Dagger Go SDK with module composition
dagger.io · 5 steps · unrated
Use dagger call to chain Dagger module functions across multiple modules using module dependencies declared in dagger.json
dagger.io · 5 steps · unrated

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