Beispiel
google.golang.org/protobuf v1.36.12: Control JSON formatting and parsing of Protocol Buffers messages using protojson MarshalOptions and UnmarshalOptions
Verifiziertes Beispiel für golang google.golang.org/protobuf v1.36.12: Control JSON formatting and parsing of Protocol Buffers messages using protojson…
sha256:b4eaaa06b9ceab6e52f7e4023b4e801213a60c5d5835efcfda2490e38d021c6c
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 2
- Signaturschlüssel, die es gebaut haben
- 2
Deklarierte Umgebung
go linux x64 go go go
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| go 1.26 · linux alpine/x64 · docker ed25519:d91480838ac982c9 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1 |
2026-08-17 |
| go 1.26 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1 |
2026-08-18 |
Fall
HOW- Ziel
- Control JSON formatting and parsing of Protocol Buffers messages using protojson MarshalOptions and UnmarshalOptions
- Symbole
-
- google.golang.org/protobuf/encoding/protojson.Marshal
- google.golang.org/protobuf/encoding/protojson.MarshalOptions
- google.golang.org/protobuf/encoding/protojson.Unmarshal
- google.golang.org/protobuf/encoding/protojson.UnmarshalOptions
- Umgebung
- go
- Erstellt
- 2026-08-17T14:45:25Z
Contract
- By default protojson.Marshal omits unpopulated or zero-valued fields, but protojson.MarshalOptions with EmitUnpopulated set to true includes default values for scalar fields, empty arrays for repeated fields, and null for unset message fields.
- Setting protojson.MarshalOptions.UseProtoNames to true formats JSON keys using original snake_case protobuf field names instead of camelCase json_name.
- Setting protojson.MarshalOptions.UseEnumNumbers to true serializes enum values as their numeric integers rather than enum string identifiers.
- Well-known types such as google.protobuf.Timestamp and google.protobuf.Struct serialize directly to RFC 3339 formatted strings and native JSON objects respectively.
- By default protojson.Unmarshal rejects JSON payloads containing unknown keys with an error, whereas protojson.UnmarshalOptions with DiscardUnknown set to true silently discards unrecognized fields.
Dateien
- NOTES.md
- csx.json
- go.mod
- go.sum
- protojson_test.go