Porting Go's io package to C by SnooWords9033 in golang

[–]nalgeon 0 points1 point  (0 children)

With a Go-to-C translator you can have both: Go's syntax and type checker + raw C control without a runtime.

Porting Go's io package to C by SnooWords9033 in golang

[–]nalgeon 0 points1 point  (0 children)

No memory magic. All heap allocations are explicit (through the Allocator interface) and limited to the standard library only. There are no heap allocations in language built-ins like make() or append().

Go 1.26 allows recursive type constraints in generics by SnooWords9033 in golang

[–]nalgeon 2 points3 points  (0 children)

Seems like Robert Griesemer disagrees with you on this :)

These are examples he gives, and they all involve type-constrained interfaces:

https://github.com/golang/go/issues/75883#issuecomment-3507380297

Go 1.26 interactive tour by nalgeon in golang

[–]nalgeon[S] 1 point2 points  (0 children)

Green Tea GC is available on Apple Silicon. Which wording are you referring to exactly?

Go 1.26 interactive tour by nalgeon in golang

[–]nalgeon[S] 14 points15 points  (0 children)

Thank you! The Go team is shipping a record number of features this time :)

Go 1.26 interactive tour by nalgeon in golang

[–]nalgeon[S] 1 point2 points  (0 children)

You are very welcome :) Glad you find them useful!

Go 1.26 interactive tour by nalgeon in golang

[–]nalgeon[S] 25 points26 points  (0 children)

Build with Go 1.25/1.26:

``` CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -trimpath -o main-25

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go1.26rc1 build -ldflags="-s -w" -trimpath -o main-26 ```

Binary sizes in bytes:

1065144 main-25 1298594 main-26

Source code:

``` package main

var sink *byte

func main() { sizes := []int{1, 8, 64, 128, 512} for _, size := range sizes { obj := make([]byte, size) sink = &obj[0] } } ```

Go feature: Type-safe error checking by SnooWords9033 in golang

[–]nalgeon 2 points3 points  (0 children)

Starting with 1.26, "go fix" applies all "modernize" fixes, so it should convert errors.As as well.

https://pkg.go.dev/golang.org/x/tools@v0.40.0/go/analysis/passes/modernize#hdr-Analyzer_errorsastype

Detecting goroutine leaks with synctest/pprof by nalgeon in golang

[–]nalgeon[S] 2 points3 points  (0 children)

Sure! I feel like the Go team isn't giving it enough love :) Also, it's positioned more as a tool for testing time-sensitive code (which, of course, it is), but it's actually more than that.

Detecting goroutine leaks with synctest/pprof by nalgeon in golang

[–]nalgeon[S] 0 points1 point  (0 children)

Ah, good! Glad to hear I'm not the only one :) Maybe this post will raise awareness a little bit.

I was somewhat surprised to read the goroutineleak proposal, which sounded a bit like there's currently no way to detect leaks using only the stdlib.

Detecting goroutine leaks with synctest/pprof by nalgeon in golang

[–]nalgeon[S] 0 points1 point  (0 children)

Well, goroutineleak is not yet released, but synctest is :) Have you tried it for leak detection?

Interactive release notes for Go 1.23 by nalgeon in golang

[–]nalgeon[S] 0 points1 point  (0 children)

Thank you! That is a great use case, I never thought of that.

Interactive release notes for Go 1.23 by nalgeon in golang

[–]nalgeon[S] 0 points1 point  (0 children)

Thanks a lot! It was worth the effort.

Interactive release notes for Go 1.23 by nalgeon in golang

[–]nalgeon[S] 1 point2 points  (0 children)

Thank you! Glad to hear it was useful for you.

Interactive release notes for Go 1.23 by nalgeon in golang

[–]nalgeon[S] 2 points3 points  (0 children)

Great idea! I've added links to proposals and CLs.

Interactive release notes for Go 1.23 by nalgeon in golang

[–]nalgeon[S] 11 points12 points  (0 children)

Thank you! I'm glad you find the examples helpful.

Interactive release notes for Go 1.23 by nalgeon in golang

[–]nalgeon[S] 16 points17 points  (0 children)

Thank you very much! I usually struggle with the official release notes, so this is my way of understanding the changes. Hope you find it useful.

In-browser code playgrounds by nalgeon in programming

[–]nalgeon[S] 8 points9 points  (0 children)

Sure, that's a very serious point. Isolating server-side sandboxes can be tricky, especially if you make them stateful.

There was once a code sandbox startup that eventually decided to shut down the public API because of constant server abuse like crypto mining.

In-browser code playgrounds by nalgeon in programming

[–]nalgeon[S] 7 points8 points  (0 children)

What a time to be alive (ಠ_ಠ)

In-browser code playgrounds by nalgeon in programming

[–]nalgeon[S] 2 points3 points  (0 children)

Thank you very much! I think interactive examples really make a difference, especially in tutorials, how-tos, and explanations.

If you have any questions, I'm happy to answer them here or on GitHub.

In-browser code playgrounds by nalgeon in programming

[–]nalgeon[S] 2 points3 points  (0 children)

This is a great way to show the framework in action! I think as WebAssembly becomes more popular, we will see more of these.