diff --git a/container/mts/audio_test.go b/container/mts/audio_test.go index 053bb0a9..9ef1f883 100644 --- a/container/mts/audio_test.go +++ b/container/mts/audio_test.go @@ -74,7 +74,7 @@ func TestEncodePcm(t *testing.T) { } } } - clip := (*bytes.Buffer)(&buf).Bytes() + clip := buf.Bytes() // Get the first MTS packet to check var pkt packet.Packet diff --git a/container/mts/metaEncode_test.go b/container/mts/metaEncode_test.go index 314e235a..7fc23252 100644 --- a/container/mts/metaEncode_test.go +++ b/container/mts/metaEncode_test.go @@ -53,7 +53,7 @@ func TestMetaEncode1(t *testing.T) { if err := e.writePSI(); err != nil { t.Errorf(errUnexpectedErr, err.Error()) } - out := (*bytes.Buffer)(&buf).Bytes() + out := buf.Bytes() got := out[PacketSize+4:] want := []byte{ @@ -82,7 +82,7 @@ func TestMetaEncode2(t *testing.T) { if err := e.writePSI(); err != nil { t.Errorf(errUnexpectedErr, err.Error()) } - out := (*bytes.Buffer)(&buf).Bytes() + out := buf.Bytes() got := out[PacketSize+4:] want := []byte{ 0x00, 0x02, 0xb0, 0x36, 0x00, 0x01, 0xc1, 0x00, 0x00, 0xe1, 0x00, 0xf0, 0x24, diff --git a/revid/revid_test.go b/revid/revid_test.go index 145e4825..5134b47d 100644 --- a/revid/revid_test.go +++ b/revid/revid_test.go @@ -95,21 +95,33 @@ func (tl *testLogger) Log(level int8, msg string, params ...interface{}) { // tstMtsEncoder emulates the mts.Encoder to the extent of the dst field. // This will allow access to the dst to check that it has been set corrctly. -type tstMtsEncoder struct{ dst io.WriteCloser } +type tstMtsEncoder struct { + // dst is here soley to detect the type stored in the encoder. + // No data is written to dst. + dst io.WriteCloser +} func (e *tstMtsEncoder) Write(d []byte) (int, error) { return len(d), nil } func (e *tstMtsEncoder) Close() error { return nil } // tstFlvEncoder emulates the flv.Encoder to the extent of the dst field. // This will allow access to the dst to check that it has been set corrctly. -type tstFlvEncoder struct{ dst io.WriteCloser } +type tstFlvEncoder struct { + // dst is here soley to detect the type stored in the encoder. + // No data is written to dst. + dst io.WriteCloser +} func (e *tstFlvEncoder) Write(d []byte) (int, error) { return len(d), nil } func (e *tstFlvEncoder) Close() error { return nil } // dummyMultiWriter emulates the MultiWriter provided by std lib, so that we // can access the destinations. -type dummyMultiWriter struct{ dst []io.WriteCloser } +type dummyMultiWriter struct { + // dst is here soley to detect the types stored in the multiWriter. + // No data is written to dst. + dst []io.WriteCloser +} func (w *dummyMultiWriter) Write(d []byte) (int, error) { return len(d), nil } func (w *dummyMultiWriter) Close() error { return nil } @@ -259,7 +271,7 @@ func TestResetEncoderSenderSetup(t *testing.T) { } // Now check that this encoder has correct number of destinations (senders). - var ms io.Writer + var ms io.WriteCloser switch encoderType { case mtsEncoderStr: ms = e.(*tstMtsEncoder).dst