MCPcopy Index your code
hub / github.com/anacrolix/godo

github.com/anacrolix/godo @v1.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0.0 ↗ · + Follow
15 symbols 32 edges 2 files 2 documented · 13%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

godo

godo is an alternative to go run. It's useful when you want to avoid the go build/go install, /path/to/somebin cycle. There's also a bash completion script, which makes it easy to quickly invoke a Go package from your GOPATH.

godo differs from go run in the following respects:

  • The package to execute is specified by import path, rather than some constituent source files.
  • godo github.com/anacrolix/missinggo/cmd/nop vs.
  • go run $GOPATH/src/github.com/anacrolix/missinggo/cmd/nop/*.go
  • The generated binary is stored at $TMPDIR/godo/$pkgname.$$. This means that:
  • It's easy to locate the binary for a process running through godo.
  • The proctitle is $pkgname.$$, e.g. torrent.123, where the package name of the binary was torrent, and its PID is 123.
  • There is a bounded history of binaries due to the OS PID reuse policy. After PIDs cap at around 32K, they'll return to lower values, gradually replacing older binaries that are no longer associated with running processes.
  • The main package isn't rebuilt unnecessarily, avoiding a link step for successive godo calls to the same package. For example a go run invocation for a large application on my system has a mandatory ~0.8s delay even if the files haven't changed. godo has this at 0.04s, because it's able to reuse the existing binary.

Usage

$ godo -h
godo is an alternative to `go run`.

Usage:
  godo [go build flags] <package spec> [binary arguments]
  godo -h | --help

Example

# first run
$ time godo github.com/anacrolix/missinggo/cmd/nop

real    0m0.244s
user    0m0.177s
sys     0m0.071s

$ time godo github.com/anacrolix/missinggo/cmd/nop

real    0m0.046s
user    0m0.012s
sys     0m0.022s

# historical binaries
$ ls -tr $TMPDIR/godo/ | grep nop.
nop.40586
nop.40590

Installation

go install github.com/anacrolix/godo@latest

Bash completion:

go install github.com/anacrolix/godo/go-list-cmd@latest
. "$GOPATH/src/github.com/anacrolix/godo/complete.sh"

Godo-ception

$ godo github.com/anacrolix/godo cmd/go run "$GOPATH/src/github.com/anacrolix/godo/"*.go cmd/go list github.com/anacrolix/...
<all my herptastic Go code>

Core symbols most depended-on inside this repo

exeSuffix
called by 2
main.go
printCmds
called by 2
go-list-cmd/main.go
ExitCode
called by 1
main.go
processArgs
called by 1
main.go
installEnv
called by 1
main.go
buildEnv
called by 1
main.go
copyFile
called by 1
main.go
withWorkDir
called by 1
main.go

Shape

Function 13
Method 1
Struct 1

Languages

Go100%

Modules by API surface

main.go12 symbols
go-list-cmd/main.go3 symbols

For agents

$ claude mcp add godo \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact