MCPcopy
hub / github.com/perkeep/perkeep / env

Method env

dev/devcam/test.go:81–105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

79}
80
81func (c *testCmd) env() *Env {
82 env := NewCopyEnv()
83 env.NoGo()
84 cmd := exec.Command("go", "env", "GOPATH")
85 cmd.Stderr = os.Stderr
86 out, err := cmd.Output()
87 if err != nil {
88 panic("Cannot find GOPATH with 'go env GOPATH'")
89 }
90 gopath := strings.TrimSpace(string(out))
91 if gopath == "" {
92 panic("devcam test needs GOPATH to be set")
93 }
94 env.Set("GOPATH", gopath)
95
96 // Disable CGO on windows if it doesn't look like it's available.
97 if runtime.GOOS == "windows" {
98 if _, err := exec.LookPath("gcc"); err != nil {
99 if _, err := exec.LookPath("clang"); err != nil {
100 env.Set("CGO_ENABLED", "0")
101 }
102 }
103 }
104 return env
105}
106
107func (c *testCmd) buildSelf() error {
108 args := []string{

Callers 2

buildSelfMethod · 0.95
runTestsMethod · 0.95

Calls 5

NewCopyEnvFunction · 0.85
NoGoMethod · 0.80
CommandMethod · 0.65
SetMethod · 0.65
LookPathMethod · 0.65

Tested by

no test coverage detected