Skip to content

Commit 7efa051

Browse files
committed
Update docs about the update flag
1 parent 7dc1daf commit 7efa051

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

golden/golden.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
Golden files are files in the ./testdata/ subdirectory of the package under test.
44
Golden 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
66
compare the diff of the old expected value to the new expected value.
77
*/
88
package 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.
4545
var 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.
4848
func 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 {
127127
func 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.
157157
func Bytes(actual []byte, filename string) cmp.Comparison {
158158
return func() cmp.Result {

0 commit comments

Comments
 (0)