warren/cmd_build.go

24 lines
516 B
Go
Raw Normal View History

package main
2014-12-09 07:54:35 +00:00
import (
"fmt"
"log"
"os/exec"
)
var buildCmd = &Command{
Name: "build",
Usage: "",
Summary: "build the go server in the current directory",
Help: `build extended help here...`,
Run: buildRun,
}
func buildRun(cmd *Command, args ...string) {
2014-12-09 07:54:35 +00:00
out, err := exec.Command("go", "build", "-ldflags", fmt.Sprintf("\"-X main.Build.Date %s main.Build.GitHash %s main.Build.Num %d\"", "2014-12-08", "a1b2c3d4", 107)).Output()
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", out)
}