Skip to content

Commit 2ffec59

Browse files
committed
fix: go 1.26 & ran go fix
1 parent a8f3c97 commit 2ffec59

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module github.com/rwxd/vmrss
22

3-
go 1.25
3+
go 1.26

main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ func getVmrssIOTotal(processes []processOutput) (float64, float64) {
224224

225225
func getVmrss(mainPid int, peakMemory map[int]float64, lastIO map[int][2]float64, elapsed float64) []processOutput {
226226
var outputs []processOutput
227-
arr := []interface{}{mainPid, 0}
227+
arr := []any{mainPid, 0}
228228

229229
for len(arr) > 0 {
230230
space := arr[len(arr)-1].(int)
@@ -311,7 +311,7 @@ func getProcessChildren(pid int) []int {
311311
}
312312

313313
var children []int
314-
for _, line := range strings.Split(strings.TrimSpace(string(output)), "\n") {
314+
for line := range strings.SplitSeq(strings.TrimSpace(string(output)), "\n") {
315315
if child, err := strconv.Atoi(line); err == nil {
316316
children = append(children, child)
317317
}
@@ -327,7 +327,7 @@ func findProcessByName(name string) ([]int, error) {
327327
}
328328

329329
var pids []int
330-
for _, line := range strings.Split(strings.TrimSpace(string(output)), "\n") {
330+
for line := range strings.SplitSeq(strings.TrimSpace(string(output)), "\n") {
331331
if line != "" {
332332
if pid, err := strconv.Atoi(line); err == nil {
333333
pids = append(pids, pid)
@@ -373,7 +373,7 @@ func getProcessIORate(pid int, lastIO map[int][2]float64, elapsed float64) (floa
373373
}
374374

375375
var readBytes, writeBytes float64
376-
for _, line := range strings.Split(string(content), "\n") {
376+
for line := range strings.SplitSeq(string(content), "\n") {
377377
fields := strings.Fields(line)
378378
if len(fields) >= 2 {
379379
val, _ := strconv.ParseFloat(fields[1], 64)

0 commit comments

Comments
 (0)