MCPcopy Create free account
hub / github.com/syncthing/syncthing / build

Function build

build.go:482–511  ·  view source on GitHub ↗
(target target, tags []string)

Source from the content-addressed store, hash-verified

480}
481
482func 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
513func setBuildEnvVars() {
514 os.Setenv("GOOS", goos)

Callers 4

runCommandFunction · 0.90
buildTarFunction · 0.90
buildZipFunction · 0.90
buildDebFunction · 0.90

Calls 9

lazyRebuildAssetsFunction · 0.85
rmrFunction · 0.85
setBuildEnvVarsFunction · 0.85
shouldBuildSysoFunction · 0.85
shouldCleanupSysoFunction · 0.85
appendParametersFunction · 0.85
runPrintFunction · 0.85
BinaryNameMethod · 0.80
FatalMethod · 0.80

Tested by

no test coverage detected