与reflect.StructTag.Get不兼容

Elb*_*ero 10 go

我在 Google CLoud 工作,一切都很好……但是当我在我的 PC 中克隆我的所有项目时,我在每个 JSON 结构中都有这些消息。

struct 字段标记bson:"edad" json:"edad, omitempty"与reflect.StructTag.Get 不兼容:struct 标记值structtag 中存在可疑空间

这是我的结构

type Usuario struct {
    ID        bson.RawValue `bson:"_id" json:"id, omitempty"`
    Nombre    string        `bson:"nombre" json:"nombre, omitempty"`
    Apellidos string        `bson:"apellidos" json:"apellidos, omitempty"`
    Edad      int           `bson:"edad" json:"edad, omitempty"`
    Email     string        `bson:"email" json:"email"`
    Password  string        `bson:"password" json:"password, omitempty"`
}
Run Code Online (Sandbox Code Playgroud)

怎么了 ?

谢谢

小智 18

struct field tag bson:"edad" json:"edad, omitempty" 与reflect.StructTag.Get不兼容:struct tag valuestructtag中的可疑空间

这是警告不是错误。您应该仍然能够运行您的项目。

这个错误是由空格“ bson:"password" json:"password, omitempty"”“引起的bson:"password" json:"password,omitempty" (应该是这样的)

逗号后没有空格。那么它将完美地工作。