(target target, tags []string)
| 480 | } |
| 481 | |
| 482 | func build(target target, tags []string) { |
| 483 | lazyRebuildAssets() |
| 484 | tags = append(target.tags, tags...) |
| 485 | |
| 486 | rmr(target.BinaryName()) |
| 487 | |
| 488 | setBuildEnvVars() |
| 489 | |
| 490 | // On Windows generate a special file which the Go compiler will |
| 491 | // automatically use when generating Windows binaries to set things like |
| 492 | // the file icon, version, etc. |
| 493 | if goos == "windows" { |
| 494 | cwd, err := os.Getwd() |
| 495 | if err != nil { |
| 496 | log.Fatal(err) |
| 497 | } |
| 498 | sysoPath, err := shouldBuildSyso(cwd) |
| 499 | if err != nil { |
| 500 | log.Printf("Warning: Windows binaries will not have file information encoded: %v", err) |
| 501 | } |
| 502 | defer shouldCleanupSyso(sysoPath) |
| 503 | } |
| 504 | |
| 505 | args := []string{"build"} |
| 506 | if buildOut != "" { |
| 507 | args = append(args, "-o", buildOut) |
| 508 | } |
| 509 | args = appendParameters(args, tags, target.buildPkgs...) |
| 510 | runPrint(goCmd, args...) |
| 511 | } |
| 512 | |
| 513 | func setBuildEnvVars() { |
| 514 | os.Setenv("GOOS", goos) |
no test coverage detected