Skip to content

Go 1.26 Modernization: Adopt new language and stdlib features in azd #7081

@spboyer

Description

@spboyer

Overview

With the migration to Go 1.26, several new language features, standard library additions, and performance improvements are available that can make azd faster, safer, and more readable.

Free Performance Wins (no code changes needed)

Simply building with Go 1.26 provides:

  • Green Tea GC (default in 1.26): 10–40% GC overhead reduction
  • Swiss Tables map implementation (1.24): 2–3% CPU reduction
  • io.ReadAll optimization (1.26): ~2x faster, lower memory
  • cgo overhead reduction (1.26): ~30% faster cgo calls
  • Stack-allocated slice backing (1.25/1.26): fewer heap allocations

Current State

The codebase is already well-modernized:

  • ✅ 266 usages of slices/maps packages
  • ✅ Zero ioutil usages (fully migrated)
  • errors.Join in use for multi-error scenarios
  • context.WithoutCancel used where appropriate
  • any used throughout (only 7 hand-written interface{} remain)

Sub-Issues

Quick Wins (trivial changes)

Standard Library Upgrades

New Go 1.25/1.26 Feature Adoption

Test Modernization

Future (require design discussion)

  • omitzero JSON struct tags
  • os.Root secure file access
  • slog structured logging (309 sites)
  • testing/synctest for retry/timeout tests

Analysis

Full analysis document with file-level details, code examples, and before/after comparisons is available in tmp/go-1.26-modernization-analysis.md in the repository.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions