code: func (o *CanIOptions) Validate() error {
  	if o.List {
  		if o.Quiet || o.AllNamespaces || o.Subresource != "" {
  			return errors.New("list option can't be specified with neither quiet, all-namespaces nor subresource options")
  		}
  		return nil
  	}
  
  	if o.NonResourceURL != "" {
  		if o.Subresource != "" {
  			return fmt.Errorf("--subresource can not be used with NonResourceURL")
  		}
  		if o.Resource != (schema.GroupVersionResource{}) || o.ResourceName != "" {
  			return fmt.Errorf("NonResourceURL and ResourceName can not specified together")
  		}
  	} else if !o.Resource.Empty() && !o.AllNamespaces && o.DiscoveryClient != nil {
  		if namespaced, err := isNamespaced(o.Resource, o.DiscoveryClient); err == nil && !namespaced {
  			if len(o.Resource.Group) == 0 {
  				fmt.Fprintf(o.ErrOut, "Warning: resource '%s' is not namespace scoped\n", o.Resource.Resource)
  			} else {
  				fmt.Fprintf(o.ErrOut, "Warning: resource '%s' is not namespace scoped in group '%s'\n", o.Resource.Resource, o.Resource.Group)
  			}
  		}
  	}
  
  	if o.NoHeaders {
  		return fmt.Errorf("--no-headers cannot be set without --list specified")
  	}
  	return nil
  }
docs: // Validate makes sure provided values for CanIOptions are valid