godoc: fix quadratic and ASCII-only struct field linkification

Fixes two problems with adding the #StructType.FieldName anchors for
linkified struct fields:

* the old code was quadratic

* the old code only dealt with ASCII only

Change-Id: If03a367a94d05d3d470e1326dfb573037088ff78
Reviewed-on: https://go-review.googlesource.com/35486
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 files changed