Fixes #8347. LGTM=dave R=golang-codereviews, dave CC=golang-codereviews https://golang.org/cl/109600044