← All releases

go1.19.0

Major

August 2, 2022

Go 1.19 is mostly a toolchain/runtime/library release: a new soft memory limit (GOMEMLIMIT), new atomic types, better doc-comment formatting, LoongArch and faster RISC-V support, plus security-hardening changes to PATH lookups and several crypto packages. Only one trivial language change; full backward compatibility maintained.

highlights
  • Only language change: a small fix to the scope of type parameters in method declarations (existing code unaffected)

  • New soft memory limit (GOMEMLIMIT / runtime/debug.SetMemoryLimit) works alongside GOGC to bound total runtime memory use

  • New sync/atomic types (atomic.Bool, Int32, Int64, Uint32, Uint64, Uintptr, Pointer[T]) give type-safe atomic access; Int64/Uint64 are now always 64-bit aligned

  • Go memory model revised to align with C/C++/Java/JS/Rust/Swift; Go still only offers sequentially consistent atomics

  • Doc comments now support links, lists, and clearer headings; gofmt reformats doc comments accordingly; new go/doc/comment package for parsing/rendering

  • New unix build constraint recognized in //go:build lines for Unix-like GOOS targets

  • New LoongArch (linux/loong64) port added; riscv64 now passes function args/results in registers for ~10%+ speedups

  • Compiler now generates jump tables for large integer/string switch statements, up to ~20% faster on amd64/arm64

  • os/exec Command and LookPath no longer resolve results relative to the current directory, closing a common PATH-lookup security hole (may break code relying on old behavior)

  • crypto changes: rand.Read no longer buffers OS randomness, crypto/elliptic now panics on invalid curve points, and x509.CreateCertificate rejects MD5 signatures and negative serial numbers

  • Race detector upgraded to ThreadSanitizer v3 on most platforms (faster, less memory, unlimited goroutines) and now supports GOARCH=s390x

  • go build now stamps -trimpath setting into binaries; go list -json accepts a field list to limit/speed up output