mirror of
https://github.com/restic/rest-server.git
synced 2025-12-07 09:36:13 -08:00
7
build.go
7
build.go
@@ -195,8 +195,11 @@ func cleanEnv() (env []string) {
|
|||||||
|
|
||||||
// build runs "go build args..." with GOPATH set to gopath.
|
// build runs "go build args..." with GOPATH set to gopath.
|
||||||
func build(cwd, goos, goarch, gopath string, args ...string) error {
|
func build(cwd, goos, goarch, gopath string, args ...string) error {
|
||||||
args = append([]string{"build"}, args...)
|
a := []string{"build"}
|
||||||
cmd := exec.Command("go", args...)
|
a = append(a, "-asmflags", fmt.Sprintf("-trimpath=%s", gopath))
|
||||||
|
a = append(a, "-gcflags", fmt.Sprintf("-trimpath=%s", gopath))
|
||||||
|
a = append(a, args...)
|
||||||
|
cmd := exec.Command("go", a...)
|
||||||
cmd.Env = append(cleanEnv(), "GOPATH="+gopath, "GOARCH="+goarch, "GOOS="+goos)
|
cmd.Env = append(cleanEnv(), "GOPATH="+gopath, "GOARCH="+goarch, "GOOS="+goos)
|
||||||
if !enableCGO {
|
if !enableCGO {
|
||||||
cmd.Env = append(cmd.Env, "CGO_ENABLED=0")
|
cmd.Env = append(cmd.Env, "CGO_ENABLED=0")
|
||||||
|
|||||||
Reference in New Issue
Block a user