Skip to content

Instantly share code, notes, and snippets.

@elliot42
Created November 16, 2024 08:15
Show Gist options
  • Select an option

  • Save elliot42/51e911ec4cf3e9cf97ff66de19bae04e to your computer and use it in GitHub Desktop.

Select an option

Save elliot42/51e911ec4cf3e9cf97ff66de19bae04e to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"protoreflect/proto"
)
func main() {
msg := proto.Message{
Foo: "foo",
}
d := msg.ProtoReflect().Descriptor()
fmt.Println(d.Fields())
for i := 0; i < d.Fields().Len(); i++ {
fmt.Println(d.Fields().Get(i))
}
fmt.Println(msg)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment