Exit inside non-main function RVV-A0003
Anti-pattern
Major
4 months ago3 years old
calls to log.Fatalln only in main() or init() functions
240
241	// Start the watching process - it'll check for changes every 100ms.
242	if err := watch.Start(time.Millisecond * 100); err != nil {
243		log.Fatalln(err)244	}
245}
calls to log.Fatalln only in main() or init() functions
235	// Watch config file for changes.
236	absPath, _ := utils.ExpandHomeDir(wtfApp.configFilePath)
237	if err := watch.Add(absPath); err != nil {
238		log.Fatalln(err)239	}
240
241	// Start the watching process - it'll check for changes every 100ms.
calls to log.Fatalln only in main() or init() functions
225					// Usually happens because the watcher looks for the file as the OS is updating it
226					continue
227				}
228				log.Fatalln(err)229			case <-watch.Closed:
230				return
231			}
calls to os.Exit only in main() or init() functions
112	wtfApp.Stop()
113	wtfApp.TViewApp.Stop()
114	wtfApp.DisplayExitMessage()
115	os.Exit(0)116}
117
118// Execute starts the underlying tview app
calls to os.Exit only in main() or init() functions
 58	wtfApp.widgets = MakeWidgets(wtfApp.TViewApp, wtfApp.pages, wtfApp.config, wtfApp.redrawChan)
 59	if len(wtfApp.widgets) == 0 {
 60		fmt.Println("No modules were defined. Make sure you have at least one properly defined widget")
 61		os.Exit(1) 62	}
 63
 64	wtfApp.display = NewDisplay(wtfApp.widgets, wtfApp.config)