Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/followtheprocess/debug
Like Rust's dbg macro, but for Go!
https://github.com/followtheprocess/debug
debugging golang library
Last synced: 16 days ago
JSON representation
Like Rust's dbg macro, but for Go!
- Host: GitHub
- URL: https://github.com/followtheprocess/debug
- Owner: FollowTheProcess
- License: mit
- Created: 2024-01-17T11:58:29.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-10-08T00:33:56.000Z (about 1 month ago)
- Last Synced: 2024-10-15T20:42:07.904Z (about 1 month ago)
- Topics: debugging, golang, library
- Language: Go
- Homepage:
- Size: 52.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Debug
[![License](https://img.shields.io/github/license/FollowTheProcess/debug)](https://github.com/FollowTheProcess/debug)
[![Go Reference](https://pkg.go.dev/badge/github.com/FollowTheProcess/debug.svg)](https://pkg.go.dev/github.com/FollowTheProcess/debug)
[![Go Report Card](https://goreportcard.com/badge/github.com/FollowTheProcess/debug)](https://goreportcard.com/report/github.com/FollowTheProcess/debug)
[![GitHub](https://img.shields.io/github/v/release/FollowTheProcess/debug?logo=github&sort=semver)](https://github.com/FollowTheProcess/debug)
[![CI](https://github.com/FollowTheProcess/debug/workflows/CI/badge.svg)](https://github.com/FollowTheProcess/debug/actions?query=workflow%3ACI)
[![codecov](https://codecov.io/gh/FollowTheProcess/debug/branch/main/graph/badge.svg)](https://codecov.io/gh/FollowTheProcess/debug)Like Rust's [dbg macro], but for Go!
## Project Description
`debug` provides a simple, elegant mechanism to streamline "print debugging", inspired by Rust's [dbg macro]
> [!WARNING]
> This is not intended for logging in production, more to enable quick local debugging while iterating. `debug.Debug` should **not** make it into your production code## Installation
```shell
go get github.com/FollowTheProcess/debug@latest
```## Quickstart
### Before
```go
package mainimport "fmt"
func main() {
something := "hello"
fmt.Printf("something = %s\n", something)
}
``````shell
something = something
```- Not ideal, need to manually type variable name
- No source info, could easily get lost in a large program
- Need to deal with fmt verbs### With `debug.Debug`
```go
package mainimport "github.com/FollowTheProcess/debug"
func main() {
something := "hello"
debug.Debug(something)
}
``````shell
DEBUG: [/Users/you/projects/myproject/main.go:7:3] something = "hello"
```- Source info, yay! 🎉
- Variable name is handled for you
- Can handle any valid go expression or value
- No fmt print verbs### Credits
This package was created with [copier] and the [FollowTheProcess/go_copier] project template.
[copier]: https://copier.readthedocs.io/en/stable/
[FollowTheProcess/go_copier]: https://github.com/FollowTheProcess/go_copier
[dbg macro]: https://doc.rust-lang.org/stable/std/macro.dbg.html