code: func (s *GenericAPIServer) AddPreShutdownHook(name string, hook PreShutdownHookFunc) error {
  	if len(name) == 0 {
  		return fmt.Errorf("missing name")
  	}
  	if hook == nil {
  		return nil
  	}
  
  	s.preShutdownHookLock.Lock()
  	defer s.preShutdownHookLock.Unlock()
  
  	if s.preShutdownHooksCalled {
  		return fmt.Errorf("unable to add %q because PreShutdownHooks have already been called", name)
  	}
  	if _, exists := s.preShutdownHooks[name]; exists {
  		return fmt.Errorf("unable to add %q because it is already registered", name)
  	}
  
  	s.preShutdownHooks[name] = preShutdownHookEntry{hook: hook}
  
  	return nil
  }
docs: // AddPreShutdownHook allows you to add a PreShutdownHook.