Skip to main content

GoBuildEnv

Trait GoBuildEnv 

Source
pub trait GoBuildEnv {
    // Required methods
    fn go_list(
        &self,
        root: &Path,
        tuple: &TargetTuple,
    ) -> Result<String, GomodError>;
    fn read_file(&self, path: &Path) -> Result<Vec<u8>, GomodError>;
}
Expand description

The Environment seam — the ONLY place the encoder touches the world. Real builds shell go list + read files; tests mock both.

Required Methods§

Source

fn go_list( &self, root: &Path, tuple: &TargetTuple, ) -> Result<String, GomodError>

Run go list -deps -json for the tuple over the module at root, returning the concatenated-JSON-object stream. MUST be hermetic (-mod=vendor, GOPROXY=off) on the real impl.

Source

fn read_file(&self, path: &Path) -> Result<Vec<u8>, GomodError>

Read a file’s bytes — go.mod, go.sum, and each source/embed file (for source_hash). Errors are surfaced typed, never swallowed.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§