fix(all): introduce and use iox.CopyContext (#380)
* fix(all): introduce and use iox.CopyContext This PR is part of https://github.com/ooni/probe/issues/1417. In https://github.com/ooni/probe-cli/pull/379 we introduced a context aware wrapper for io.ReadAll (formerly ioutil.ReadAll). Here we introduce a context aware wrapper for io.Copy. * fix(humanize): more significant digits * fix: rename humanize files to follow the common pattern * fix aligment * fix test
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
package fsx_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
|
||||
"github.com/ooni/probe-cli/v3/internal/fsx"
|
||||
"github.com/ooni/probe-cli/v3/internal/iox"
|
||||
)
|
||||
|
||||
func ExampleOpenFile_openingDir() {
|
||||
@@ -26,7 +27,7 @@ func ExampleOpenFile_openingFile() {
|
||||
if err != nil {
|
||||
log.Fatal("unexpected error", err)
|
||||
}
|
||||
data, err := io.ReadAll(filep)
|
||||
data, err := iox.ReadAllContext(context.Background(), filep)
|
||||
if err != nil {
|
||||
log.Fatal("unexpected error", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user