37 lines
714 B
Go
37 lines
714 B
Go
package goenv
|
||
|
||
import (
|
||
"fmt"
|
||
"os/exec"
|
||
|
||
"zlh-agent/internal/state"
|
||
)
|
||
|
||
/*
|
||
Verify validates that the Go dev container runtime is usable.
|
||
|
||
Responsibilities:
|
||
- Ensure `go` binary is present and executable
|
||
- Ensure GOPATH / GOMOD usage won’t immediately fail
|
||
|
||
IMPORTANT:
|
||
- No installation here
|
||
- No state mutation
|
||
- Safe to call multiple times
|
||
*/
|
||
func Verify(cfg state.Config) error {
|
||
|
||
// Check go binary
|
||
if _, err := exec.LookPath("go"); err != nil {
|
||
return fmt.Errorf("go binary not found in PATH")
|
||
}
|
||
|
||
// Optional sanity check: go env should run
|
||
cmd := exec.Command("go", "env")
|
||
if err := cmd.Run(); err != nil {
|
||
return fmt.Errorf("go env failed to execute")
|
||
}
|
||
|
||
return nil
|
||
}
|