All Projects → ryboe → Q

ryboe / Q

Licence: mit
Quick and dirty debugging output for tired Go programmers

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Labels

Projects that are alternatives of or similar to Q

Javafx Webview Debugger
Full Featured Google Chrome Dev Tools to JavaFX WebView browser debugging.
Stars: ✭ 45 (-96.31%)
Mutual labels:  debugger
Simavr
simavr is a lean, mean and hackable AVR simulator for linux & OSX
Stars: ✭ 1,135 (-6.97%)
Mutual labels:  debugger
Unidbg
Allows you to emulate an Android ARM32 and/or ARM64 native library, and an experimental iOS emulation
Stars: ✭ 1,168 (-4.26%)
Mutual labels:  debugger
Angrdbg
Abstract library to generate angr states from a debugger state
Stars: ✭ 49 (-95.98%)
Mutual labels:  debugger
Il Visualizer
.NET debugging visualiser for runtime-generated IL code (via DynamicMethod, etc) for VS2017 and VS2015
Stars: ✭ 56 (-95.41%)
Mutual labels:  debugger
Heartrate
Simple real time visualisation of the execution of a Python program.
Stars: ✭ 1,148 (-5.9%)
Mutual labels:  debugger
Hashlink Debugger
Visual Studio Code Debugger for Haxe/HashLink applications
Stars: ✭ 35 (-97.13%)
Mutual labels:  debugger
Oauth2 Oidc Debugger
An OAuth2 and OpenID Connect Debugger
Stars: ✭ 78 (-93.61%)
Mutual labels:  debugger
Basicpawn
BasicPawn - SourcePawn Editor
Stars: ✭ 60 (-95.08%)
Mutual labels:  debugger
Gleebug
Debugging Framework for Windows.
Stars: ✭ 1,168 (-4.26%)
Mutual labels:  debugger
Gdbgui
Browser-based frontend to gdb (gnu debugger). Add breakpoints, view the stack, visualize data structures, and more in C, C++, Go, Rust, and Fortran. Run gdbgui from the terminal and a new tab will open in your browser.
Stars: ✭ 8,339 (+583.52%)
Mutual labels:  debugger
Ios Sdk
AppSpector is a debugging service for mobile apps
Stars: ✭ 56 (-95.41%)
Mutual labels:  debugger
Netassistant
A UDP/TCP Assistant. 网络调试助手
Stars: ✭ 66 (-94.59%)
Mutual labels:  debugger
Pytest Pudb
Pytest PuDB debugger integration
Stars: ✭ 45 (-96.31%)
Mutual labels:  debugger
Winpdb
Fork of the official winpdb with improvements
Stars: ✭ 75 (-93.85%)
Mutual labels:  debugger
Vim Padre
Debugger plugin for VIM
Stars: ✭ 42 (-96.56%)
Mutual labels:  debugger
React Native Debugger
The standalone app based on official debugger of React Native, and includes React Inspector / Redux DevTools
Stars: ✭ 9,052 (+641.97%)
Mutual labels:  debugger
Rubyx
RubyX compiles ruby to binary (in ruby), hoping to be that X times faster
Stars: ✭ 78 (-93.61%)
Mutual labels:  debugger
Strongod
StrongOD(anti anti-debug plugin) driver source code.
Stars: ✭ 76 (-93.77%)
Mutual labels:  debugger
Anti Debug
Android detect debugger
Stars: ✭ 68 (-94.43%)
Mutual labels:  debugger

q

CircleCI Go Report Card PkgGoDev

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:

q output examples

Why is this better than fmt.Printf?

  • Faster to type
  • Pretty-printed vars and expressions
  • Easier to see inside structs
  • Doesn't go to noisy-ass stdout. It goes to $TMPDIR/q.
  • Pretty colors!

Basic Usage

import "q"
...
q.Q(a, b, c)

For best results, dedicate a terminal to tailing $TMPDIR/q while you work.

Install

git clone https://github.com/ryboe/q $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.

Editor Integration

VS Code

Preferences > User Snippets > Go

"qq": {
    "prefix": "qq",
    "body": "q.Q($1) // DEBUG",
    "description": "Pretty-print to $TMPDIR/q"
}

Sublime Text

Tools > Developer > New Snippet

<snippet>
    <content><![CDATA[
q.Q($1) // DEBUG
]]></content>
    <tabTrigger>qq</tabTrigger>
    <scope>source.go</scope>
</snippet>

Atom

Atom > Open Your Snippets

'.source.go':
    'qq':
        'prefix': 'qq'
        'body': 'q.Q($1) // DEBUG'

JetBrains GoLand

Settings > Editor > Live Templates

In Go, add a new template with:

  • Abbreviation: qq
  • Description: Pretty-print to $TMPDIR/q
  • Template text: q.Q($END$) // DEBUG
  • Applicable in: select the Go scope

Emacs

Add 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

vim

TBD Send me a PR, please :)

Haven't I seen this somewhere before?

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 :)

ping's PyCon 2013 lightning talk

FAQ

Why q.Q?

It's quick to type and unlikely to cause naming collisions.

Is q.Q() safe for concurrent use?

Yes.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].