is tag value is blank, use nil instead

This commit is contained in:
Ulric Qin 2021-01-23 14:08:44 +08:00
parent c53a66d20e
commit 9c945b33fb
1 changed files with 5 additions and 1 deletions

View File

@ -288,7 +288,11 @@ func SplitTagsString(s string) (tags map[string]string, err error) {
for _, tag := range tagSlice {
tagPair := strings.SplitN(tag, "=", 2)
if len(tagPair) == 2 {
tags[tagPair[0]] = tagPair[1]
if tagPair[1] == "" {
tags[tagPair[0]] = "nil"
} else {
tags[tagPair[0]] = tagPair[1]
}
} else {
err = fmt.Errorf("bad tag %s", tag)
return