Skip to content

Commit

Permalink
stdpkgprogress: np
Browse files Browse the repository at this point in the history
  • Loading branch information
xushiwei committed Aug 8, 2024
1 parent 1f7b958 commit 1996bf8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion chore/stdpkgprogress/go_stdpkg_progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func main() {
panic(err)
}
var done, total float64
var ndone, ntotal int
ret := doc.(githubisstask.Result)

Check warning on line 24 in chore/stdpkgprogress/go_stdpkg_progress.go

View check run for this annotation

qiniu-x / golangci-lint

chore/stdpkgprogress/go_stdpkg_progress.go#L24

unchecked-type-assertion: type cast result is unchecked in doc.(githubisstask.Result) - type assertion will panic if not matched (revive)
for _, task := range ret.Tasks {
desc := task.Desc // fmt* (Imported By: 4513111)
Expand All @@ -28,11 +29,14 @@ func main() {
if n, e := strconv.Atoi(ntext); e == nil {
w := math.Log2(float64(n) + 1)
total += w
ntotal += n
if task.Done {
done += w
ndone += n
}
}
}
}
fmt.Printf("Progress: %.2f%%\n", done/total*100)
np := float64(ndone) / float64(ntotal) * 100
fmt.Printf("Progress: %.2f%% (%.2f%%)\n", done/total*100, np)

Check warning on line 41 in chore/stdpkgprogress/go_stdpkg_progress.go

View check run for this annotation

qiniu-x / golangci-lint

chore/stdpkgprogress/go_stdpkg_progress.go#L41

use of `fmt.Printf` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)
}

0 comments on commit 1996bf8

Please sign in to comment.