fix: gopeed cli negative WaitGroup counter error (#110)

This commit is contained in:
Li Wei authored and GitHub committed 2023-05-04 10:05:32 +08:00
1 parent 09bdb5584a
commit 34bcbd9571
2 files changed
+13 -3

No files matched your search

+4 -1
View File
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/GopeedLab/gopeed/pkg/base"
"github.com/GopeedLab/gopeed/pkg/download"
"github.com/GopeedLab/gopeed/pkg/protocol/http"
)
func main() {
@@ -16,7 +17,9 @@ func main() {
}
}).
Create(&base.Options{
Connections: 8,
Extra: http.OptsExtra{
Connections: 8,
},
})
if err != nil {
panic(err)
+9 -2
View File
@@ -13,9 +13,17 @@ import (
const progressWidth = 20
func main() {
args := parse()
//args := parse()
var dir = "./"
var connections = 8
args := &args{
url: "https://sel-kor-ping.vultr.com/vultr.com.100MB.bin",
dir: &dir,
connections: &connections,
}
var wg sync.WaitGroup
wg.Add(1)
_, err := download.Boot().
URL(args.url).
Listener(func(event *download.Event) {
@@ -46,7 +54,6 @@ func main() {
if err != nil {
panic(err)
}
wg.Add(1)
wg.Wait()
}