golang-guru(1)

Go source code guru

Section 1 golang-golang-x-tools bookworm source

Description

GOLANG-GURU

NAME

golang-guru - Go source code guru

SYNOPSIS

golang-guru [ flag ... ] mode position

DESCRIPTION

The mode argument determines the query to perform:

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

The position argument specifies the filename and byte offset (or range) of the syntax element to query. For example:

foo.go:#123,#128

bar.go:#123

The user manual is available here: http://golang.org/s/using-guru

OPTIONS

-cpuprofile

Write CPU profile to file.

-format format

Output format:

plain An editor-friendly format in which every line of output is of the form "pos: text", where pos is "-" if unknown. This is the default.

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 will be used in preference to those in the file system. In this way, a text editor may supply guru with the contents of its unsaved buffers. Each archive entry consists of the file name, a newline, the decimal file size, another newline, and the contents of the file.

-ptalog file

Write points-to analysis log to file.

-reflect

Analyze reflection soundly (slow).

-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 the scope

encoding/...,-encoding/xml

matches all encoding packages except encoding/xml.

-tags build_tags

A list of build tags to consider satisfied during the build. For more information 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

AUTHOR

This manual page was written by Michael Stapelberg <stapelberg@debian.org>, for the Debian project (and may be used by others).