@@ -130,6 +130,12 @@ func main() {
130130}
131131
132132func validateFlags (_ * cli.Context , o * options ) error {
133+ if o .root == "" {
134+ return fmt .Errorf ("the install root must be specified" )
135+ }
136+ if _ , exists := availableRuntimes [o .runtime ]; ! exists {
137+ return fmt .Errorf ("unknown runtime: %v" , o .runtime )
138+ }
133139 if filepath .Base (o .pidFile ) != toolkitPidFilename {
134140 return fmt .Errorf ("invalid toolkit.pid path %v" , o .pidFile )
135141 }
@@ -144,12 +150,7 @@ func validateFlags(_ *cli.Context, o *options) error {
144150
145151// Run runs the core logic of the CLI
146152func Run (c * cli.Context , o * options ) error {
147- err := verifyFlags (o )
148- if err != nil {
149- return fmt .Errorf ("unable to verify flags: %v" , err )
150- }
151-
152- err = initialize (o .pidFile )
153+ err := initialize (o .pidFile )
153154 if err != nil {
154155 return fmt .Errorf ("unable to initialize: %v" , err )
155156 }
@@ -217,18 +218,6 @@ func ParseArgs(args []string) ([]string, string, error) {
217218 return nil , "" , fmt .Errorf ("unexpected positional argument(s) %v" , args [2 :lastPositionalArg + 1 ])
218219}
219220
220- func verifyFlags (o * options ) error {
221- log .Infof ("Verifying Flags" )
222- if o .root == "" {
223- return fmt .Errorf ("the install root must be specified" )
224- }
225-
226- if _ , exists := availableRuntimes [o .runtime ]; ! exists {
227- return fmt .Errorf ("unknown runtime: %v" , o .runtime )
228- }
229- return nil
230- }
231-
232221func initialize (pidFile string ) error {
233222 log .Infof ("Initializing" )
234223
0 commit comments