You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package main
import (
"fmt"
"gopkg.in/mcuadros/go-defaults.v1"
)
func main() {
foo := &Parent{}
defaults.SetDefaults(foo)
fmt.Print(foo)
}
type Child struct {
Name string
Age int `default:"10"`
}
type Parent struct {
Children []Child
}
output: &{[]}
The text was updated successfully, but these errors were encountered:
pavankumar-bit
changed the title
Default value for slice of struct doesn't seem to be working for me
Default value for slice of struct isn't working for me
Oct 10, 2019
output: &{[]}
The text was updated successfully, but these errors were encountered: