Skip to content

Commit

Permalink
cli: remove unnecessary bufio.Reader (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
muktihari authored Apr 30, 2024
1 parent 76a158a commit 983b6bb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
5 changes: 1 addition & 4 deletions cmd/fitactivity/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package main

import (
"bufio"
"flag"
"fmt"
"math"
Expand Down Expand Up @@ -176,9 +175,7 @@ func openAndConcealPosition(path string, opts *options) error {
defer f.Close()

var fits []*proto.FIT
dec := decoder.New(bufio.NewReader(f),
decoder.WithNoComponentExpansion(),
)
dec := decoder.New(f, decoder.WithNoComponentExpansion())

for dec.Next() {
fit, err := dec.Decode()
Expand Down
5 changes: 1 addition & 4 deletions cmd/fitactivity/opener/opener.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package opener

import (
"bufio"
"context"
"os"
"sync"
Expand Down Expand Up @@ -60,9 +59,7 @@ func worker(ctx context.Context, path string, resultc chan<- result, wg *sync.Wa
}
defer f.Close()

dec := decoder.New(bufio.NewReader(f),
decoder.WithNoComponentExpansion(),
)
dec := decoder.New(f, decoder.WithNoComponentExpansion())

for dec.Next() {
fileId, err := dec.PeekFileId()
Expand Down
2 changes: 1 addition & 1 deletion cmd/fitconv/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func fitToCsv(path string, noExpandComponents bool, opts ...fitcsv.Option) error
if noExpandComponents {
options = append(options, decoder.WithNoComponentExpansion())
}
dec := decoder.New(bufio.NewReaderSize(ff, blockSize), options...)
dec := decoder.New(ff, options...)

var sequenceCounter int
defer func() {
Expand Down

0 comments on commit 983b6bb

Please sign in to comment.