Using bufio reader for Stdin, otherwise the first 3 bytes are consumed and file gets "corrupted" (stdin is not seekable?)

This commit is contained in:
Samuel Archambault
2019-12-04 15:32:12 -05:00
committed by Simarpreet Singh
parent 9bf16ae1ba
commit 2cb920d5d9
3 changed files with 12 additions and 9 deletions

View File

@@ -1,6 +1,7 @@
package utils
import (
"bufio"
"os"
"testing"
)
@@ -23,7 +24,7 @@ func TestIsGzip(t *testing.T) {
t.Fatalf("unknown error: %s", err)
}
got := IsGzip(f)
got := IsGzip(bufio.NewReader(f))
if got != tt.want {
t.Errorf("got %t, want %t", got, tt.want)
}