Skip to content

Commit cd716a9

Browse files
committed
Reserved Keywords
1 parent 5056a5f commit cd716a9

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,18 @@ protoc -I=proto --go_out=go proto/*.proto
8888
reserved "first_name"; // Reserved field name
8989
int32 id = 1;
9090
}
91-
```
91+
```
92+
93+
-----------
94+
95+
## Reserved Keywords
96+
- We can reserve `TAGS` and `FIELD NAMES`.
97+
- We can't mix `TAGS` and `FIELD NAMES` in the same `reserved` statement. For e.g.
98+
```proto
99+
// Correct way to use "reserved" keyword:
100+
message Message {
101+
reserved 2, 4, 15, 20 to 30;
102+
reserved "first_name", "last_name";
103+
}
104+
```
105+
- **Do not EVER remove any RESERVED tags!**

0 commit comments

Comments
 (0)