sentinel.go
func (s *Sentinel) Run(ctxt context.Context) error {
	s.Lock()
	if s.started {
		defer s.Unlock()
		return ErrAlreadyStarted
	}
	s.started = true
	s.Unlock()

	eg, ctxt := errgroup.WithContext(ctxt)

	// add servers
	for _, f := range s.serverFuncs {
		eg.Go(func(f func(context.Context) error) func() error {
			return func() error {
				return f(ctxt)
			}
		}(f))
	}

	// add shutdown
	eg.Go(func() func() error {
		s.sig = make(chan os.Signal, 1)
		signal.Notify(s.sig, s.shutdownSigs...)
		return func() error {
			s.logf("received signal: %v", <-s.sig)
			return s.Shutdown()
		}
	}())

	if err := eg.Wait(); err != nil && !s.ShutdownIgnore(err) {
		return err
	}

	return nil
}
func (s *Sentinel) Run(ctxt context.Context) error {
	s.Lock()
	if s.started {
		defer s.Unlock()
		return ErrAlreadyStarted
	}
	s.started = true
	s.Unlock()

	eg, ctxt := errgroup.WithContext(ctxt)

	// add servers
	for _, f := range s.serverFuncs {
		eg.Go(func(f func(context.Context) error) func() error {
			return func() error {
				return f(ctxt)
			}
		}(f))
	}

	// add shutdown
	eg.Go(func() func() error {
		s.sig = make(chan os.Signal, 1)
		signal.Notify(s.sig, s.shutdownSigs...)
		return func() error {
			s.logf("received signal: %v", <-s.sig)
			return s.Shutdown()
		}
	}())

	if err := eg.Wait(); err != nil && !s.ShutdownIgnore(err) {
		return err
	}

	return nil
}
// Run starts the server group, returning the first encountered error upon
// shutdown.