Skip to content

Commit 3b9ff38

Browse files
committed
machine/usb/descriptor: avoid bytes package
We can't use the bytes package in Go 1.24 since it would result in an import cycle. Therefore, use bytealg.Index instead. (I'm not sure this code is correct - just searching for a range of bytes seems brittle. But at least this commit shouldn't change the code).
1 parent a3ba40c commit 3b9ff38

File tree

1 file changed

+2
-2
lines changed
  • src/machine/usb/descriptor

1 file changed

+2
-2
lines changed

src/machine/usb/descriptor/hid.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package descriptor
22

33
import (
4-
"bytes"
54
"errors"
65
"internal/binary"
6+
"internal/bytealg"
77
)
88

99
var configurationCDCHID = [configurationTypeLen]byte{
@@ -87,7 +87,7 @@ func FindClassHIDType(des, class []byte) (ClassHIDType, error) {
8787

8888
// search only for ClassHIDType without the ClassLength,
8989
// in case it has already been set.
90-
idx := bytes.Index(des, class[:ClassHIDTypeLen-2])
90+
idx := bytealg.Index(des, class[:ClassHIDTypeLen-2])
9191
if idx == -1 {
9292
return ClassHIDType{}, errNoClassHIDFound
9393
}

0 commit comments

Comments
 (0)