As you point out, finalizers are no longer in good grace in Java, not even in .NET, but lets leave that for another thread.
Hence why they are deprecated since Java 9, released in 2017, and a Cleaner queue should be used instead, or try-with-resources.
https://docs.oracle.com/javase/9/docs/api/java/lang/Object.h...
Basically runtime.AddCleanup() is the Go's version of java.lang.ref.Cleaner::register().
As you point out, finalizers are no longer in good grace in Java, not even in .NET, but lets leave that for another thread.
Hence why they are deprecated since Java 9, released in 2017, and a Cleaner queue should be used instead, or try-with-resources.
https://docs.oracle.com/javase/9/docs/api/java/lang/Object.h...
Basically runtime.AddCleanup() is the Go's version of java.lang.ref.Cleaner::register().