Comments (9)
That's working as intended, and a deliberate choice for proto3. You simply aren't supposed to differentiate fields explicitly set to their zero value from fields not touched at all.
from protobuf.
@dsymonds - unless I'm missing something, the README still refers to the generation of pointer fields. Is there somewhere with updated documentation for proto3?
from protobuf.
This seems the most relevant.
from protobuf.
I'll update the README to mention the difference.
from protobuf.
@dsymonds - thanks
from protobuf.
Documentation still says "Non-repeated fields are pointers to the values; nil means unset. That is, optional or required field int32 f becomes F *int32."
It it possible to specify that pointers be used. It really saves a lot of pain.
from protobuf.
The documentation could be clearer, but below the bullet point list it says:
When the .proto file specifies syntax="proto3", there are some differences:
Non-repeated fields of non-message type are values instead of pointers.
from protobuf.
I would love to hear an explanation of the design decision to no longer allow primitives to be expressed as pointers. There are many real world cases in which (for let's say, an int64) a 0
does not mean unset.
from protobuf.
I would love to hear an explanation of the design decision to no longer allow primitives to be expressed as pointers. There are many real world cases in which (for let's say, an int64) a
0
does not mean unset.
The Go team is not responsible for the protobuf language design. As such, we are unable to answer questions about motivation. Please redirect questions towards protocolbuffers/protobuf#1606
from protobuf.
Related Issues (20)
- encoding/protojson: unmarshalBytes assumes no padding if byte string length is not divisible by 4 HOT 27
- Service crash caused by encoding HOT 3
- structpb.Struct.MarshalJSON is not consistent HOT 4
- --gofast_out option in protoc discards inline comments from .proto files HOT 1
- How to redefine the json tag? HOT 2
- proto.Equal does not check for nested invalidity HOT 5
- A terrible work-around: HOT 2
- protoreflect x dynamicpb interaction: should descriptors match names or be pointer-identical?
- add proto.IsWellFormed helper function to validate that a message value is well-formed HOT 1
- google.protobuf.Empty as response serializes to not empty response depending on request headers HOT 2
- protocmp: Panic on embed message field comparison HOT 7
- Panic when use enum.String() before main() HOT 2
- Proposal: remove presumably unused purego support
- Why does deserialize []byte("xxxx") into a proto structure work? HOT 2
- proto: Export ErrInvalidUTF8 HOT 1
- type-safe Extensions API using Go Generics HOT 1
- Query on the using protobuf module HOT 3
- Slice of generated message structs is both empty and not empty at the same time HOT 3
- Incompatible API change between v1.33.0 and v1.34.0 HOT 7
- Why is .String() not configurable for generated pb models? forced to use prototext HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from protobuf.