A lightweight Go client for sending debugging information to the LaraDumps desktop application.
Allows dumping values, JSON, structs, tables, labels, and development-only logs — similar to dd() in Laravel.
go get github.com/laradumps/laradumps-gopackage main
import "github.com/laradumps/laradumps-go/ds"
func main() {
ds.Clear()
ds.Ds("hello")
ds.Ds(42)
ds.Ds(true)
ds.Ds(map[string]any{"x": 1})
ds.Ds([]int{1, 2, 3})
ds.Ds(struct{ Name string }{"Luan"})
ds.Table([]map[string]any{
{"Name": "Luan", "Age": 35},
{"Name": "Samuka", "Age": 23},
})
ds.Label("Custom Label")
ds.Dsd("Dump and Die")
}To enable LaraDumps only in development, you can use Go build tags. This ensures dumps never go to production and no cleanup is required.
Development mode:
touch log_dev.go//go:build dev
package main
import "github.com/laradumps/laradumps-go/ds"
func Ds(v ...interface{}) {
Ds.Ds(v...)
}Production mode:
touch log_prod.go//go:build !dev
package main
import "fmt"
func Ds(v ...interface{}) {
fmt.Println(v...) // or empty
}package main
func main() {
// Calls to ds() will be replaced with fmt.Println() in production mode
Ds("This will only be dumped in development mode")
Ds(struct{ Name string }{"Luan"})
}- Running in dev mode
go run -tags dev .- Running in prod mode
go run .- Author: Luan Freitas
- Thanks to all contributors
MIT
