Skip to content

slice的bug #2

Description

@soluty

在没有填任何值的时候,slice的字段应该返回nil或者长度为0的slice,现在的实现,会返回一个[ "" ],非常不自然,且不利于编写业务逻辑
具体代码在170行:
case reflect.Slice:
sep := ";"
s, exist := sf.Tag.Lookup("slice_sep")
if exist && s != "" {
sep = s
}
//我新加的
if ev == ""{
return nil
}
//我新加的 end
vals := strings.Split(ev, sep)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions