Go implementation of the Rust `dbg` macro

Overview

godbg 🐛 Build Status

godbg is an implementation of the Rust2018 builtin debugging macro dbg.

The purpose of this package is to provide a better and more effective workflow for people who are "print debuggers".

go get github.com/tylerwince/godbg

The old way:

package main

import "fmt"

func main() {
    a := 1
    fmt.Printf("My variable: a is equal to: %d", a)
}

outputs:

My variable: a is equal to: 1

The new (and better) way

package main

import . "github.com/tylerwince/godbg"

func main() {
    a := 1
    Dbg(a)
}

outputs:

[main.go:7] a = 1

This project is a work in progress and all feedback is appreciated.

The next features that are planned are:

  • Tests
  • Fancy Mode (display information about the whole callstack)
  • Performance Optimizations
  • Typing information
Issues
  • use LastIndex and compare with benchmarks

    use LastIndex and compare with benchmarks

    This package is awesome! I will certainly use it 😄 .

    To (hopefully) assist with clarity, I've replaced the entire reverse function calls and utilized strings.LastIndex() instead.
    There are also a couple of simple benchmarks to demonstrate the change. Here's how they look on my machine...

    BenchmarkWithReverse-4          10000000               193 ns/op               0 B/op          0 allocs/op
    BenchmarkWithLastIndex-4        200000000                9.61 ns/op            0 B/op          0 allocs/op
    

    Also made a minor typo fix to the comment on the exported API.

    Hope this helps a little! If not, it's still really cool and I plan to utilize the lib!

    opened by Guitarbum722 1
  • Alternative library

    Alternative library

    Great tool!

    Not sure if you have seen, but something similar is going on here, maybe you could borrow some ideas if you see something interesting: https://github.com/y0ssar1an/q

    opened by sagikazarmark 1
Owner
Tyler Wince
SVP Product @myndshft
Tyler Wince
XSD (XML Schema Definition) parser and Go/C/Java/Rust/TypeScript code generator

xgen Introduction xgen is a library written in pure Go providing a set of functions that allow you to parse XSD (XML schema definition) files. This li

null 162 Jun 20, 2022
An online Zig compiler inspired by Go and Rust

Zig Playground This is a rudimentary online compiler for the Zig programming language. It is inspired by the Go playground. Setup The main server is a

Garrett Squire 40 Jun 16, 2022
CodePlayground is a playground tool for go and rust language.

CodePlayground CodePlayground is a playground tool for go and rust language. Installation Use homebrews to install code-playground. brew tap trendyol/

Trendyol Open Source 47 Mar 5, 2022
Go specs implemented as a scripting language in Rust.

Goscript A script language like Python or Lua written in Rust, with exactly the same syntax as Go's. The Goal Runs most pure Go code, probably add som

null 1.3k Jun 20, 2022
Slabmap - Ported from Rust library slabmap

slabmap Ported from Rust library slabmap Examples import "github.com/pourplusquo

Yang Pan 2 Feb 4, 2022
Swagger 2.0 implementation for go

Swagger 2.0 This package contains a golang implementation of Swagger 2.0 (aka OpenAPI 2.0): it knows how to serialize and deserialize swagger specific

Go Swagger 7.7k Jun 21, 2022
Functional programming library for Go including a lazy list implementation and some of the most usual functions.

functional A functional programming library including a lazy list implementation and some of the most usual functions. import FP "github.com/tcard/fun

Toni Cárdenas 31 May 21, 2022
Go implementation of the XDG Base Directory Specification and XDG user directories

xdg Provides an implementation of the XDG Base Directory Specification. The specification defines a set of standard paths for storing application file

Adrian-George Bostan 229 Jun 25, 2022
Simple Client Implementation of WebFinger

Go-Webfinger Go client for the Webfinger protocol Go-Webfinger is a Go client for the Webfinger protocol. *It is a work in progress, the API is not fr

Antoine Imbert 14 Jun 23, 2022
An example client implementation written in GO to access the CyberVox platform API

About This is an example client implementation written in GO to access the CyberVox platform API.

Cyberlabs AI 16 May 11, 2021
An implementation of standard generics APIs in Go.

generics This package shows an implementation outlook of proposed generics APIs import "changkun.de/x/generics" Related issues: golang/go#45458 golang

Changkun Ou 26 Mar 3, 2022
a quick golang implementation of google pubsub subscriber for testing with the emulator.

gosub a quick golang implementation of google pubsub subscriber for testing with the emulator. it does one thing which is subscribing to a topic and r

Nam Pham 1 Oct 23, 2021
Go implementation Welford’s method for one-pass variance computation

Variance and standard deviation caluculation using variance's algorithm Table of Contents Introduction Installation Usage Contributing License Introdu

Axiom, Inc. 7 Jun 5, 2022
Go implementation of Donald Knuth's Algorithm 7.2.2.1C for exact cover with colors.

go-dlx Go implementation of Donald Knuth's Algorithm 7.2.2.1C for exact cover with colors. This code is based on the Algorithm C described in http://w

Soojin Nam 2 Dec 4, 2021
A simple and sussy project is an implementation of SOMMIP Lab 1 written in Golang

SOMMIP Lab 1 Isac Arthur Table of Contents About The Project Getting Started Prerequisites Installation Supported commands About The Project This very

Arthur 1 Nov 10, 2021
Implementation of the test task, chat in the goland language

Implementation of the test task, chat in the goland language

Dmitriy Fofanov 1 Dec 5, 2021
Rule engine implementation in Golang

Rule engine implementation in Golang

Hyperjump 1.2k Jun 20, 2022
Refrence implementation of the globaldce protocol

globaldce-toolbox This is the reference implementation of globaldce protocole coded in the go programming language. This project is still experimental

globaldce 24 Jun 15, 2022
The official golang implementation for Project Anatha.

Project Anatha The official golang implementation for Project Anatha. For instructions on setting up a validator on the Anatha network, view the guide

潘毅 0 Nov 25, 2021