Food for thought: GC-less Go build mode

I’ll go straight to the point - I was wondering if it would be possible to have a build mode that would remove GC and runtime and switch to manual memory management?

My vision is something similar to Odin, which passes a context object to every function call as last, hidden, argument, which contains allocators(standard and temp, with option to overwrite them) and other useful properties(logging…). So every make/append/new autmatically receives it as well, all the way down from the main(), unless overwritten for local memory arena use case and things like that.

Nothing has to change for the users except they now have to manually free allocated memory in their code, just like Odin does. Both support defer and Gophers are used to deferring calls already. A new “free” keyword would be needed and “delete” would have to change how it works in this mode. It’s very simple and effective, imo. Odin also has a debug allocator that will catch allocations that have not been freed, which can help with transition to this new mode.

I’m don’t do low-level/systems programming, but I fail to see how this would be too hard to add as a feature, as it would essentially just disable the native concurrency(goroutines and channels) and would just require better support for manual thread management so people can manually re-implement similar logic for concurrency. all of which can be achieved with build tags.

I think this could open up Go to a whole new world of usability, markets and domains - while preserving what we all like about Go, just with the performance turned to 11.

I’m aware that there is a keyword conflict with “context”, so that’s up for discussion and final implementation, so don’t get hang up on it as it is just a miniscule aspect of all of this.

Thoughts?