Go 1.24 new features

 The latest version, Go 1.24, is now available, bringing a range of useful new features for Go developers. On one hand, language tools have been further improved, with a more efficient implementation replacing the previous Map implementation. On the other hand, memory management has been enhanced thanks to the introduction of weak references and an improved memory allocator.

This new version introduces numerous updates, the full list of which can be found here. This article focuses on highlighting some of the most significant changes.

Generic type aliases

Go 1.24 expands the language’s type abstraction capabilities with generic type aliases. This means that if you have a complex generic type, you can create a simple alias for it, making your code significantly more readable: 

type ComparableVector[T comparable] = Vector[T]
type IntVector = ComparableVector[int] 

 This is especially useful when working with complex generic data structures, as it allows different APIs to expose simplified interface aliases. Additionally, the Go compiler now strictly enforces compatibility constraints between alias definitions and their target types, preventing subtle type system violations that could previously arise during code refactoring.

Weak reference

A new weak package introduces support for weak pointers to objects. Unlike traditional pointers, weak pointers do not prevent the garbage collector from deallocating an object, making it possible to develop large-scale caching solutions without causing memory leaks: 

import "weak"  

func main() {  
    obj := &MyStruct{data: 42}  
    wref := weak.NewRef(obj)  
    
    // Retrieve strong reference if available  
    if strong, ok := wref.Get(); ok {  
        use(strong)  
    }  
}  

 This mechanism is particularly useful when developing distributed systems, where object lifetimes must align with the availability of remote resources.

SwissTable Map implementation

A significant runtime improvement in Go 1.24 is the transition of the built-in Map type implementation to SwissTable, an open-addressed hash table. Compared to the previous closed-addressing approach, this change results in:

  • 35% faster insertions

  • 30% faster lookups

  • 60% faster iterations for large maps

Notably, this implementation can be disabled using GOEXPERIMENT=noswissmap.

Secure filesystem access

The new os.Root type enables secure filesystem access by preventing access to files outside a specified directory hierarchy. 

root := os.Root("/var/lib/app")
file, err := root.Open("data.txt") // Path resolved to /var/lib/app/data.txt 

 This feature is especially useful in scenarios such as web backend development or plugins, where restricting access to sensitive files (e.g., password files) is crucial. It ensures that the software can only access predefined file paths.

JSON omitzero

The new omitzero struct tag option provides a simple and effective way to omit zero-value fields in JSON serialization. 

type Event struct {
    CreatedAt time.Time `json:"created_at,omitzero"` 
    UpdatedAt time.Time `json:"updated_at,omitzero"`
}

In this struct, if UpdatedAt has the value "0001-01-01T00:00:00Z", the generated JSON will not include that field: 

{"created_at":"2025-02-24T20:13:00Z"} 

 Other important fixes

  • The improved memory allocator has reduced memory fragmentation by 18%.

  • The new go get -tool command automates version tracking of development tools, ensuring reproducible linting and analysis environments across teams.

  • New compiler directives improve C integration, enabling better optimization of C code snippets that do not call Go code. 

Share this post
Gemini Advanced Strengthens GitHub Integration
There is no shortage of innovation in the world of AI-based development tools. Google has now announced direct GitHub integration for its premium AI assistant, Gemini Advanced. This move is not only a response to similar developments by its competitor OpenAI, but also a significant step forward in improving developer workflows.
Apple Plans Its Own “Vibe-Coding” Platform in Partnership with Anthropic
Apple has encountered several challenges in developing its own AI solutions recently, so it’s perhaps unsurprising that the company is turning to external expertise. According to the latest reports, Apple has decided to join forces with Anthropic to create a revolutionary “vibe-coding” software platform that uses generative AI to write, edit, and test programmers’ code.
JetBrains Mellum Is Now Open Source
As of April 30, 2025, JetBrains has taken a major step forward in AI by open-sourcing Mellum, its custom language model for code completion. Previously available only in JetBrains’ commercial products, this 4-billion-parameter model is now freely accessible on Hugging Face, opening new doors for researchers, educators, and development teams.
Ten Times Faster After Rewriting the TypeScript Engine in Go
The TypeScript team has tried several times to rewrite the original JavaScript engine in a different programming language, but so far these attempts have not produced the desired results. Recently, however, they announced a breakthrough by rewriting it in Go.