var update … func TestGolden(t *testing.T) { … } // writeAndKill writes b to w and then fills b with Zs. // The filling makes sure that if w is holding onto b for // future use, that future use will have obviously wrong data. func writeAndKill(w io.Writer, b []byte) { … } // diffJSON diffs the stream we have against the stream we want // and fails the test with a useful message if they don't match. func diffJSON(t *testing.T, have, want []byte) { … } func TestTrimUTF8(t *testing.T) { … }