package
0.1.0
Repository: https://github.com/codemicro/alib-go.git
Documentation: pkg.go.dev

# README

icecream-go

🍦 Never use fmt.Println() for debugging again! A port of the Python IceCream library


Features

  • Close feature parity to the Python implementation
  • Syntax highlighting
  • Customisable outputs

Inspecting variables

// import "github.com/codemicro/icecream-go/ic"

foo := func (i int) int { return i + 333 }
ic.IC(foo(123)) // -> ic| foo(123): 456

bar := map[string]map[int]string{"key": {1: "one"}}
ic.IC(bar["key"][1]) // -> ic| bar["key"][1]: "one"

baz := struct{ Name string }{Name: "codemicro"}
ic.IC(baz.Name) // -> ic| baz.Name: "codemicro"

Inspecting flows

package main

import "github.com/codemicro/icecream-go/ic"

func foo() {
    ic.IC()
    // do things
    if condition {
        ic.IC() 
        // other thing 
    } else {
        ic.IC()
        // another thing
    }
}

func main() {
    foo()
    // -> ic| main.go:7 in github.com/codemicro/something/main.foo
    //    ic| main.go:9 in github.com/codemicro/something/main.foo
}

ic.Format

theAnswer := 42
x := ic.Format(theAnswer)
fmt.Println(x) // -> ic| theAnswer: 42