]> Cypherpunks repositories - gostls13.git/commit
go/doc: classify function returning slice of T as constructor
authorThomas Wanielista <tomwans@gmail.com>
Thu, 10 Aug 2017 22:39:18 +0000 (18:39 -0400)
committerRobert Griesemer <gri@golang.org>
Tue, 22 Aug 2017 08:09:42 +0000 (08:09 +0000)
commit33484a6ad23d3e4d4da6c80edbae4b2a0a75e84f
tree845248d472a75a743c54617acf058784e882a238
parentedaa0ffadb7e035089867a176f176b31af86761e
go/doc: classify function returning slice of T as constructor

Previously, go/doc would only consider functions that return types of
T or any number of pointers to T: *T, **T, etc. This change expands
the definition of a constructor to also include functions that return
slices of a type (or pointer to that type) in its first return.

With this change, the following return types classify a function
as a constructor of type T:

T
*T
**T (and so on)
[]T
[]*T
[]**T (and so on)

Fixes #18063.

Change-Id: I9a1a689933e13c6b8eb80b74ceec85bd4cab236d
Reviewed-on: https://go-review.googlesource.com/54971
Reviewed-by: Robert Griesemer <gri@golang.org>
src/go/doc/reader.go
src/go/doc/testdata/issue18063.0.golden [new file with mode: 0644]
src/go/doc/testdata/issue18063.1.golden [new file with mode: 0644]
src/go/doc/testdata/issue18063.2.golden [new file with mode: 0644]
src/go/doc/testdata/issue18063.go [new file with mode: 0644]