Skip to content

Commit f31a6af

Browse files
committed
refactor asciiWordToInt
1 parent bc6a48b commit f31a6af

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

assert/assert.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -595,10 +595,10 @@ func combineArgs(format string, a []any) []any {
595595
func goid() int {
596596
var buf [64]byte
597597
runtime.Stack(buf[:], false)
598-
return myByteToInt(buf[10:])
598+
return asciiWordToInt(buf[10:])
599599
}
600600

601-
func myByteToInt(b []byte) int {
601+
func asciiWordToInt(b []byte) int {
602602
n := 0
603603
for _, ch := range b {
604604
if ch == ' ' {

assert/goid_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ func TestGoid(t *testing.T) {
1111
stackBytes := []byte(`goroutine 518 [running]:
1212
`)
1313

14-
id := myByteToInt(stackBytes[10:])
14+
id := asciiWordToInt(stackBytes[10:])
1515
if id != 518 {
1616
t.Fail()
1717
}
@@ -42,7 +42,7 @@ func BenchmarkGoid_MyByteToInt(b *testing.B) {
4242
`)
4343

4444
for n := 0; n < b.N; n++ {
45-
_ = myByteToInt(stackBytes[10:])
45+
_ = asciiWordToInt(stackBytes[10:])
4646
}
4747
}
4848

0 commit comments

Comments
 (0)