Skip to content

Commit 67da2c8

Browse files
committed
Fix lint error
1 parent 1edbcc9 commit 67da2c8

File tree

2 files changed

+19
-25
lines changed

2 files changed

+19
-25
lines changed

hack/benchmark/cpu_usage/auto_pause/chart.go

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -173,19 +173,19 @@ func execute() error {
173173

174174
var napCPU []plotter.XY
175175
for i := range napResults {
176-
napXPos := float64(i)-0.25
177-
napYPos := napResults[i]+0.1
176+
napXPos := float64(i) - 0.25
177+
napYPos := napResults[i] + 0.1
178178
napXY := plotter.XY{X: napXPos, Y: napYPos}
179179
napCPU = append(napCPU, napXY)
180180
}
181181
// CPU Busy% non-autopause data label
182182
napl, err := plotter.NewLabels(plotter.XYLabels{
183-
XYs: napCPU,
184-
Labels: napLabels,
185-
},
183+
XYs: napCPU,
184+
Labels: napLabels,
185+
},
186186
)
187187
if err != nil {
188-
log.Fatalf("could not creates labels plotter: %+v", err)
188+
return err
189189
}
190190

191191
// Set auto-pause data label to each bar
@@ -201,8 +201,8 @@ func execute() error {
201201

202202
var apCPU []plotter.XY
203203
for i := range apResults {
204-
apXPos := float64(i)+0.05
205-
apYPos := apResults[i]+0.1
204+
apXPos := float64(i) + 0.05
205+
apYPos := apResults[i] + 0.1
206206
apXY := plotter.XY{X: apXPos, Y: apYPos}
207207
apCPU = append(apCPU, apXY)
208208
}
@@ -213,12 +213,9 @@ func execute() error {
213213
},
214214
)
215215
if err != nil {
216-
log.Fatalf("could not creates labels plotter: %+v", err)
217-
}
218-
var t []plot.Tick
219-
for i := math.Trunc(0); i <= 300; i += 50 {
220-
t = append(t, plot.Tick{Value: i, Label: fmt.Sprint(i)})
216+
return err
221217
}
218+
222219
// define max cpu busy% to 20%
223220
p.Y.Max = 20
224221
p.Y.Tick.Marker = integerTicks{}
@@ -238,4 +235,4 @@ func execute() error {
238235
log.Printf("Generated graph png to %s/linux.png", FOLDER)
239236
}
240237
return nil
241-
}
238+
}

hack/benchmark/cpu_usage/idle_only/chart.go

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -130,24 +130,21 @@ func execute() error {
130130

131131
var xysCPU []plotter.XY
132132
for i := range results {
133-
rxPos := float64(i)-0.13
134-
ryPos := results[i]+0.1
133+
rxPos := float64(i) - 0.13
134+
ryPos := results[i] + 0.1
135135
cXY := plotter.XY{X: rxPos, Y: ryPos}
136136
xysCPU = append(xysCPU, cXY)
137137
}
138138
// CPU Busy% data label
139139
cl, err := plotter.NewLabels(plotter.XYLabels{
140-
XYs: xysCPU,
141-
Labels: cpuLabels,
142-
},
140+
XYs: xysCPU,
141+
Labels: cpuLabels,
142+
},
143143
)
144144
if err != nil {
145-
log.Fatalf("could not creates labels plotter: %+v", err)
146-
}
147-
var t []plot.Tick
148-
for i := math.Trunc(0); i <= 300; i += 50 {
149-
t = append(t, plot.Tick{Value: i, Label: fmt.Sprint(i)})
145+
return err
150146
}
147+
151148
// define max cpu busy% to 20%
152149
p.Y.Max = 20
153150
p.Y.Tick.Marker = integerTicks{}
@@ -167,4 +164,4 @@ func execute() error {
167164
log.Printf("Generated graph png to %s/linux.png", FOLDER)
168165
}
169166
return nil
170-
}
167+
}

0 commit comments

Comments
 (0)