New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/tools/godoc: option to print only code #22663
Comments
The following might suffice, piping to awk instead of tail.
|
techically I think you want to output the godoc comment and function |
I know you can workaround this by stripping text with different utilities but I feel this is kinda off-topic since what is really wanted is a way to get the expected output from godoc itself and ensure that it doesn't happen in other places for some reason where you suddenly have 2 problems. |
not being the author of Go source code godoc comments followed by a function I would think that the current authors of such code sections could be able to clarify that there are not present any anomalies in such code sections |
/cc @andybons - Do we want something like this ? We can add another flag which suppresses the extra message, but not sure if it's worth the effort. |
It seems like a narrow use case to me, and the coder who opened this issue (based on his prompt) seems to be running bash, on a Unix-like OS or using a 'Git for Windows', either of which would typically accompany a GNU awk installation. I think adding an extra flag would simply clutter up the source code. |
It would seem weird for a documentation tool to offer an option to omit said documentation. I don't think this is within scope of godoc. You could create a tool in a rather straightforward way by making use of the stdlib go package. |
What did you do?
$ godoc -src fmt Printf
What did you expect to see?
What did you see instead?
It would be nice if the -src option also omitted the extra info (uncommented / plain-text in first line of second source-block) (or a default template changed to exclude it). Then we could use tools like
pygmentize
andchroma
to syntax-highlight source-code. Also it would just give a nice clean lookup of functions, which could be piped to other programs.There is an easy workaround with
godoc -src fmt Printf | tail -n +3
But without knowing entire go I'm not sure if there are other cases where it would show extra uncommented info. So I'm leaving this issue as an idea for improvement.
The text was updated successfully, but these errors were encountered: