mold icon indicating copy to clipboard operation
mold copied to clipboard

Add support for "dive,keys,…,endkeys,dive"

Open powerman opened this issue 4 years ago • 1 comments

Use case:

type A struct {
    M map[string]*B `mod:"dive"` // WANTED: `mod:"dive,keys,trim,endkeys,dive"`
}
type B struct {
    S string `mod:"trim"`
}

With "dive" on M it will process "trim" on S, but won't process map keys. With "dive,keys,trim,endkeys" on M it will process map keys but won't process "trim" on S. And the WANTED string result in an error "invalid dive tag configuration".

powerman avatar Feb 12 '21 14:02 powerman

To work around this issue add any other tag after endkeys - it won't do anything except make dive works. E.g.:

type A struct {
    M map[string]*B `mod:"dive,keys,trim,endkeys,default"`
}

powerman avatar May 18 '22 12:05 powerman