Damien Neil

Results 208 comments of Damien Neil

The compatibility promise for generated code is here: https://pkg.go.dev/google.golang.org/protobuf#section-readme > Users should use generated code produced by a version of [protoc-gen-go](https://pkg.go.dev/google.golang.org/protobuf/cmd/protoc-gen-go) that is identical to the runtime version provided by...

I'm afraid there is not. See also: https://developers.google.com/protocol-buffers/docs/reference/go/faq#custom-code > ### Can I customize the code generated by protoc-gen-go? > In general, no. Protocol buffers are intended to be a language-agnostic...

It is now possible to do this via protobuf reflection: ```go var e somepb.Enum val := e.Descriptor().Values().ByName("VALUE_NAME") e = (somepb.Enum)(val.Number()) ``` While verbose, manipulating enum values by name is a...

> It is appropriate for the module itself to disable instability because this module fully controls every aspect of how the output is produced. It is not appropriate for users...

There is unquestionably value in stable output. However, the value is only there if the output truly is stable. Incidental stability, where output appears stable but can change unexpectedly in...

Protobuf repeated fields don't have a concept of presence, so there is no distinction between a zero-length repeated field and an unset repeated field. I'm afraid there is no way...

`fieldGoType` is super fiddly, and not a good choice for exporting as-is. For example, it returns `("int32", true)` for a `proto2` `int32` field (the bool indicating that the field is...

The `protojson` package follows the standard JSON mapping defined here, which states that 64-bit ints are encoded as a JSON string: https://developers.google.com/protocol-buffers/docs/proto3#json Changing the standard mapping is out of scope...

See also: https://developers.google.com/protocol-buffers/docs/reference/go/faq#new-marshal-option > ### Can I add an option to Marshal or Unmarshal to customize it? > Only if that option exists in other implementations (e.g., C++, Java). The...

If we were to support applying a field mask to JSON marshaling, then we should also support it for text and binary marshaling. We should also consider supporting it for...