GOLANG-GURU(1)

πŸ“¦ version 0.18.0, in debian bookworm, ubuntu jammy, ubuntu noble

✨ GOLANG-GURU ✨ β€” the Go source code guru, bestie edition

okay so welcome to golang-guru, aka the Go source code guru πŸ’… β€” it's a General Commands Manual page, which basically means it's the og documentation vibe. she reads your Go code and answers your questions about it. no cap. 🧚


πŸ¦‹ SYNOPSIS πŸ¦‹

golang-guru [ flag ...  ] mode position

πŸ’– DESCRIPTION πŸ’–

okay so first things first: that mode argument? she's the whole personality. she decides which query guru runs for you. here's the full lineup, no skips:

  • callees β€” show possible targets of selected function call
  • callers β€” show possible callers of selected function
  • callstack β€” show path from callgraph root to selected function
  • definition β€” show declaration of selected identifier
  • describe β€” describe selected syntax: definition, methods, etc
  • freevars β€” show free variables of selection
  • implements β€” show 'implements' relation for selected type or method
  • peers β€” show send/receive corresponding to selected channel op
  • pointsto β€” show variables the selected pointer may point to
  • referrers β€” show all refs to entity denoted by selected identifier
  • what β€” show basic information about the selected syntax node
  • whicherrs β€” show possible values of the selected error variable

and then there's the position argument 🫢 β€” she tells guru the filename and byte offset (or range, she's flexible like that) of the syntax element you wanna query. like, for example:

foo.go:#123,#128
bar.go:#123

also!! the user manual lives over here, go read it: http://golang.org/s/using-guru πŸ“–


🌈 OPTIONS 🌈

  • -cpuprofile β€” write CPU profile to file. that's it, that's the whole thing. πŸ“
  • -format format β€” output format, choose your fighter:
    • plain β€” an editor-friendly format where every line of output is of the form "pos: text", where pos is "-" if unknown. this one is the default. slay πŸ’…
    • json β€” structured data in JSON syntax
    • xml β€” structured data in XML syntax
  • -modified β€” read archive of modified files from standard input.
    • files in this archive get used in preference to those in the file system πŸ‘‘. the whole point is so a text editor can hand guru the contents of its unsaved buffers. the way this works: each archive entry is the file name, a newline, the decimal file size, another newline, and then the contents of the file. exactly that order, bestie, don't freestyle it.
  • -ptalog file β€” write points-to analysis log to file.
  • -reflect β€” analyze reflection soundly (slow). and yes she means slow, so go get a snack 🐌
  • -scope packages β€” comma-separated list of packages the analysis should be limited to. its value is a comma-separated list of patterns of these forms:
golang.org/x/tools/cmd/guru   # a single package
golang.org/x/tools/...        # all packages beneath dir
...                 # the entire workspace.

a pattern preceded by '-' is negative, so this scope:

encoding/...,-encoding/xml

matches all encoding packages except encoding/xml. the exclusion is giving gatekeeping but make it useful πŸ™ˆ

  • -tags build_tags β€” a list of build tags to consider satisfied during the build. for more info about build tags, see the description of build constraints in the documentation for the go/build package (default <tagsFlag>).

🌸 EXAMPLES 🌸

describe the syntax at offset 530 in this file (an import spec):

golang-guru describe src/golang.org/x/tools/cmd/guru/main.go:#530

look at her go πŸŽ€


πŸ’œ AUTHOR πŸ’œ

this manual page was written by Michael Stapelberg <stapelberg@debian.org>, for the Debian project (and may be used by others). iconic behavior, honestly πŸ’–


okay that's the whole page!! this version was living its best life on 2016-10-31 under the name GOLANG-GURU(1) β€” mwah, periodt βœ¨πŸ¦‹