code: func (l *State) deleteService(id string) error {
  	if id == "" {
  		return fmt.Errorf("ServiceID missing")
  	}
  
  	req := structs.DeregisterRequest{
  		Datacenter:   l.config.Datacenter,
  		Node:         l.config.NodeName,
  		ServiceID:    id,
  		WriteRequest: structs.WriteRequest{Token: l.serviceToken(id)},
  	}
  	var out struct{}
  	err := l.Delegate.RPC("Catalog.Deregister", &req, &out)
  	switch {
  	case err == nil || strings.Contains(err.Error(), "Unknown service"):
  		delete(l.services, id)
  		l.logger.Printf("[INFO] agent: Deregistered service %q", id)
  		return nil
  
  	case acl.IsErrPermissionDenied(err), acl.IsErrNotFound(err):
  		// todo(fs): mark the service to be in sync to prevent excessive retrying before next full sync
  		// todo(fs): some backoff strategy might be a better solution
  		l.services[id].InSync = true
  		l.logger.Printf("[WARN] agent: Service %q deregistration blocked by ACLs", id)
  		metrics.IncrCounter([]string{"acl", "blocked", "service", "deregistration"}, 1)
  		return nil
  
  	default:
  		l.logger.Printf("[WARN] agent: Deregistering service %q failed. %s", id, err)
  		return err
  	}
  }
docs: // deleteService is used to delete a service from the server