HackerTrans
TopNewTrendsCommentsPastAskShowJobs

aleksi

no profile record

comments

aleksi
·4 เดือนที่ผ่านมา·discuss
I was on this talk expecting to hear about MongoDB abusing open source (as you could guess from my profile, that’s a topic dear to my heart). Instead, I saw the most entertaining talk in my life.
aleksi
·5 เดือนที่ผ่านมา·discuss
Yet most, if not all, READMEs of official branches recommend using mutable vM tags. Not even branches — tags that they re-create.
aleksi
·5 เดือนที่ผ่านมา·discuss
See also https://github.com/golang/go/issues/66653 (that I don’t think is linked from the article)
aleksi
·6 เดือนที่ผ่านมา·discuss
You omit the fact that he took those words back and said “Crimea is Ukraine” while being in prison, knowing well it will not make his life (and death) easier
aleksi
·6 เดือนที่ผ่านมา·discuss
> What languages will be supported?

> As a real keyboard with the QWERTY layout, Communicator supports languages that use the Latin alphabet: [...] Russian

Weird
aleksi
·8 เดือนที่ผ่านมา·discuss
Aaaand it's gone!
aleksi
·10 เดือนที่ผ่านมา·discuss
You can make it run much better by increasing the game's process priority with `renice`. I know that sounds like something that should not work, but it does.
aleksi
·10 เดือนที่ผ่านมา·discuss
You are right; I stand corrected
aleksi
·10 เดือนที่ผ่านมา·discuss
> If you have a struct with a simple int field, and you store that somewhere as an *int, the entire struct and anything it points to will be kept alive.

While Go allows interior pointers, I don't think what you say is true. runtime.KeepAlive was added exactly to prevent GC from collecting the struct when only a field pointer is stored. Take a look at this blog post, for example: https://victoriametrics.com/blog/go-runtime-finalizer-keepal...
aleksi
·10 เดือนที่ผ่านมา·discuss
As a producer of the response, if I didn't care about being understood, I would use a made-up language. As a consumer, you may care about understanding my response, but you cannot do anything about it.
aleksi
·10 เดือนที่ผ่านมา·discuss
I think you missed the “any handler” part. Currently, the types that my library package could use depend on the handler used by the caller. This limits types to an unspecified subset, making things quite impractical.
aleksi
·10 เดือนที่ผ่านมา·discuss
1) The idea is that your library should accept the slog logger and use it. The caller would create a logger with a handler that defines how log messages are handled. But there are problems with supported types; see my other comments.

2) It is improved in 1.25. See https://github.com/golang/go/issues/59928 and https://pkg.go.dev/testing#T.Output. Now it is possible to update slogt to provide correct callsite – the stack depth should be the same.
aleksi
·10 เดือนที่ผ่านมา·discuss
My problem with that is that it makes it impossible to use slog logger safely without knowing what handler is being used. Which kind of defeats the purpose of defining the common structured logging interface.
aleksi
·10 เดือนที่ผ่านมา·discuss
Not sure I understand your sarcasm. I read the documentation, source code, handler writing guide, and issues in the Go repository multiple times over two years, and I use slog extensively. Go is my primary language since r60. I think I know how to read Go docs.

Now, please point me to the place in the documentation that says if I can or can't use a value implementing the error interface as an attribute value, and will the handler or something else would call the `Error() string` method.

My definition of "supported" is simple – I could pass a supported value to the logger and get a reasonable representation from any handler. In my example, the JSON handler does not provide it for the fmt.Stringer.
aleksi
·10 เดือนที่ผ่านมา·discuss
So clearly not all values are supported.

And I know that I can create a wrapper for unsupported types. My problem is exactly that – I don't know what types are supported. Is error supported, for example? Should I create a wrapper for it? And, as a handler author, should I support it directly or not?
aleksi
·10 เดือนที่ผ่านมา·discuss
Well, is fmt.Stringer supported? The result might surprise you:

  req := expvar.NewInt("requests")
  req.Add(1)
  
  attr := slog.Any("requests", req)
  
  slog.New(slog.NewTextHandler(os.Stderr, nil)).Info("text", attr)
  slog.New(slog.NewJSONHandler(os.Stderr, nil)).Info("json", attr)
This code produces

  time=2025-09-12T13:15:42.125+02:00 level=INFO msg=text requests=1
  {"time":"2025-09-12T13:15:42.125555+02:00","level":"INFO","msg":"json","requests":{}}
So the code that uses slog but does not know what handler will be used can't rely on it lazily calling the `String() string` method: half of the standard handlers do that, half don't.
aleksi
·10 เดือนที่ผ่านมา·discuss
My biggest gripe with slog is that there is no clear guidance on supported types of attributes.

One could argue that supported types are the ones provided by Attr "construct" functions (like slog.String, slog.Duration, etc), but it is not enough. For example, there is no function for int32 – does it mean it is not supported? Then there is slog.Any and some support in some handlers for error and fmt.Stringer interfaces. The end result is a bit of a mess.
aleksi
·11 เดือนที่ผ่านมา·discuss
I open-sourced my MongoDB alternative, and all I got was this lousy lawsuit.