MCPcopy Create free account
hub / github.com/NV404/gova / Build

Function Build

internal/devserver/builder.go:29–41  ·  view source on GitHub ↗

Build compiles pkg (a Go package path, e.g. "." or "./cmd/app") to out. It uses `go build` in the provided working directory. Context cancellation kills the build.

(ctx context.Context, workDir, pkg, out string)

Source from the content-addressed store, hash-verified

27// It uses `go build` in the provided working directory. Context cancellation
28// kills the build.
29func Build(ctx context.Context, workDir, pkg, out string) error {
30 if pkg == "" {
31 pkg = "."
32 }
33 var stderr bytes.Buffer
34 cmd := exec.CommandContext(ctx, "go", "build", "-o", out, pkg)
35 cmd.Dir = workDir
36 cmd.Stderr = &stderr
37 if err := cmd.Run(); err != nil {
38 return &BuildError{Stderr: stderr.String(), Err: err}
39 }
40 return nil
41}

Callers 7

cmdBuildFunction · 0.92
cmdRunFunction · 0.92
RunFunction · 0.85
TestBuildSuccessFunction · 0.85
buildHelperFunction · 0.85

Calls 1

StringMethod · 0.80

Tested by 4

TestBuildSuccessFunction · 0.68
buildHelperFunction · 0.68