Fixes golang/go#9151. LGTM=crawshaw R=crawshaw, nathan.behary CC=golang-codereviews https://golang.org/cl/180160043