From 032d0856194f6e43507ddd51c3e43ece03529e5d Mon Sep 17 00:00:00 2001 From: John Guo Date: Wed, 24 May 2023 14:12:22 +0800 Subject: [PATCH] fix issue in building binary for command docker (#2660) --- cmd/gf/internal/cmd/cmd_build.go | 2 +- cmd/gf/internal/cmd/cmd_docker.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/gf/internal/cmd/cmd_build.go b/cmd/gf/internal/cmd/cmd_build.go index 2255985b2..ec18265bc 100644 --- a/cmd/gf/internal/cmd/cmd_build.go +++ b/cmd/gf/internal/cmd/cmd_build.go @@ -129,7 +129,7 @@ type cBuildInput struct { VarMap g.Map `short:"r" name:"varMap" brief:"custom built embedded variable into binary"` PackSrc string `short:"ps" name:"packSrc" brief:"pack one or more folders into one go file before building"` PackDst string `short:"pd" name:"packDst" brief:"temporary go file path for pack, this go file will be automatically removed after built" d:"internal/packed/build_pack_data.go"` - ExitWhenError bool `short:"ew" name:"exitWhenError" brief:"exit building when any error occurs, default is false" orphan:"true"` + ExitWhenError bool `short:"ew" name:"exitWhenError" brief:"exit building when any error occurs, specially for multiple arch and system buildings. default is false" orphan:"true"` DumpENV bool `short:"de" name:"dumpEnv" brief:"dump current go build environment before building binary" orphan:"true"` } diff --git a/cmd/gf/internal/cmd/cmd_docker.go b/cmd/gf/internal/cmd/cmd_docker.go index 825e2255a..3738e3a5e 100644 --- a/cmd/gf/internal/cmd/cmd_docker.go +++ b/cmd/gf/internal/cmd/cmd_docker.go @@ -92,15 +92,15 @@ type cDockerInput struct { type cDockerOutput struct{} func (c cDocker) Index(ctx context.Context, in cDockerInput) (out *cDockerOutput, err error) { - mlog.Debugf(`docker command input: %+v`, in) - // Necessary check. if gproc.SearchBinary("docker") == "" { mlog.Fatalf(`command "docker" not found in your environment, please install docker first to proceed this command`) } + mlog.Debugf(`docker command input: %+v`, in) + // Binary build. - in.Build += " --exit" + in.Build += " --exitWhenError" if in.Main != "" { if err = gproc.ShellRun(ctx, fmt.Sprintf(`gf build %s %s`, in.Main, in.Build)); err != nil { mlog.Debugf(`build binary failed with error: %+v`, err)