func AssertGoldenFile(it *assert.Assertions, expected []byte, filenameSuffix string, opts ...FixtureOption) {
	fc := NewFixtureConfig(opts...)
	update := getUpdateGoldenFlag(it, fc.UpdateGoldenFlag)
	filename := fmt.Sprintf("%s%s", fc.GoldenFilePrefix, filenameSuffix)
	path := filepath.Join(fc.Directory, filename)

	if update {
		// NOTE: `defaultNewFilePermissions` will only be used for **new**
		//       files, otherwise `os.WriteFile()` will preserve permissions.
		err := os.WriteFile(path, expected, defaultNewFilePermissions)
		it.Nil(err, fmt.Sprintf("Error writing Golden File %q", path))
		return
	}

	actual, err := os.ReadFile(path)
	it.Nil(err, fmt.Sprintf("Failed reading Golden File %q", path))
	it.True(bytes.Equal(expected, actual), fmt.Sprintf("Golden File %q does not match expected, consider running with the '--%s' flag to update the Golden File", path, fc.UpdateGoldenFlag))
}
// AssertGoldenFile checks that a "golden file" matches the expected contents.
// The golden file will use the test fixtures directory and will use the
// filename suffix **after** a prefix of `golden.`, e.g.
// `./testdata/golden.config.yml`.
//
// Managing golden files can be tedious, so test suites can optionally specify
// a boolean flag (e.g. `go test --update-golden`) that can be propagated to
// this function; in which case the golden file will just be overwritten instead
// of compared against `expected`.
AssertGoldenFile checks that a "golden file" matches the expected contents.
The golden file will use the test fixtures directory and will use the
filename suffix **after** a prefix of `golden.`, e.g.
`./testdata/golden.config.yml`.

Managing golden files can be tedious, so test suites can optionally specify
a boolean flag  that can be propagated to
this function; in which case the golden file will just be overwritten instead
of compared against `expected`.
// AssertGoldenFile checks that a " golden file " matches the expected contents . // The golden file will use the test fixtures directory and will use the // filename suffix ** after ** a prefix of ` golden . ` e . g . // ` . / testdata / golden . config . yml ` . // // Managing golden files can be tedious so test suites can optionally specify // a boolean flag ( e . g . ` go test -- update - golden ` ) that can be propagated to // this function ; in which case the golden file will just be overwritten instead // of compared against ` expected ` .
func AssertGoldenFile(it *assert.Assertions, expected []byte, filenameSuffix string, opts ...FixtureOption) {
	fc := NewFixtureConfig(opts...)
	update := getUpdateGoldenFlag(it, fc.UpdateGoldenFlag)
	filename := fmt.Sprintf("%s%s", fc.GoldenFilePrefix, filenameSuffix)
	path := filepath.Join(fc.Directory, filename)
	if update {
		err := os.WriteFile(path, expected, defaultNewFilePermissions)
		it.Nil(err, fmt.Sprintf("Error writing Golden File %q", path))
		return
	}
	actual, err := os.ReadFile(path)
	it.Nil(err, fmt.Sprintf("Failed reading Golden File %q", path))
	it.True(bytes.Equal(expected, actual), fmt.Sprintf("Golden File %q does not match expected, consider running with the '--%s' flag to update the Golden File", path, fc.UpdateGoldenFlag))
}
func AssertGoldenFile ( it * assert . Assertions , expected [ ] byte , filenameSuffix string , opts ... FixtureOption ) { fc := NewFixtureConfig ( opts ... ) update := getUpdateGoldenFlag ( it , fc . UpdateGoldenFlag ) filename := fmt . Sprintf ( " " , fc . GoldenFilePrefix , filenameSuffix ) path := filepath . Join ( fc . Directory , filename ) if update { err := os . WriteFile ( path , expected , defaultNewFilePermissions ) it . Nil ( err , fmt . Sprintf ( " " , path ) ) return } actual , err := os . ReadFile ( path ) it . Nil ( err , fmt . Sprintf ( " " , path ) ) it . True ( bytes . Equal ( expected , actual ) , fmt . Sprintf ( " " , path , fc . UpdateGoldenFlag ) ) }
AssertGoldenFile checks that a "golden file" matches the expected contents.
AssertGoldenFile checks that a " golden file " matches the expected contents .
// NOTE: `defaultNewFilePermissions` will only be used for **new** //       files, otherwise `os.WriteFile()` will preserve permissions.