warren/cmd_build.go

24 lines
516 B
Go

package main
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) {
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)
}