The example at https://pkg.go.dev/log/slog#Group does not compile as it uses an internal package ("log/slog/internal/slogtest").
Output:
package play
prog.go:5:2: use of internal package log/slog/internal/slogtest not allowed
The example is located here: https://github.com/golang/go/blob/master/src/log/slog/example_test.go
It also looks like the examples allow the use of internal packages which might be worth a more general design discussion.
Comment From: seankhliao
cc @jba
Comment From: jba
This was a deliberate decision: we preferred factoring out common code to making the examples playable. We could revisit.
/cc @adonovan
Comment From: henvic
I also agree that revisiting it would be a nice idea as a lot of people learn by using examples as references, and this might be confusing to newcomers.
Comment From: gopherbot
Change https://go.dev/cl/536215 mentions this issue: slog: factoring out code to make the examples playable
Comment From: AlekSi
That one seems to be resolved.
Comment From: seankhliao
done in CL 536215