From d0e63c16586d19ae976ca28ef75600d091b2213e Mon Sep 17 00:00:00 2001 From: Wyatt Alt Date: Fri, 8 Sep 2023 07:35:34 -0700 Subject: [PATCH] Linter errors --- go/mcap/indexed_message_iterator.go | 2 +- go/mcap/lexer.go | 3 +++ go/mcap/lexer_test.go | 4 ++-- go/mcap/resettable_write_closer.go | 2 +- go/mcap/writer_test.go | 4 ++-- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/go/mcap/indexed_message_iterator.go b/go/mcap/indexed_message_iterator.go index ef7ba4b6fa..1c75b9e56e 100644 --- a/go/mcap/indexed_message_iterator.go +++ b/go/mcap/indexed_message_iterator.go @@ -237,7 +237,7 @@ func (it *indexedMessageIterator) loadChunk(chunkIndex *ChunkIndex) error { return nil } -func (it *indexedMessageIterator) Next(p []byte) (*Schema, *Channel, *Message, error) { +func (it *indexedMessageIterator) Next(_ []byte) (*Schema, *Channel, *Message, error) { if !it.hasReadSummarySection { err := it.parseSummarySection() if err != nil { diff --git a/go/mcap/lexer.go b/go/mcap/lexer.go index 6ea49e2c18..bfa59b9ce7 100644 --- a/go/mcap/lexer.go +++ b/go/mcap/lexer.go @@ -246,6 +246,9 @@ func (l *Lexer) Next(p []byte) (TokenType, []byte, error) { if err != nil { return TokenError, nil, fmt.Errorf("failed to allocate %d bytes for %s token: %w", recordLen, opcode, err) } + fmt.Println("new", recordLen) + } else { + fmt.Println("reuse") } record := p[:recordLen] diff --git a/go/mcap/lexer_test.go b/go/mcap/lexer_test.go index 179fdb31a7..76ed5dcf73 100644 --- a/go/mcap/lexer_test.go +++ b/go/mcap/lexer_test.go @@ -145,9 +145,9 @@ func TestCustomDecompressor(t *testing.T) { ) lzr := lz4.NewReader(nil) blockCount := 0 - lzr.Apply(lz4.OnBlockDoneOption(func(size int) { + assert.Nil(t, lzr.Apply(lz4.OnBlockDoneOption(func(size int) { blockCount++ - })) + }))) lexer, err := NewLexer(bytes.NewReader(buf), &LexerOptions{ Decompressors: map[CompressionFormat]ResettableReader{ CompressionLZ4: lzr, diff --git a/go/mcap/resettable_write_closer.go b/go/mcap/resettable_write_closer.go index 268856511e..03d36b2f65 100644 --- a/go/mcap/resettable_write_closer.go +++ b/go/mcap/resettable_write_closer.go @@ -23,6 +23,6 @@ func (b bufCloser) Write(p []byte) (int, error) { return b.b.Write(p) } -func (b bufCloser) Reset(w io.Writer) { +func (b bufCloser) Reset(_ io.Writer) { b.b.Reset() } diff --git a/go/mcap/writer_test.go b/go/mcap/writer_test.go index c7a7e1be29..8ecd16ff5a 100644 --- a/go/mcap/writer_test.go +++ b/go/mcap/writer_test.go @@ -704,9 +704,9 @@ func TestBYOCompressor(t *testing.T) { // example - custom lz4 settings lzw := lz4.NewWriter(nil) blockCount := 0 - lzw.Apply(lz4.OnBlockDoneOption(func(size int) { + assert.Nil(t, lzw.Apply(lz4.OnBlockDoneOption(func(size int) { blockCount++ - })) + }))) writer, err := NewWriter(buf, &WriterOptions{ Chunked: true,