mercredi 6 juillet 2022

Golang: Validate tags at compile time

I have written a custom tag reader using reflect package. Example:

type SomeStruct struct {
    Var1 customType `customTag:"prop1:hello;prop2:0.15,0.1;prop3:0.15=2,3=4.1"`
}

The tags are written in a specific format for my custom tag reader. I would like to catch problems (if any) in the tags at the compile itself. How can I achieve that?





Aucun commentaire:

Enregistrer un commentaire