47 lines
913 B
Go
47 lines
913 B
Go
package goenv
|
|
|
|
import (
|
|
"fmt"
|
|
"path/filepath"
|
|
|
|
"zlh-agent/internal/provision"
|
|
"zlh-agent/internal/provision/devcontainer"
|
|
"zlh-agent/internal/state"
|
|
)
|
|
|
|
/*
|
|
Install installs the Go dev container runtime.
|
|
|
|
Execution model:
|
|
- Uses local, versioned install scripts from the agent repo
|
|
- Scripts handle downloading and installing Go
|
|
|
|
IMPORTANT:
|
|
- This function ONLY installs
|
|
- No verification here
|
|
*/
|
|
func Install(cfg state.Config) error {
|
|
|
|
// Idempotency guard
|
|
if devcontainer.IsProvisioned() {
|
|
return nil
|
|
}
|
|
|
|
scriptPath := filepath.Join(
|
|
provision.ScriptsRoot,
|
|
"devcontainer",
|
|
"go",
|
|
"install.sh",
|
|
)
|
|
|
|
if err := provision.RunScript(scriptPath); err != nil {
|
|
return fmt.Errorf("go devcontainer install failed: %w", err)
|
|
}
|
|
|
|
if err := devcontainer.WriteReadyMarker("go"); err != nil {
|
|
return fmt.Errorf("failed to write devcontainer ready marker: %w", err)
|
|
}
|
|
|
|
return nil
|
|
}
|