Yuki Iwanaga

Results 10 comments of Yuki Iwanaga

```go // Doesn't even work with: type Parent struct { children []Child `default:"[]"` } // or this: type Parent struct { children []Child `default:"[{}]"` } ```

Interesting idea

Thank you for suggesting a testing library along the way. However, it's better to keep the focus of PR on one thing at a time and we should discuss it...

As for the error, https://github.com/golangci/golangci-lint/discussions/1920 might be the case.

> `func (d *Duration) SetTaggedDefaults(tag string) (err error) {` I would utilize https://pkg.go.dev/encoding/json#Unmarshaler or https://pkg.go.dev/encoding#TextUnmarshaler interfaces instead.

An underlying type of [time.Duration](https://pkg.go.dev/time#Duration) is int64. Therefore, you need to specify integer values (in nanoseconds) such that: ```go type MyStruct struct { BackoffPolicy []time.Duration `default:"[10000000000,60000000000]"` // 10s, 1m }...

> Here - https://github.com/creasty/defaults/blob/master/defaults.go#L86 code is trying to parse string and in test file i can find Ahhh... Thanks, I'll fix that test code later!

Sorry for the oversight! Reading over the discussion again, I recognize that I missed the point. I had a lapse in memory regarding supporting the string representation of Duration, leading...

https://github.com/creasty/defaults/releases/tag/v1.8.0 published.

We'd like to utilize [Lookup()](https://pkg.go.dev/reflect#StructTag.Lookup) here to exclude fields without a tag, and then change shouldInitializeField to return true at the end. https://github.com/creasty/defaults/blob/abebf4bedce8cd6aa1b52cda5a9bc870aa15084d/defaults.go#L36