go/doc/next/5-toolchain.md
John Bampton 29595ffeca doc: fix grammar and spelling
Minor typo fixes in the docs

Change-Id: I56b5d0318936aecc7775fb5bc70534456707da49
GitHub-Last-Rev: b4d042f8a997aa0d3824d8f9350dd24090b21073
GitHub-Pull-Request: golang/go#73531
Reviewed-on: https://go-review.googlesource.com/c/go/+/668815
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2025-04-29 07:37:04 -07:00

1.4 KiB

Compiler

The compiler and linker in Go 1.25 now generate debug information using DWARF version 5; the newer DWARF version reduces the space required for debugging information in Go binaries. DWARF 5 generation is gated by the "dwarf5" GOEXPERIMENT; this functionality can be disabled (for now) using GOEXPERIMENT=nodwarf5.

The compiler has been fixed to ensure that nil pointer checks are performed promptly. Programs like the following, which used to execute successfully, will now panic with a nil-pointer exception:

package main

import "os"

func main() {
	f, err := os.Open("nonExistentFile")
	name := f.Name()
	if err != nil {
		return
	}
	println(name)
}

This program is incorrect in that it uses the result of os.Open before checking the error. The main result of os.Open can be a nil pointer if the error result is non-nil. But because of a compiler bug, this program ran successfully under Go versions 1.21 through 1.24 (in violation of the Go spec). It will no longer run successfully in Go 1.25. If this change is affecting your code, the solution is to put the non-nil error check earlier in your code, preferably immediately after the error-generating statement.

Assembler

Linker