Fixes #7550. LGTM=iant R=golang-codereviews, iant, josharian CC=golang-codereviews https://golang.org/cl/83520043