mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-11 03:09:41 +08:00
tar: fix Go 1.10 breakage
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
This commit is contained in:
parent
b002acc689
commit
16dad7515b
@ -125,6 +125,26 @@ test_get_cmd() {
|
||||
test_must_fail ipfs get ../.. 2>actual &&
|
||||
test_cmp expected actual
|
||||
'
|
||||
|
||||
test_expect_success "create small file" '
|
||||
echo "foo" > small &&
|
||||
ipfs add -q small > hash_small
|
||||
'
|
||||
|
||||
test_expect_success "get small file" '
|
||||
ipfs get -o out_small $(cat hash_small) &&
|
||||
test_cmp small out_small
|
||||
'
|
||||
|
||||
test_expect_success "create medium file" '
|
||||
head -c 16000 > medium &&
|
||||
ipfs add -q medium > hash_medium
|
||||
'
|
||||
|
||||
test_expect_success "get medium file" '
|
||||
ipfs get -o out_medium $(cat hash_medium) &&
|
||||
test_cmp medium out_medium
|
||||
'
|
||||
}
|
||||
|
||||
test_get_fail() {
|
||||
|
||||
13
thirdparty/tar/extractor.go
vendored
13
thirdparty/tar/extractor.go
vendored
@ -114,18 +114,19 @@ func copyWithProgress(to io.Writer, from io.Reader, cb func(int64) int64) error
|
||||
buf := make([]byte, 4096)
|
||||
for {
|
||||
n, err := from.Read(buf)
|
||||
if n != 0 {
|
||||
cb(int64(n))
|
||||
_, err2 := to.Write(buf[:n])
|
||||
if err2 != nil {
|
||||
return err2
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
cb(int64(n))
|
||||
_, err = to.Write(buf[:n])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user