Syntax 变量声明后的Go字符串

Syntax 变量声明后的Go字符串,syntax,go,Syntax,Go,看一看这个在 在int之后?这是什么意思?谢谢。这是一个结构标签。库使用这些来用额外的信息注释结构字段;在这种情况下,模块使用这些结构标记来表示哪些标记对应于结构字段。这意味着变量将出现在人名示例中 type sample struct { dateofbirth string `xml:"dob"` } In the above example, the field 'dateofbirth' will present in the name of 'dob' in the XML

看一看这个在


在int之后?这是什么意思?谢谢。

这是一个结构标签。库使用这些来用额外的信息注释结构字段;在这种情况下,模块使用这些结构标记来表示哪些标记对应于结构字段。

这意味着变量将出现在人名示例中

type sample struct {
     dateofbirth string `xml:"dob"`
}

In the above example, the field 'dateofbirth' will present in the name of 'dob' in the XML.
您将在go结构中经常看到这种表示法

xml:"person"
type sample struct {
     dateofbirth string `xml:"dob"`
}

In the above example, the field 'dateofbirth' will present in the name of 'dob' in the XML.