github.com/tilotech/tilores-cli@v0.28.0/internal/pkg/step/build.go (about) 1 package step 2 3 import ( 4 "fmt" 5 "os" 6 ) 7 8 // Build creates a step that runs go build. 9 func Build(pkg string, target string, goEnvs ...string) Step { 10 return func() error { 11 cmd := createCommand("go", "build", "-o", target, pkg) 12 cmd.Env = os.Environ() 13 cmd.Env = append(cmd.Env, goEnvs...) 14 err := cmd.Run() 15 if err != nil { 16 return fmt.Errorf("could not build %v: %%v", pkg) 17 } 18 return nil 19 } 20 }