提交 16dad751 作者: Jakub Sztandera

tar: fix Go 1.10 breakage

License: MIT
Signed-off-by: 's avatarJakub Sztandera <kubuxu@protonmail.ch>
上级 b002acc6
......@@ -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() {
......
......@@ -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
}
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论