[go] reflect: use &zeroVal[0] instead of nil for data field for zero-sized payloads

0 views
Skip to first unread message

Keith Randall (Gerrit)

unread,
Feb 24, 2026, 11:51:22 PM (5 hours ago) Feb 24
to Keith Randall, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Keith Randall, Cherry Mui, Cuong Manh Le, Go LUCI, Ian Lance Taylor, golang-co...@googlegroups.com

Keith Randall submitted the change

Change information

Commit message:
reflect: use &zeroVal[0] instead of nil for data field for zero-sized payloads

Because our wrapper functions barf if the pointer is nil, even if
we don't actually dereference the pointer.

Fixes #77779
Change-Id: Ib1b93d9f0fdc771cd884137007508ba2b1da4b7a
Reviewed-by: Ian Lance Taylor <ia...@golang.org>
Reviewed-by: Cuong Manh Le <cuong.m...@gmail.com>
Reviewed-by: Cherry Mui <cher...@google.com>
Reviewed-by: Keith Randall <k...@google.com>
Files:
  • M src/reflect/value.go
  • A test/fixedbugs/issue77779.go
Change size: M
Delta: 2 files changed, 48 insertions(+), 2 deletions(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by Cherry Mui, +2 by Cuong Manh Le, +2 by Ian Lance Taylor, +1 by Keith Randall
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ib1b93d9f0fdc771cd884137007508ba2b1da4b7a
Gerrit-Change-Number: 748660
Gerrit-PatchSet: 2
Gerrit-Owner: Keith Randall <k...@golang.org>
Gerrit-Reviewer: Cherry Mui <cher...@google.com>
Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Keith Randall <k...@golang.org>
Gerrit-Reviewer: Keith Randall <k...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages