Quick and dirty debugging output for tired Go programmers
Go
1,544
216 commits
updated Sep 13, 2026
q is a better way to do print statement debugging.
Type q.Q instead of fmt.Printf and your variables will be printed like this:

fmt.Printf?$TMPDIR/q.import "q"
...
q.Q(a, b, c)
For best results, dedicate a terminal to tailing $TMPDIR/q while you work.
git clone https://github.com/ryboe/q "$(go env GOPATH)"/src/q
Put these functions in your shell config. Typing qq or rmqq will then start
tailing $TMPDIR/q.
qq() {
clear
logpath="$TMPDIR/q"
if [[ -z "$TMPDIR" ]]; then
logpath="/tmp/q"
fi
if [[ ! -f "$logpath" ]]; then
echo 'Q LOG' > "$logpath"
fi
tail -100f -- "$logpath"
}
rmqq() {
logpath="$TMPDIR/q"
if [[ -z "$TMPDIR" ]]; then
logpath="/tmp/q"
fi
if [[ -f "$logpath" ]]; then
rm "$logpath"
fi
qq
}
You also can simply tail -f $TMPDIR/q, but it's highly recommended to use the above commands.
VS Code: Preferences > User Snippets > Go
Zed: ~/.config/zed/snippets/go.json
"qq": {
"prefix": "qq",
"body": "q.Q($1) // DEBUG",
"description": "Pretty-print to $TMPDIR/q",
}
Tools > Developer > New Snippet
<snippet>
<content><![CDATA[
q.Q($1) // DEBUG
]]></content>
<tabTrigger>qq</tabTrigger>
<scope>source.go</scope>
</snippet>
Settings > Editor > Live Templates
In Go, add a new template with:
qqPretty-print to $TMPDIR/qq.Q($END$) // DEBUGGo scopeAdd a new snippet file to the go-mode snippets directory
($HOME/.emacs.d/snippets/go-mode/qq). This should
contain:
# -*- mode: snippet -*-
# name: qq
# key: qq
# --
q.Q(${1:...}) // DEBUG
For SirVer/ultisnips, use :UltiSnipsEdit to add the new snippet:
snippet qq "qq"
q.Q(${1:})
${2}
endsnippet
Python programmers will recognize this as a Golang port of the
q module by zestyping.
Ping does a great job of explaining q in his awesome lightning talk from
PyCon 2013. Watch it! It's funny :)
q.Q?It's quick to type and unlikely to cause naming collisions.
q.Q() safe for concurrent use?Yes.
Overall
Maintained
Code review
Go module
Latest release
Releases this year
(top 24 of 36)
1,389 followers · starred Jan 2019
306 followers · starred Oct 2018
329 followers · starred Sep 2019
544 followers · starred Nov 2016
Quick and dirty debugging output for tired Go programmers
Go
1,544
216 commits
updated Sep 13, 2026
q is a better way to do print statement debugging.
Type q.Q instead of fmt.Printf and your variables will be printed like this:

fmt.Printf?$TMPDIR/q.import "q"
...
q.Q(a, b, c)
For best results, dedicate a terminal to tailing $TMPDIR/q while you work.
git clone https://github.com/ryboe/q "$(go env GOPATH)"/src/q
Put these functions in your shell config. Typing qq or rmqq will then start
tailing $TMPDIR/q.
qq() {
clear
logpath="$TMPDIR/q"
if [[ -z "$TMPDIR" ]]; then
logpath="/tmp/q"
fi
if [[ ! -f "$logpath" ]]; then
echo 'Q LOG' > "$logpath"
fi
tail -100f -- "$logpath"
}
rmqq() {
logpath="$TMPDIR/q"
if [[ -z "$TMPDIR" ]]; then
logpath="/tmp/q"
fi
if [[ -f "$logpath" ]]; then
rm "$logpath"
fi
qq
}
You also can simply tail -f $TMPDIR/q, but it's highly recommended to use the above commands.
VS Code: Preferences > User Snippets > Go
Zed: ~/.config/zed/snippets/go.json
"qq": {
"prefix": "qq",
"body": "q.Q($1) // DEBUG",
"description": "Pretty-print to $TMPDIR/q",
}
Tools > Developer > New Snippet
<snippet>
<content><![CDATA[
q.Q($1) // DEBUG
]]></content>
<tabTrigger>qq</tabTrigger>
<scope>source.go</scope>
</snippet>
Settings > Editor > Live Templates
In Go, add a new template with:
qqPretty-print to $TMPDIR/qq.Q($END$) // DEBUGGo scopeAdd a new snippet file to the go-mode snippets directory
($HOME/.emacs.d/snippets/go-mode/qq). This should
contain:
# -*- mode: snippet -*-
# name: qq
# key: qq
# --
q.Q(${1:...}) // DEBUG
For SirVer/ultisnips, use :UltiSnipsEdit to add the new snippet:
snippet qq "qq"
q.Q(${1:})
${2}
endsnippet
Python programmers will recognize this as a Golang port of the
q module by zestyping.
Ping does a great job of explaining q in his awesome lightning talk from
PyCon 2013. Watch it! It's funny :)
q.Q?It's quick to type and unlikely to cause naming collisions.
q.Q() safe for concurrent use?Yes.
Overall
Maintained
Code review
Go module
Latest release
Releases this year
(top 24 of 36)
1,389 followers · starred Jan 2019
306 followers · starred Oct 2018
329 followers · starred Sep 2019
544 followers · starred Nov 2016