Fixes golang/go#9107 LGTM=nigeltao R=nigeltao CC=golang-codereviews, yliu https://golang.org/cl/177800043