Skip to content

Commit

Permalink
godoc: correctly parse packages with digits in the package name
Browse files Browse the repository at this point in the history
Fixes golang/go#26514

Change-Id: I4540737425c225c0f0c6104b5b3524621d2b0c6f
GitHub-Last-Rev: 9d5fefb6ed31579b723293c7f43fcf677ac4cddb
GitHub-Pull-Request: golang/tools#41
Reviewed-on: https://go-review.googlesource.com/125335
Reviewed-by: Brad Fitzpatrick <[email protected]>
Run-TryBot: Brad Fitzpatrick <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
  • Loading branch information
zegl authored and bradfitz committed Jul 22, 2018
1 parent 2a1bbf9 commit 54dde6c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func parseRow(s string) (vr versionedRow, ok bool) {
return
}
rest := s[len("pkg "):]
endPkg := strings.IndexFunc(rest, func(r rune) bool { return !(unicode.IsLetter(r) || r == '/') })
endPkg := strings.IndexFunc(rest, func(r rune) bool { return !(unicode.IsLetter(r) || r == '/' || unicode.IsDigit(r)) })
if endPkg == -1 {
return
}
Expand Down
9 changes: 9 additions & 0 deletions versions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ func TestParseVersionRow(t *testing.T) {
name: "FileInfoHeader",
},
},
{
row: "pkg encoding/base32, method (Encoding) WithPadding(int32) *Encoding",
want: versionedRow{
pkg: "encoding/base32",
kind: "method",
name: "WithPadding",
recv: "Encoding",
},
},
}

for i, tt := range tests {
Expand Down

0 comments on commit 54dde6c

Please sign in to comment.