Skip to content

Select Go container version from go.mod #18

@dagger-codex

Description

@dagger-codex

Problem

The Go module currently selects a Go container version from the top-level Go configuration, defaulting to 1.26 unless the caller passes version or base.

That makes all discovered modules use the same golang:<version>-alpine base. It is easy for this to drift from the go directive in a module's go.mod; for example, the e2e harness can use an older Go image while helpers/go-includes/go.mod requires a newer Go version.

Proposal

Automatically select the Go container image version from each module's go.mod when the caller has not explicitly configured a version or custom base.

Design questions to settle:

  • Whether to use the go directive only, or also honor toolchain when present.
  • How to map patch-level directives like go 1.26.1 to available golang image tags.
  • How explicit version should interact with per-module auto-selection.
  • How custom base should disable or bypass version selection.

Acceptance criteria

  • A module with go.mod declaring a newer Go version runs helper/test/generate containers with a compatible Go image by default.
  • Workspaces with mixed module Go versions can run lintAll, testAll, and generateAll without one global version forcing every module.
  • Explicit version remains a predictable override.
  • Custom base behavior remains unchanged and does not infer version.
  • E2e coverage includes at least one module whose go.mod requires a different Go version than the default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions