Go Experiments Explained
4 days ago
- #Web Development
- #Experimental Features
- #Go Language
- Experimental features in Go are released to gather user feedback before becoming permanent, with examples like testing/synctest in Go 1.24 and loop variable changes in Go 1.22.
- Experimental features can be off-by-default under evaluation, on hold due to negative feedback, or on-by-default with temporary opt-outs; some are permanent off-by-default features for specialized uses.
- GOEXPERIMENT environment variable controls enabling or disabling experiments, with comma-separated names for enabling and 'no' prefix for disabling on-by-default features.
- Key experiments for developers include GreenTeaGC for garbage collector improvements, JSONv2 for updated JSON handling, and GoroutineLeakProfile for debugging leaks.
- Tracking experiments requires checking go doc goexperiment.Flags and release notes, as there's no official documentation page; experimental features are not covered by Go's compatibility promise.