detached 2c367cd

fix: avoid strings.SplitSeq allocations on Go 1.24 and test Go 1.24 and stable in CI

commit
2c367cd215e821fd554d7cee0f2c4484c3eb7f1e
author
brice · · 2026-10-08 17:48 UTC
parent
455c41e
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
refs
tag: v0.1.0
2 files · +13 -5
M .github/workflows/ci.yml +6 -1
@@ -11,13 +11,18 @@ concurrency:
1111 jobs:
1212 check:
1313 runs-on: ubuntu-latest
14+ strategy:
15+ matrix:
16+ # The oldest supported Go and the newest: allocation behaviour
17+ # differs between compiler versions.
18+ go: ['1.24', stable]
1419 steps:
1520 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
1621 with:
1722 persist-credentials: false
1823 - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
1924 with:
20- go-version-file: go.mod
25+ go-version: ${{ matrix.go }}
2126 # dbus-daemon runs the integration tests against a private bus.
2227 - run: sudo apt-get update && sudo apt-get install -y --no-install-recommends dbus
2328 - run: test -z "$(gofmt -l .)"
@@ -11,13 +11,18 @@ concurrency:
11 jobs:11 jobs:
12 check:12 check:
13 runs-on: ubuntu-latest13 runs-on: ubuntu-latest
14+ strategy:
15+ matrix:
16+ # The oldest supported Go and the newest: allocation behaviour
17+ # differs between compiler versions.
18+ go: ['1.24', stable]
14 steps:19 steps:
15 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.120 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
16 with:21 with:
17 persist-credentials: false22 persist-credentials: false
18 - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v723 - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
19 with:24 with:
20- go-version-file: go.mod25+ go-version: ${{ matrix.go }}
21 # dbus-daemon runs the integration tests against a private bus.26 # dbus-daemon runs the integration tests against a private bus.
22 - run: sudo apt-get update && sudo apt-get install -y --no-install-recommends dbus27 - run: sudo apt-get update && sudo apt-get install -y --no-install-recommends dbus
23 - run: test -z "$(gofmt -l .)"28 - run: test -z "$(gofmt -l .)"
M wire.go +7 -4
@@ -161,12 +161,14 @@ func validInterface(s string) bool {
161161 if len(s) > 255 {
162162 return false
163163 }
164+ // strings.Cut, not SplitSeq: before Go 1.25 the iterator allocates.
164165 n := 0
165- for e := range strings.SplitSeq(s, ".") {
166+ for more := true; more; n++ {
167+ var e string
168+ e, s, more = strings.Cut(s, ".")
166169 if !validMember(e) {
167170 return false
168171 }
169- n++
170172 }
171173 return n >= 2
172174 }
@@ -182,7 +184,9 @@ func validBusName(s string) bool {
182184 s = s[1:]
183185 }
184186 n := 0
185- for e := range strings.SplitSeq(s, ".") {
187+ for more := true; more; n++ {
188+ var e string
189+ e, s, more = strings.Cut(s, ".")
186190 if e == "" || !unique && e[0] >= '0' && e[0] <= '9' {
187191 return false
188192 }
@@ -191,7 +195,6 @@ func validBusName(s string) bool {
191195 return false
192196 }
193197 }
194- n++
195198 }
196199 return n >= 2
197200 }
@@ -161,12 +161,14 @@ func validInterface(s string) bool {
161 if len(s) > 255 {161 if len(s) > 255 {
162 return false162 return false
163 }163 }
164+ // strings.Cut, not SplitSeq: before Go 1.25 the iterator allocates.
164 n := 0165 n := 0
165- for e := range strings.SplitSeq(s, ".") {166+ for more := true; more; n++ {
167+ var e string
168+ e, s, more = strings.Cut(s, ".")
166 if !validMember(e) {169 if !validMember(e) {
167 return false170 return false
168 }171 }
169- n++
170 }172 }
171 return n >= 2173 return n >= 2
172 }174 }
@@ -182,7 +184,9 @@ func validBusName(s string) bool {
182 s = s[1:]184 s = s[1:]
183 }185 }
184 n := 0186 n := 0
185- for e := range strings.SplitSeq(s, ".") {187+ for more := true; more; n++ {
188+ var e string
189+ e, s, more = strings.Cut(s, ".")
186 if e == "" || !unique && e[0] >= '0' && e[0] <= '9' {190 if e == "" || !unique && e[0] >= '0' && e[0] <= '9' {
187 return false191 return false
188 }192 }
@@ -191,7 +195,6 @@ func validBusName(s string) bool {
191 return false195 return false
192 }196 }
193 }197 }
194- n++
195 }198 }
196 return n >= 2199 return n >= 2
197 }200 }

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 3

↑↓ moveenter openesc close