ErrNotFound indicates that UpdateExpectedValue failed to find the variable to update, likely because it is not a package level variable.
var ErrNotFound = fmt.Errorf("failed to find variable for update of golden value")
Update is a shim for testing, and for compatibility with the old -update-golden flag.
var Update bool
func CallExprArgs(stackIndex int) ([]ast.Expr, error)
CallExprArgs returns the ast.Expr slice for the args of an ast.CallExpr at the index in the call stack.
func FormatNode(node ast.Node) (string, error)
FormatNode using go/format.Node and return the result as a string
func FormattedCallExprArg(stackIndex int, argPos int) (string, error)
FormattedCallExprArg returns the argument from an ast.CallExpr at the index in the call stack. The argument is formatted using FormatNode.
func GoVersionLessThan(major, minor int64) bool
GoVersionLessThan returns true if runtime.Version() is semantically less than version major.minor. Returns false if a release version can not be parsed from runtime.Version().
func IsUpdate() bool
IsUpdate is returns true if the -update flag is set. It indicates the user running the tests would like to update any golden values.
func UpdateExpectedValue(stackIndex int, x, y interface{}) error
UpdateExpectedValue looks for a package-level variable with a name that starts with expected in the arguments to the caller. If the variable is found, the value of the variable will be updated to value of the other argument to the caller.
func UpdateVariable( filename string, fileset *token.FileSet, astFile *ast.File, ident *ast.Ident, value string, ) error
UpdateVariable writes to filename the contents of astFile with the value of the variable updated to value.