field_presence.md: fix Go example (#8788)

Go generated code does not have Has methods.

Remove extraneous parentheses and semicolons.
pull/8801/head
Damien Neil 3 years ago committed by GitHub
parent d2c82dff39
commit 3588a77a86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      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)
}
```

Loading…
Cancel
Save