A lightweight assertion library for Go, designed for systems and real-time programming with structured logging and flush controls.
go get github.com/ZanzyTHEbar/assert-lib
package main
import (
"context"
"github.com/ZanzyTHEbar/assert-lib"
)
func main() {
handler := assert.NewAssertHandler()
handler.Assert(context.TODO(), false, "This should fail")
}
Check out the examples directory for usage examples.
- Assertions: Assert, Nil, NotNil, NoError, Never.
- Flush Management: Control output flushes with AssertFlush.
- Context-Based Logging: Attach structured logging to your assertion calls.
- Custom Loggers: Use your own logger with the AssertHandler interface.
Works very well with my errbuilder-go library.
go run examples/basic_assertion.go
go run examples/deferred_assertions.go
go run examples/custom_exit.go
go run examples/formater.go