func (o *FetchOptions) Validate() error {
	if o.RemoteName == "" {
		o.RemoteName = DefaultRemoteName
	}
	if o.Tags == InvalidTagMode {
		o.Tags = TagFollowing
	}
	for _, r := range o.RefSpecs {
		if err := r.Validate(); err != nil {
			return err
		}
	}
	return nil
}
Validate validates the fields and sets the default values.
package git
import (
	"errors"
	"gopkg.in/src-d/go-git.v4/config"
	"gopkg.in/src-d/go-git.v4/plumbing"
	"gopkg.in/src-d/go-git.v4/plumbing/object"
	"gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/sideband"
	"gopkg.in/src-d/go-git.v4/plumbing/transport"
)
type SubmoduleRescursivity uint
const (
	DefaultRemoteName = "origin"
	NoRecurseSubmodules SubmoduleRescursivity = 0
	DefaultSubmoduleRecursionDepth SubmoduleRescursivity = 10
)
var (
	ErrMissingURL = errors.New("URL field is required")
)
type CloneOptions struct {
	URL string
	Auth transport.AuthMethod
	RemoteName string
	ReferenceName plumbing.ReferenceName
	SingleBranch bool
	Depth int
	RecurseSubmodules SubmoduleRescursivity
	Progress sideband.Progress
	Tags TagMode
}
func (o *CloneOptions) Validate() error {
	if o.URL == "" {
		return ErrMissingURL
	}
	if o.RemoteName == "" {
		o.RemoteName = DefaultRemoteName
	}
	if o.ReferenceName == "" {
		o.ReferenceName = plumbing.HEAD
	}
	if o.Tags == InvalidTagMode {
		o.Tags = AllTags
	}
	return nil
}
type PullOptions struct {
	RemoteName string
	ReferenceName plumbing.ReferenceName
	SingleBranch bool
	Depth int
	Auth transport.AuthMethod
	RecurseSubmodules SubmoduleRescursivity
	Progress sideband.Progress
	Force bool
}
func (o *PullOptions) Validate() error {
	if o.RemoteName == "" {
		o.RemoteName = DefaultRemoteName
	}
	if o.ReferenceName == "" {
		o.ReferenceName = plumbing.HEAD
	}
	return nil
}
type TagMode int
const (
	InvalidTagMode TagMode = iota
	TagFollowing
	AllTags
	NoTags
)
type FetchOptions struct {
	RemoteName string
	RefSpecs   []config.RefSpec
	Depth int
	Auth transport.AuthMethod
	Progress sideband.Progress
	Tags TagMode
	Force bool
}