zlh-agent/internal/provision/devcontainer/java/verify.go

36 lines
705 B
Go

package java
import (
"fmt"
"os/exec"
"zlh-agent/internal/state"
)
/*
Verify validates that the Java dev container runtime is usable.
Responsibilities:
- Ensure `java` binary is present and executable
- Ensure `javac` is present (development use case)
IMPORTANT:
- No installation here
- No state mutation
- Safe to call multiple times
*/
func Verify(cfg state.Config) error {
// Check java runtime
if _, err := exec.LookPath("java"); err != nil {
return fmt.Errorf("java binary not found in PATH")
}
// Check Java compiler (dev requirement)
if _, err := exec.LookPath("javac"); err != nil {
return fmt.Errorf("javac binary not found in PATH")
}
return nil
}