A focused look at the slog.Attr type in Go's standard library slog package. Covers the Attr struct (a key-value pair), the general-purpose Any constructor, and briefly introduces type-specific constructors like Bool, Duration, and Float64. Explains that Any works for all types but type-specific constructors avoid runtime type assertions.

1m read timeFrom boldlygo.tech
Post cover image
Table of contents
type Attrfunc Anyfunc Boolfunc Durationfunc Float64
23.4K Impressions