Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // GetStructModifiableFields returns an array of field names that do not have a
- // readonly:"true" struct tag
- func GetStructModifiableFields(s interface{}) (fields []reflect.StructField) {
- structFields := reflect.VisibleFields(reflect.TypeOf(s))
- for _, f := range structFields {
- if f.Tag.Get("readonly") != "true" {
- fields = append(fields, f)
- }
- }
- return
- }
Advertisement