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
This commit is contained in:
mpl 2016-09-05 18:10:01 +02:00
parent a75f7e6c63
commit 10aa2b3fbd
1 changed files with 2 additions and 0 deletions

View File

@ -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))
}