Skip to content

Commit

Permalink
Use a bytes.Buffer instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacalz committed Jul 12, 2022
1 parent 2385c07 commit 4e8222f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions statistics.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package main

import (
"bytes"
"encoding/json"
"net/http"
"os"
"strconv"
"strings"
"sync"
"time"
)
Expand Down Expand Up @@ -47,7 +47,7 @@ func fetchStatisticsForRepo(repourl, reponame string, wg *sync.WaitGroup) {
panic(err)
}

buffer := strings.Builder{}
buffer := bytes.Buffer{}

for _, stat := range stats {
if stat.Assets == nil || len(stat.Assets) == 0 {
Expand Down Expand Up @@ -83,5 +83,5 @@ func fetchStatisticsForRepo(repourl, reponame string, wg *sync.WaitGroup) {
buffer.WriteString(strconv.FormatUint(totalDownloads, 10))
buffer.WriteString("\n\n")

os.Stdout.WriteString(buffer.String())
os.Stdout.Write(buffer.Bytes())
}

0 comments on commit 4e8222f

Please sign in to comment.