Progress bar moves down during download process
Open
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 4.7k
- Forks
- 258
- Avg merge
- 13h 31m
- Merged PRs (30d)
- 1
Description
Progress bar moves down during download process
package main
import (
"archive/zip"
"bytes"
"fmt"
"github.com/debfig/bindview-cli/Tools"
"github.com/schollz/progressbar/v3"
"io"
"net/http"
)
// DownloadUrl 下载地址
var DownloadUrl string = "https://github.com/bronze-ding/bindview-Template/archive/refs/heads/master.zip"
// DownloadFile 文件缓存区
var DownloadFile bytes.Buffer
func main() {
// 获取命令行输入
state, str := Tools.GetCmd()
if state != 1 {
return
}
req, _ := http.NewRequest("GET", DownloadUrl, nil)
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
bar := progressbar.DefaultBytes(
resp.ContentLength,
"正在下载模板压缩包 (.zip)",
)
io.Copy(io.MultiWriter(&DownloadFile, bar), resp.Body)
ZipData, err := io.ReadAll(&DownloadFile)
if err != nil {
fmt.Println(err)
return
}
ZipReader, _ := zip.NewReader(bytes.NewReader(ZipData), int64(len(ZipData)))
// 解 .zip 压缩
if err = Tools.Unzip("", ZipReader); err != nil {
fmt.Println(err)
return
}
// 文件重命名
Tools.NewFileName(&str)
// 输出命令提示
Tools.CommandList(str)
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the report with the supplied Go example, starting at progressbar.DefaultBytes and the io.MultiWriter download path. Trace how progress updates are rendered during the download and use the screenshot and reported symptom to define done: the progress bar should remain in its intended position instead of moving down.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100