grim/convey

6d1458fd6364
Parents 7fd111a7e932
Children 9d345f19050e
don't create the state until we absolutely need to
  • +9 -9
    main.go
  • --- a/main.go Wed May 27 23:43:00 2020 -0500
    +++ b/main.go Thu May 28 00:06:40 2020 -0500
    @@ -165,9 +165,6 @@
    return 1
    }
    - // create our state
    - st := state.New()
    -
    // setup logging
    logging.Setup(*color, *verbose)
    defer logging.Shutdown()
    @@ -207,6 +204,15 @@
    return 1
    }
    + runner := determineRunner(command)
    +
    + if len(*planNames) == 0 {
    + *planNames = []string{loader.DefaultPlan()}
    + }
    +
    + // create our state
    + st := state.New()
    +
    // set the state's variables and validate it
    st.CfgPath = cfgPath
    st.KeepWorkspace = *keep
    @@ -224,12 +230,6 @@
    return 1
    }
    - runner := determineRunner(command)
    -
    - if len(*planNames) == 0 {
    - *planNames = []string{loader.DefaultPlan()}
    - }
    -
    // finally create our runtime
    fullEnv := environment.New().Merge(defEnv).MergeSlice(*env)
    rt := runtime.NewWithEnvironment(st, fullEnv)