code: func initService(daemonCli *DaemonCli) (bool, bool, error) {
  	if *flUnregisterService {
  		if *flRegisterService {
  			return true, false, errors.New("--register-service and --unregister-service cannot be used together")
  		}
  		return true, false, unregisterService()
  	}
  
  	if *flRegisterService {
  		return true, false, registerService()
  	}
  
  	if !*flRunService {
  		return false, false, nil
  	}
  
  	interactive, err := svc.IsAnInteractiveSession()
  	if err != nil {
  		return false, false, err
  	}
  
  	h := &handler{
  		tosvc:     make(chan bool),
  		fromsvc:   make(chan error),
  		daemonCli: daemonCli,
  	}
  
  	var log *eventlog.Log
  	if !interactive {
  		log, err = eventlog.Open(*flServiceName)
  		if err != nil {
  			return false, false, err
  		}
  	}
  
  	logrus.AddHook(&etwHook{log})
  	logrus.SetOutput(ioutil.Discard)
  
  	service = h
  	go func() {
  		if interactive {
  			err = debug.Run(*flServiceName, h)
  		} else {
  			err = svc.Run(*flServiceName, h)
  		}
  
  		h.fromsvc <- err
  	}()
  
  	// Wait for the first signal from the service handler.
  	err = <-h.fromsvc
  	if err != nil {
  		return false, false, err
  	}
  	return false, true, nil
  }
docs: // initService is the entry point for running the daemon as a Windows
  // service. It returns an indication to stop (if registering/un-registering);
  // an indication of whether it is running as a service; and an error.