-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
https://protobuf.dev/programming-guides/encoding#packed
using this file:
package main
import (
"google.golang.org/protobuf/testing/protopack"
"os"
)
func main() {
inBytes := protopack.Message{
protopack.Tag{3, protopack.BytesType}, protopack.LengthPrefix{
protopack.Float32(1.1),
protopack.Float32(2.2),
protopack.Float32(3.3),
},
}.Marshal()
os.WriteFile("packed.bin", inBytes, 0666)
}https://google.golang.org/protobuf/testing/protopack#Message.Marshal
if I try to scan:
package main
import (
"github.com/protocolbuffers/protoscope"
"os"
)
func main() {
inBytes, err := os.ReadFile("packed.bin")
if err != nil {
panic(err)
}
scanner := protoscope.NewScanner(string(inBytes))
if _, err := scanner.Exec(); err != nil {
panic(err)
}
}I get this result:
panic: unrecognized symbol "\x1a\f\xcď?\xcd\xcc\f@33S@"
the tool works:
> protoscope packed.bin
3: {`cdcc8c3fcdcc0c4033335340`}
but neither the module or tool seem to have an option for dealing with this. I check WriterOptions but didn't see anything:
https://pkg.go.dev/github.com/protocolbuffers/protoscope#WriterOptions
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed