Skip to content

Commit

Permalink
fix reviewdog report
Browse files Browse the repository at this point in the history
Signed-off-by: Kosuke Morimoto <[email protected]>
  • Loading branch information
kmrmt committed Oct 31, 2023
1 parent 110efce commit 02b0b5f
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions cmd/tools/cli/benchmark/core/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
)

func main() {
const columnSize = 42
var (
buf []byte
err error
Expand All @@ -60,7 +61,7 @@ func main() {

pfile = fmt.Sprintf("/proc/%d/status", os.Getpid())
zero = float64(0.0)
format = "%s\t" + strings.TrimSuffix(strings.Repeat("%.2f\t", 42), "\t")
format = "%s\t" + strings.TrimSuffix(strings.Repeat("%.2f\t", columnSize), "\t")
)
output := func(header string) {
buf, err = os.ReadFile(pfile)
Expand Down Expand Up @@ -228,9 +229,7 @@ func main() {
}
go srv.ListenAndServe()
<-ctx.Done()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
srv.Shutdown(ctx)
srv.Shutdown(context.Background())
}()

Check warning on line 233 in cmd/tools/cli/benchmark/core/main.go

View check run for this annotation

Codecov / codecov/patch

cmd/tools/cli/benchmark/core/main.go#L218-L233

Added lines #L218 - L233 were not covered by tests

vectors, _, _ := load(os.Getenv("DATA_PATH"))
Expand Down Expand Up @@ -326,19 +325,19 @@ func main() {
waitForGC = time.Minute * 5
timeToFinalize = time.Minute * 5
)
sleep(ctx, time.Second*5, waitForGC, func() {
sleep(ctx, logInterval, waitForGC, func() {
output("waiting for gc")
}, func() {
runtime.GC()
output("gc")
})
sleep(ctx, time.Second*5, waitForGC, func() {
sleep(ctx, logInterval, waitForGC, func() {
output("waiting for gc")
}, func() {
runtime.GC()
output("gc")
})
sleep(ctx, time.Second*5, timeToFinalize, func() {
sleep(ctx, logInterval, timeToFinalize, func() {
output("finalizing")
}, func() {
cancel()
Expand Down

0 comments on commit 02b0b5f

Please sign in to comment.