From f595b1ef6523eee5aa49cedb2b43430fe0d446ac Mon Sep 17 00:00:00 2001 From: c9s Date: Wed, 9 Dec 2020 16:13:20 +0800 Subject: [PATCH] fix compile flag check --- pkg/cmd/run.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pkg/cmd/run.go b/pkg/cmd/run.go index 8c10a3514..8e7cecc39 100644 --- a/pkg/cmd/run.go +++ b/pkg/cmd/run.go @@ -171,7 +171,6 @@ func runConfig(basectx context.Context, userConfig *bbgo.Config) error { } } - trader := bbgo.NewTrader(environ) if userConfig.RiskControls != nil { @@ -250,8 +249,10 @@ var RunCmd = &cobra.Command{ return err } + shouldCompile := len(userConfig.Imports) > 0 + // if there is no custom imports, we don't have to compile - if noCompile { + if noCompile || !shouldCompile { userConfig, err = bbgo.Load(configFile) if err != nil { return err @@ -265,11 +266,6 @@ var RunCmd = &cobra.Command{ return nil } - shouldCompile := len(userConfig.Imports) > 0 - if shouldCompile { - log.Infof("found imports %v, compiling wrapper binary...", userConfig.Imports) - } - var runArgs = []string{"run", "--no-compile"} cmd.Flags().Visit(func(flag *flag.Flag) { runArgs = append(runArgs, "--"+flag.Name, flag.Value.String())