2014-12-09 03:16:07 +00:00
|
|
|
package main
|
|
|
|
|
2014-12-09 07:54:35 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
"os/exec"
|
|
|
|
)
|
2014-12-09 03:16:07 +00:00
|
|
|
|
|
|
|
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)
|
2014-12-09 03:16:07 +00:00
|
|
|
}
|