commit 9038e625cee250d56df3ad8f1de2864ee72160dd
parent fe8294e8a8483395537b65d9d52fafef3c59ba6b
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Mon, 30 Jan 2023 15:49:12 -0800
cleanup
Diffstat:
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/cmd/dkfupload/main.go b/cmd/dkfupload/main.go
@@ -6,6 +6,7 @@ import (
"log"
"math"
"os"
+ "strings"
"sync"
)
@@ -34,14 +35,15 @@ func main() {
fileSize := fs.Size()
nbChunks := int64(math.Ceil(float64(fileSize) / float64(maxChunkSize)))
- log.Println("file: ", fs.Name())
- log.Printf("file size: %s (%s) \n", humanize.Bytes(uint64(fileSize)), humanize.Comma(fileSize))
+ log.Printf(" file: %s\n", fs.Name())
+ log.Printf(" file size: %s (%s)\n", humanize.Bytes(uint64(fileSize)), humanize.Comma(fileSize))
log.Printf("Chunks size: %s (%s)\n", humanize.Bytes(uint64(maxChunkSize)), humanize.Comma(maxChunkSize))
- log.Println("Nb chunks: ", nbChunks)
- log.Println("Nb threads: ", nbThreads)
+ log.Printf(" Nb chunks: %d\n", nbChunks)
+ log.Printf(" Nb threads: %d\n", nbThreads)
if dry {
- log.Println("dry run")
+ log.Printf(" dry run: %t\n", dry)
}
+ log.Println(strings.Repeat("-", 80))
chunksCh := make(chan int64)
go func() {
@@ -59,7 +61,7 @@ func main() {
offset := int64(chunkNum) * maxChunkSize
buf := make([]byte, maxChunkSize)
n, _ := f.ReadAt(buf, offset)
- log.Printf("Thread #%03d | chunk #%03d | read %d | from %d to %d \n", i, chunkNum, n, offset, offset+maxChunkSize)
+ log.Printf("Thread #%03d | chunk #%03d | read %d | from %d to %d\n", i, chunkNum, n, offset, offset+maxChunkSize)
if !dry {
// TODO: http post the chunk to server
}