1
0
mirror of https://github.com/golang/go synced 2024-09-30 18:28:32 -06:00

godoc: identifiers can contain underscores, not spaces.

Fixes golang/go#7382.

R=bradfitz, sameer
CC=golang-codereviews
https://golang.org/cl/67090043
This commit is contained in:
Brad Garcia 2014-02-21 19:51:15 -05:00
parent 29d0463c1c
commit 0cf8ab65b2

View File

@ -1201,7 +1201,7 @@ func (x *Index) lookupWord(w string) (match *LookupResult, alt *AltWords) {
// isIdentifier reports whether s is a Go identifier.
func isIdentifier(s string) bool {
for i, ch := range s {
if unicode.IsLetter(ch) || ch == ' ' || i > 0 && unicode.IsDigit(ch) {
if unicode.IsLetter(ch) || ch == '_' || i > 0 && unicode.IsDigit(ch) {
continue
}
return false