Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
2e90e542
Commit
2e90e542
authored
Oct 30, 2008
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- language for struct field tags
DELTA=17 (15 added, 0 deleted, 2 changed) OCL=18177 CL=18184
parent
dc6bd11c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
go_spec.txt
doc/go_spec.txt
+17
-2
No files found.
doc/go_spec.txt
View file @
2e90e542
...
...
@@ -4,7 +4,7 @@ The Go Programming Language Specification (DRAFT)
Robert Griesemer, Rob Pike, Ken Thompson
----
(October
28
, 2008)
(October
30
, 2008)
This document is a semi-formal specification of the Go systems
...
...
@@ -1094,7 +1094,8 @@ identifier may be declared twice and all field types must be complete
types (§Types).
StructType = "struct" [ "{" [ List<FieldDecl> ] "}" ] .
FieldDecl = IdentifierList CompleteType | TypeName .
FieldDecl = (IdentifierList CompleteType | TypeName) [ Tag ] .
Tag = string_lit .
// An empty struct.
struct {}
...
...
@@ -1135,6 +1136,20 @@ Fields and methods (§Method declarations) of an anonymous field become directly
accessible as fields and methods of the struct without the need to provide the
type name of the respective anonymous field (§Selectors).
A field declaration may be followed by an optional string literal tag which
becomes an ``attribute'' for all the identifiers in the corresponding
field declaration. The tags are available via the reflection library but
are ignored otherwise. A tag may contain arbitrary application-specific
information (for instance protocol buffer field information).
// A struct corresponding to the EventIdMessage protocol buffer.
// The tag strings contain the protocol buffer field tags.
struct {
time_usec uint64 "1";
server_ip uint32 "2";
process_id uint32 "3";
}
Forward declaration:
A struct type consisting of only the reserved word "struct" may be used in
a type declaration; it declares an incomplete struct type (§Type declarations).
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment