From 10aa2b3fbd8f8813e2440f9ca324dcdc695296be Mon Sep 17 00:00:00 2001 From: mpl Date: Mon, 5 Sep 2016 18:10:01 +0200 Subject: [PATCH] make.go: use host GOOS and GOARCH when go generating zsearch.go Because our go generate line is: //go:generate go run gensearchtypes.go -out zsearch.go which will run a binary of gensearchtypes.go built for whatever $GOOS is set to. Which will fail if $GOOS is different from runtime.GOOS (the cross-compiling case). I suppose it means that the day pkg/search becomes GOOS differentiated, we may have to introduce an -os flag to gensearchtypes.go, since it calls go doc on camlistore.org/pkg/search, whose output might depend on GOOS? Change-Id: I1ea32bb9190300120887ee8614dcdd2d1391a954 --- make.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/make.go b/make.go index 9b5b599a6..b3b95c1fa 100644 --- a/make.go +++ b/make.go @@ -406,6 +406,8 @@ func genSearchTypes() error { cmd.Env = append(cleanGoEnv(), "GOPATH="+buildGoPath, ) + cmd.Env = setEnv(cmd.Env, "GOOS", runtime.GOOS) + cmd.Env = setEnv(cmd.Env, "GOARCH", runtime.GOARCH) if out, err := cmd.CombinedOutput(); err != nil { return fmt.Errorf("go generate for publisher js error: %v, %v", err, string(out)) }