Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

not compatible with reflect.StructTag.Get

Tags:

go

I was working in Google CLoud and all was fine.. but when I clone all my project in my PC, I have this messages in every JSON struct.

struct field tag bson:"edad" json:"edad, omitempty" not compatible with reflect.StructTag.Get: suspicious space in struct tag valuestructtag

This is my Struct

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"`
}

What's wrong ?

Thanks

like image 913
Elba Nanero Avatar asked Jan 29 '20 02:01

Elba Nanero


1 Answers

struct field tag bson:"edad" json:"edad, omitempty" not compatible with reflect.StructTag.Get: suspicious space in struct tag valuestructtag

this is warning not error. you should still be able to run your project.

this error coused by space "bson:"password" json:"password, omitempty"" "bson:"password" json:"password,omitempty" (should be like this)

no space after comma. then it will work perfect.

like image 148
Pradip Parmar Avatar answered Sep 28 '22 12:09

Pradip Parmar