Problem
The compiler automatically adds a "Setup Go" step when it detects Go commands (e.g., go version in custom steps or Serena Go language service), but this step fails if the repository doesn't have a go.mod file.
Root Cause
In pkg/workflow/runtime_setup.go:
Go runtime definition (lines 77-84):
{
ID: "go",
Name: "Go",
ActionRepo: "actions/setup-go",
ActionVersion: "v5",
VersionField: "go-version",
DefaultVersion: "", // Special handling: uses go.modCommands: []string{"go"},
}Setup step generation (lines 575-583):
ifruntime.ID=="go"&& (version==""||req.GoModFile!="") {
step=append(step, " with:")
goModPath:="go.mod"// ⚠️ Assumes go.mod existsifreq.GoModFile!="" {
goModPath=req.GoModFile
}
step=append(step, fmt.Sprintf(" go-version-file: %s", goModPath))
step=append(step, " cache: true")
// ...
}
Result: The generated workflow uses go-version-file: go.mod, which fails if the file doesn't exist:
Error: The specified go version file at: go.mod does not exist
Steps to Reproduce
- Create a workflow that uses Claude with Serena Go language service or has a custom step with
go version - Run it in a repository without a
go.mod file - The workflow fails during the "Setup Go" step
Proposed Fix
Add a default Go version and use it as a fallback:
Add to pkg/constants/constants.go:
// DefaultGoVersion is the default version of Go for runtime setupconstDefaultGoVersionVersion="1.23"
Update pkg/workflow/runtime_setup.go:82:
DefaultVersion: string(constants.DefaultGoVersion),
Update logic at runtime_setup.go:575 to only use go-version-file when explicitly specified:
ifruntime.ID=="go"&&req.GoModFile!="" {
// Only use go-version-file if explicitly specifiedstep=append(step, " with:")
step=append(step, fmt.Sprintf(" go-version-file: %s", req.GoModFile))
step=append(step, " cache: true")
} elseifversion!="" {
// Use explicit versionstep=append(step, " with:")
step=append(step, fmt.Sprintf(" go-version: '%s'", version))
}
This way:
- Repos with
go.mod can explicitly specify go-mod-file in frontmatter - Repos without
go.mod will use the default Go version - Users can still override with explicit version in frontmatter
Related Code
- Detection:
pkg/workflow/compiler_yaml.go:246 calls DetectRuntimeRequirements() - Generation:
pkg/workflow/compiler_yaml.go:263 calls GenerateRuntimeSetupSteps() - Runtime setup:
pkg/workflow/runtime_setup.go:169-224 (detection) and pkg/workflow/runtime_setup.go:443-453 (generation)
Problem
The compiler automatically adds a "Setup Go" step when it detects Go commands (e.g.,
go versionin custom steps or Serena Go language service), but this step fails if the repository doesn't have ago.modfile.Root Cause
In
pkg/workflow/runtime_setup.go:Go runtime definition (lines 77-84):
{ ID: "go", Name: "Go", ActionRepo: "actions/setup-go", ActionVersion: "v5", VersionField: "go-version", DefaultVersion: "", // Special handling: uses go.modCommands: []string{"go"}, }Setup step generation (lines 575-583):
Result: The generated workflow uses
go-version-file: go.mod, which fails if the file doesn't exist:Steps to Reproduce
go versiongo.modfileProposed Fix
Add a default Go version and use it as a fallback:
Add to
pkg/constants/constants.go:Update
pkg/workflow/runtime_setup.go:82:Update logic at
runtime_setup.go:575to only usego-version-filewhen explicitly specified:This way:
go.modcan explicitly specifygo-mod-filein frontmattergo.modwill use the default Go versionRelated Code
pkg/workflow/compiler_yaml.go:246callsDetectRuntimeRequirements()pkg/workflow/compiler_yaml.go:263callsGenerateRuntimeSetupSteps()pkg/workflow/runtime_setup.go:169-224(detection) andpkg/workflow/runtime_setup.go:443-453(generation)