From 3588a77a863673724974e6c7235bc1a10d74d4bd Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Wed, 7 Jul 2021 17:22:34 -0700 Subject: [PATCH] field_presence.md: fix Go example (#8788) Go generated code does not have Has methods. Remove extraneous parentheses and semicolons. --- docs/field_presence.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/field_presence.md b/docs/field_presence.md index dc16292c851..b208c95beb8 100644 --- a/docs/field_presence.md +++ b/docs/field_presence.md @@ -313,12 +313,12 @@ No presence: ``` m := GetProto() -if (m.GetFoo() != 0) { +if m.Foo != 0 { // "Clear" the field: - m.Foo = 0; + m.Foo = 0 } else { // Default value: field may not have been present. - m.Foo = 1; + m.Foo = 1 } ``` @@ -326,12 +326,12 @@ Explicit presence: ``` m := GetProto() -if (m.HasFoo()) { +if m.Foo != nil { // Clear the field: m.Foo = nil } else { // Field is not present, so set it. - m.Foo = proto.Int32(1); + m.Foo = proto.Int32(1) } ```