func (c Context) ResetPath(newRoot string) (new Context) {
	new = c
	new.Path = NewPath(newRoot)
	new.Depth++
	return
}
ResetPath creates a new Context from current one but reinitializing Path.
package ctxerr
import (
	"github.com/maxatome/go-testdeep/internal/anchors"
	"github.com/maxatome/go-testdeep/internal/hooks"
	"github.com/maxatome/go-testdeep/internal/location"
	"github.com/maxatome/go-testdeep/internal/visited"
)
type Context struct {
	Path        Path
	Visited     visited.Visited
	CurOperator location.GetLocationer
	Depth       int
	MaxErrors int
	Errors    *[]*Error
	Anchors   *anchors.Info
	Hooks     *hooks.Info
	BooleanError bool
	FailureIsFatal bool
	UseEqual bool
	BeLax bool
	IgnoreUnexported bool
}
func (c *Context) InitErrors() {
	if c.MaxErrors != 0 && c.MaxErrors != 1 {
		var errors []*Error
		c.Errors = &errors
	}
}
func (c Context) ResetErrors() (new Context) {
	new = c
	new.InitErrors()
	return
}
func (c Context) CollectError(err *Error) *Error {
	if err == nil {
		return nil
	}
	if c.BooleanError {
		return BooleanError
	}
	if err.Context.Depth == 0 {
		err.Context = c
	}
	if !err.Location.IsInitialized() && c.CurOperator != nil {
		err.Location = c.CurOperator.GetLocation()
	}
	if c.Errors == nil {
		return err
	}
	*c.Errors = append(*c.Errors, err)
	if c.MaxErrors >= 0 && len(*c.Errors) >= c.MaxErrors {
		*c.Errors = append(*c.Errors, ErrTooManyErrors)
		return c.MergeErrors()
	}
	return nil
}
func (c Context) MergeErrors() *Error {
	if c.Errors == nil || len(*c.Errors) == 0 {
		return nil
	}
	if len(*c.Errors) > 1 {
		for idx, last := 0, len(*c.Errors)-2; idx <= last; idx++ {
			(*c.Errors)[idx].Next = (*c.Errors)[idx+1]
		}
	}
	return (*c.Errors)[0]
}
func (c Context) CannotCompareError() *Error {
	if c.BooleanError {
		return BooleanError
	}
	return &Error{
		Message: "cannot compare",
		Summary: NewSummary("unexported field that cannot be overridden"),
	}
}
func (c Context) AddCustomLevel(pathAdd string) (new Context) {
	new = c
	new.Path = new.Path.AddCustomLevel(pathAdd)
	new.Depth++
	return
}
func (c Context) AddField(field string) (new Context) {
	new = c
	new.Path = new.Path.AddField(field)
	new.Depth++
	return
}
func (c Context) AddArrayIndex(index int) (new Context) {
	new = c
	new.Path = new.Path.AddArrayIndex(index)
	new.Depth++
	return
}
func (c Context) AddMapKey(key interface{}) (new Context) {
	new = c
	new.Path = new.Path.AddMapKey(key)
	new.Depth++
	return
}
func (c Context) AddPtr(num int) (new Context) {
	new = c
	new.Path = new.Path.AddPtr(num)
	new.Depth++
	return
}
func (c Context) AddFunctionCall(fn string) (new Context) {
	new = c
	new.Path = new.Path.AddFunctionCall(fn)
	new.Depth++
	return
}