Add an "embed" tag.

This commit is contained in:
Alec Thomas
2018-09-19 13:23:18 +10:00
parent 0ba159f97d
commit 54338bd8b1
5 changed files with 31 additions and 1 deletions
+2
View File
@@ -29,6 +29,7 @@ type Tag struct {
Group string
Vars Vars
Prefix string // Optional prefix on anonymous structs. All sub-flags will have this prefix.
Embed bool
// Storage for all tag keys for arbitrary lookups.
items map[string][]string
@@ -151,6 +152,7 @@ func parseTag(fv reflect.Value, ft reflect.StructField) *Tag {
t.Sep, _ = t.GetRune("sep")
t.Group = t.Get("group")
t.Prefix = t.Get("prefix")
t.Embed = t.Has("embed")
if t.Sep == 0 {
if t.Get("sep") == "none" {
t.Sep = -1