22
33Golden files are files in the ./testdata/ subdirectory of the package under test.
44Golden files can be automatically updated to match new values by running
5- `go test pkgname -test. update-golden `. To ensure the update is correct
5+ `go test pkgname -update`. To ensure the update is correct
66compare the diff of the old expected value to the new expected value.
77*/
88package golden // import "gotest.tools/v3/golden"
@@ -33,7 +33,7 @@ type helperT interface {
3333
3434// NormalizeCRLFToLF enables end-of-line normalization for actual values passed
3535// to Assert and String, as well as the values saved to golden files with
36- // -test. update-golden .
36+ // -update.
3737//
3838// Defaults to true. If you use the core.autocrlf=true git setting on windows
3939// you will need to set this to false.
@@ -44,7 +44,7 @@ type helperT interface {
4444// The default value may change in a future major release.
4545var NormalizeCRLFToLF = os .Getenv ("GOTESTTOOLS_GOLDEN_NormalizeCRLFToLF" ) != "false"
4646
47- // FlagUpdate returns true when the -test. update-golden flag has been set.
47+ // FlagUpdate returns true when the -update flag has been set.
4848func FlagUpdate () bool {
4949 return flagUpdate
5050}
@@ -86,7 +86,7 @@ func removeCarriageReturn(in []byte) []byte {
8686
8787// Assert compares actual to the expected value in the golden file.
8888//
89- // Running `go test pkgname -test. update-golden ` will write the value of actual
89+ // Running `go test pkgname -update` will write the value of actual
9090// to the golden file.
9191//
9292// This is equivalent to assert.Assert(t, String(actual, filename))
@@ -100,7 +100,7 @@ func Assert(t assert.TestingT, actual string, filename string, msgAndArgs ...int
100100// String compares actual to the contents of filename and returns success
101101// if the strings are equal.
102102//
103- // Running `go test pkgname -test. update-golden ` will write the value of actual
103+ // Running `go test pkgname -update` will write the value of actual
104104// to the golden file.
105105//
106106// Any \r\n substrings in actual are converted to a single \n character
@@ -127,13 +127,13 @@ func String(actual string, filename string) cmp.Comparison {
127127func failurePostamble (filename string ) string {
128128 return fmt .Sprintf (`
129129
130- You can run 'go test . -test. update-golden ' to automatically update %s to the new expected value.'
130+ You can run 'go test . -update' to automatically update %s to the new expected value.'
131131` , Path (filename ))
132132}
133133
134134// AssertBytes compares actual to the expected value in the golden.
135135//
136- // Running `go test pkgname -test. update-golden ` will write the value of actual
136+ // Running `go test pkgname -update` will write the value of actual
137137// to the golden file.
138138//
139139// This is equivalent to assert.Assert(t, Bytes(actual, filename))
@@ -152,7 +152,7 @@ func AssertBytes(
152152// Bytes compares actual to the contents of filename and returns success
153153// if the bytes are equal.
154154//
155- // Running `go test pkgname -test. update-golden ` will write the value of actual
155+ // Running `go test pkgname -update` will write the value of actual
156156// to the golden file.
157157func Bytes (actual []byte , filename string ) cmp.Comparison {
158158 return func () cmp.Result {
0 commit comments