Repolode
ryboe

ryboe/q

A Go debugging helper: type q.Q(vars) for pretty-printed output that goes to a log file in $TMPDIR instead of stdout.

Stars
1,542
Forks
69
Open issues
2
Last commit
13 days ago

What is it?

q is a small Go package for print-statement debugging. You call q.Q with variables or expressions, and it prints them in a readable, pretty-printed form that makes nested structs easier to inspect than fmt.Printf output.

Instead of writing to stdout, q appends its output to a file at $TMPDIR/q. The project suggests dedicating a terminal to tailing that file while you work, and provides shell functions (qq and rmqq) to start tailing or clear the log. Calls to q.Q are safe for concurrent use.

Editor snippets for VS Code, Zed, Sublime Text, GoLand, Emacs and Vim/NeoVim are included to insert q.Q calls quickly. The package is a Go port of the Python q module by zestyping.

Key features

  • 01Pretty-prints variables and expressions passed to q.Q.
  • 02Writes output to $TMPDIR/q instead of stdout.
  • 03Shell helpers qq and rmqq tail or clear the log file.
  • 04Safe for concurrent use.
  • 05Editor snippets for VS Code, Zed, Sublime Text, GoLand, Emacs and Vim.

Use cases

  • Quickly inspecting variable values and nested structs during Go debugging.
  • Tracing program state without cluttering the terminal output of a running program.

Quick start

  1. 1

    Clone the repository into your GOPATH

    git clone https://github.com/ryboe/q "$(go env GOPATH)"/src/q
  2. 2

    Import the package and call q.Q with your variables in your code

Things to know

  • Output goes to a log file, so you must watch $TMPDIR/q in a separate terminal to see it.

In collections

Topics

FAQ

What is q?
A Go debugging helper: type q.Q(vars) for pretty-printed output that goes to a log file in $TMPDIR instead of stdout. q is a small Go package for print-statement debugging. You call q.Q with variables or expressions, and it prints them in a readable, pretty-printed form that makes nested structs easier to inspect than fmt.Printf output.
Is q free to use? What license does it have?
q is open source under the MIT license. Check the license terms before using it in commercial products.
Is q still maintained?
Actively maintained. The last commit to q was on Oct 25, 2026.
What can I use q for?
Quickly inspecting variable values and nested structs during Go debugging. Tracing program state without cluttering the terminal output of a running program.
How do I install q?
Clone the repository into your GOPATH: git clone https://github.com/ryboe/q "$(go env GOPATH)"/src/q Import the package and call q.Q with your variables in your code
Where can I get q?
The source code and installation instructions are on GitHub: https://github.com/ryboe/q

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects