Go: x/tools/cmd/godoc, x/pkgsite: package-scope exported variables display full source code of function bodies

Created on 23 Jul 2020  路  7Comments  路  Source: golang/go

For my package: https://github.com/rocketlaunchr/dataframe-go, the godoc page for Variables of func is ridiculous.

It is so ridiculous, I can't explain it in words here.

See: https://godoc.org/github.com/rocketlaunchr/dataframe-go/forecast/evaluation

/cc @dmitshur

NeedsInvestigation

Most helpful comment

I would ask everyone to tone down the rhetoric, please.

One possible solution is for godoc not to print function bodies. It could replace them with (say) /* body omitted */, much as unexported struct fields are omitted. (And the full contents could be shown in m=all mode, again like struct fields.)

All 7 comments

Why are those variables instead of functions? Assuming there is a reason, you can do this https://play.golang.org/p/TQsCdJPm2tB

Could you please provide an example or an explanation of what you expected to see on the documentation page?

I don't know how to improve the formatting but i'm sure the current state is ugly and too verbose.

Rather than changing the tooling, ISTM that the offending variable could be rewritten as a function and that would solve the issue.

@pjebs the docs are ugly because your code is ugly.

I would ask everyone to tone down the rhetoric, please.

One possible solution is for godoc not to print function bodies. It could replace them with (say) /* body omitted */, much as unexported struct fields are omitted. (And the full contents could be shown in m=all mode, again like struct fields.)

/cc @dmitshur

Was this page helpful?
0 / 5 - 0 ratings

Related issues

natefinch picture natefinch  路  3Comments

jayhuang75 picture jayhuang75  路  3Comments

longzhizhi picture longzhizhi  路  3Comments

enoodle picture enoodle  路  3Comments

Miserlou picture Miserlou  路  3Comments