Open mark-summerfield opened 1 year ago
I tried adding these lines after main() {
:
logger := slog.New(slog.NewTextHandler(os.Stderr, nil))
slog.SetDefault(logger)
but they didn't help.
But if I comment out the bodies of the functions Debug, Info, Warn, Error, Critical, Fatal
in file oss.terrastruct.com/d2@v0.6.0/lib/log/log.go
, then everything works fine. (Well apart from no logging of course!)
@mark-summerfield i think this is because slog made backward-incompatible changes without a major version bump. can you try changing your go.mod
's slog version to the one in D2? https://github.com/terrastruct/d2/blob/master/go.mod#L6
searching around, there's no way for us to lock onto that version =. it's a todo to replace it
cc @nhooyr
I tried replacing in go.mod
with this as you suggested:
require cdr.dev/slog v1.4.2
It didn't work at first, but then I deleted go.sum
, did a go get
and now it works fine.
Thank you.
I don't want to close the issue though because surely it ought to be fixed?
oh right you have to do go mod tidy
after making that change.
And yes, it ought to be fixed, will use this issue to track -- ty!
I'm using Go 1.20.7 on Debian 11. I am using the example https://github.com/terrastruct/d2/tree/master/docs/examples/lib/1-d2lib Here's the output when I try
go run .
: