Go 1 25

Overview

Go 1.25, released in August 2025 with the latest stable version 1.25.6 (January 15, 2026), introduces experimental garbage collection improvements, a modernized JSON API, and better container deployment support.

Key Features

Green Tea GC (Experimental)

Experimental garbage collector reducing GC overhead by 10-40%:

# Build with Green Tea GC enabled
GOEXPERIMENT=greenteagc go build

# Run with Green Tea GC
GOEXPERIMENT=greenteagc go run main.go

Best for GC-heavy programs with high allocation rates.

encoding/json/v2 Packages

Major JSON API revision with three new packages:

import jsonv2 "encoding/json/v2"

type User struct {
    ID   int    `json:"id"`
    Name string `json:"name"`
}

// Marshal (encode)
user := User{ID: 1, Name: "Alice"}
data, err := jsonv2.Marshal(user)

// Unmarshal (decode)
var decoded User
err = jsonv2.Unmarshal(data, &decoded)

Improvements over v1:

  • Better error messages
  • Streaming API
  • Custom marshalers with context
  • Better performance

Container-Aware GOMAXPROCS

Automatically detects CPU quotas in containerized environments:

# Kubernetes deployment
resources:
  limits:
    cpu: "2" # Go 1.25 detects this automatically
  requests:
    cpu: "1"

No manual GOMAXPROCS setting needed:

// Go 1.25 behavior:
// - Physical machine: 64 CPUs
// - Container limit: 2 CPUs
// - GOMAXPROCS: 2 (automatically detected)

func main() {
    fmt.Printf("GOMAXPROCS: %d\n", runtime.GOMAXPROCS(0))
    // Output in container: GOMAXPROCS: 2
}

Standard Library Enhancements

// slices.Repeat: Repeat slice elements
import "slices"

repeated := slices.Repeat([]int{1, 2}, 3)
// Result: [1, 2, 1, 2, 1, 2]

// maps.Clone: Deep clone maps
import "maps"

original := map[string]int{"a": 1, "b": 2}
cloned := maps.Clone(original)

Current Version

Go 1.25.6 (released January 15, 2026) is the latest stable version.

References


Last Updated: 2026-02-04 Go Version: 1.25.x (latest stable)

Last updated