GOLANG-GURU(1)
β¨ 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 callcallersβ show possible callers of selected functioncallstackβ show path from callgraph root to selected functiondefinitionβ show declaration of selected identifierdescribeβ describe selected syntax: definition, methods, etcfreevarsβ show free variables of selectionimplementsβ show 'implements' relation for selected type or methodpeersβ show send/receive corresponding to selected channel oppointstoβ show variables the selected pointer may point toreferrersβ show all refs to entity denoted by selected identifierwhatβ show basic information about the selected syntax nodewhicherrsβ 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", whereposis"-"if unknown. this one is the default. slay πjsonβ structured data in JSON syntaxxmlβ 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 thego/buildpackage (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 β¨π¦
π¦ where this page comes from
- debian bookworm: golang-golang-x-tools 1:0.5.0+ds-1 Β· BSD-3-Clause
- ubuntu jammy: golang-golang-x-tools 1:0.1.9+ds-2ubuntu2 Β· BSD-3-Clause
- ubuntu jammy: golang-golang-x-tools 1:0.1.9+ds-2ubuntu2.2 Β· BSD-3-Clause
- ubuntu noble: golang-golang-x-tools 1:0.18.0+ds-1 Β· BSD-3-Clause
- ubuntu noble: golang-golang-x-tools 1:0.18.0+ds-1ubuntu0.24.04.3 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms