code: func ValidateDiscovery(d *kubeadm.Discovery, fldPath *field.Path) field.ErrorList {
  	allErrs := field.ErrorList{}
  
  	if d.BootstrapToken == nil && d.File == nil {
  		allErrs = append(allErrs, field.Invalid(fldPath, "", "bootstrapToken or file must be set"))
  	}
  
  	if d.BootstrapToken != nil && d.File != nil {
  		allErrs = append(allErrs, field.Invalid(fldPath, "", "bootstrapToken and file cannot both be set"))
  	}
  
  	if d.BootstrapToken != nil {
  		allErrs = append(allErrs, ValidateDiscoveryBootstrapToken(d.BootstrapToken, fldPath.Child("bootstrapToken"))...)
  		allErrs = append(allErrs, ValidateToken(d.TLSBootstrapToken, fldPath.Child("tlsBootstrapToken"))...)
  	}
  
  	if d.File != nil {
  		allErrs = append(allErrs, ValidateDiscoveryFile(d.File, fldPath.Child("file"))...)
  		if len(d.TLSBootstrapToken) != 0 {
  			allErrs = append(allErrs, ValidateToken(d.TLSBootstrapToken, fldPath.Child("tlsBootstrapToken"))...)
  		}
  	}
  
  	return allErrs
  }
docs: // ValidateDiscovery validates discovery related configuration and collects all encountered errors