style: modernize to splitseq, cut, min, maps.copy and range-over-int

This commit is contained in:
2026-08-29 16:04:32 +02:00
parent eacf33d0f7
commit 9beff4ae85
40 changed files with 90 additions and 234 deletions
+3 -3
View File
@@ -150,7 +150,7 @@ REPL commands:
// Find the buffer size from the spec.
size := parseBufSize(*bufSpec, name)
// Length at offset+8, capacity at offset+16.
for j := 0; j < 8; j++ {
for j := range 8 {
argBlock[off+8+j] = byte(size >> (j * 8))
argBlock[off+16+j] = byte(size >> (j * 8))
}
@@ -260,7 +260,7 @@ REPL commands:
// Format: name:size:pattern[,name:size:pattern...]
func parseBufNames(spec string) []string {
var names []string
for _, part := range strings.Split(spec, ",") {
for part := range strings.SplitSeq(spec, ",") {
fields := strings.SplitN(part, ":", 3)
if len(fields) >= 1 && fields[0] != "" {
names = append(names, fields[0])
@@ -271,7 +271,7 @@ func parseBufNames(spec string) []string {
// parseBufSize extracts the size of a named buffer from a buffer specification.
func parseBufSize(spec, name string) int {
for _, part := range strings.Split(spec, ",") {
for part := range strings.SplitSeq(spec, ",") {
fields := strings.SplitN(part, ":", 3)
if len(fields) >= 2 && fields[0] == name {
var size int