I just came across the same issue and thanks for your record, I just solve my problem. 在2013年1月29日星期二 UTC+8 12:38:31<Sonia Hamilton> 写道:
> * Sonia Hamilton <so...@snowfrog.net> [2013-01-29 12:42:34 +1100]: > > > How do I refer to a C struct field named 'type', given that 'type' is a > > reserved word in Go? For example, in this struct: > > > > > struct _GNetSnmpVarBind { > > > guint32 *oid; /* name of the variable */ > > > gsize oid_len; /* length of the name */ > > > GNetSnmpVarBindType type; /* variable type / exception */ > > > ... > > > }; > > > > For example, if the struct is referred to by data, > > fmt.Println(data.type) gives: > > Using the power of documentation, one finds [1]: > > > Within the Go file, C identifiers or field names that are keywords in > > Go can be accessed by prefixing them with an underscore: if x points > > at a C struct with a field named "type", x._type accesses the field > > [1] http://golang.org/cmd/cgo/ > > -- > Sonia Hamilton > http://www.snowfrog.net > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/c9597f9e-24ab-4dd1-9b46-245171b4f3b1n%40googlegroups.com.