godoc and generic code

112 views
Skip to first unread message

Hotei

unread,
Nov 3, 2022, 7:49:29 AM11/3/22
to golang-nuts
I added some generic code to a project and godoc doesn't seem to like that and stops working when it sees the generics.  It's a 4 year old version of godoc so that's perhaps not a surprise.  What is a surprise is that godoc isn't shipped with go any longer.  Is there a version that handles generics and if so where can I find it?  A quick search of github came up empty but I know things have been moved around so some hints would be much appreciated.

Jan Mercl

unread,
Nov 3, 2022, 9:03:41 AM11/3/22
to Hotei, golang-nuts
On Thu, Nov 3, 2022 at 12:49 PM Hotei <hote...@gmail.com> wrote:

> I added some generic code to a project and godoc doesn't seem to like that and stops working when it sees the generics. It's a 4 year old version of godoc so that's perhaps not a surprise. What is a surprise is that godoc isn't shipped with go any longer. Is there a version that handles generics and if so where can I find it? A quick search of github came up empty but I know things have been moved around so some hints would be much appreciated.

I'm not in favor of the fact, but It's been deprecated a year ago:
https://github.com/golang/go/issues/49212

-j

Sebastien Binet

unread,
Nov 3, 2022, 9:32:09 AM11/3/22
to Jan Mercl, Hotei, golang-nuts
one can use godocs.io for a maintained "godoc-like" binary:

- https://godocs.io/go-hep.org/x/hep/sliceop
- https://sr.ht/~sircmpwn/godocs.io/

(otherwise, 'go doc' does support "generics")

hth,
-s

Hotei

unread,
Nov 3, 2022, 1:26:26 PM11/3/22
to golang-nuts
Thanks for the very helpful replies. < go doc -all pkg > should meets my needs for printed documentation.  I guess I will have to weigh the convenience of navigating which the godoc html version provides vs the inconvenience of "instantiating" the methods required by the types [T] I use in this project.  The pkgsite option doesn't seem workable in my case for the reasons eloquently described by one of the posters to issue 49212.  At any rate, problem solved and thanks again to the golang-nuts group for the assistance!

tapi...@gmail.com

unread,
Nov 4, 2022, 2:18:28 AM11/4/22
to golang-nuts
You may also try Golds: https://github.com/go101/golds.
Still not perfect in handling custom generic things,
but it is generally usable.

Marcel Huijkman

unread,
Nov 4, 2022, 3:13:47 AM11/4/22
to golang-nuts
Perhaps update godoc:
Reply all
Reply to author
Forward
0 new messages