go/doc/next/3-tools.md
Alan Donovan 702f164ed1 cmd/vet: add hostport analyzer
+ test, release note

Fixes #28308

Change-Id: I190e2fe513eeb6b90b0398841f67bf52510b5f59
Reviewed-on: https://go-review.googlesource.com/c/go/+/667596
Auto-Submit: Alan Donovan <adonovan@google.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-04-23 19:09:44 -07:00

1.3 KiB

Tools

Go command

The go build -asan option now defaults to doing leak detection at program exit. This will report an error if memory allocated by C is not freed and is not referenced by any other memory allocated by either C or Go. These new error reports may be disabled by setting ASAN_OPTIONS=detect_leaks=0 in the environment when running the program.

The new work package pattern matches all packages in the work (formerly called main) modules: either the single work module in module mode or the set of workspace modules in workspace mode.

When the go command updates the go line in a go.mod or go.work file, it no longer adds a toolchain line specifying the command's current version.

Cgo

Vet

The go vet command includes new analyzers:

  • waitgroup, which reports misplaced calls to [sync.WaitGroup.Add]; and
  • hostport, which reports uses of fmt.Sprintf("%s:%d", host, port) to construct addresses for [net.Dial], as these will not work with IPv6; instead it suggests using [net.JoinHostPort].