samples

command
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Samples

Please play with the samples by editing them and running the main files:

  • main.go just a starter for different playgrounds (includes asserter tester)
  • main-play.go general playground based on CopyFile and recursion
  • main-db-sample.go simulates DB transaction with money transfer
  • main-nil.go samples and tests for logger and using err2.Handle for success

Run a default playground play mode:

go run .

[!TIP] Set a proper alias to play with samples:

alias sa='go run .'

Run the DB based version to maybe better understand how powerful the automatic error string building is:

sa -mode db
# or
go run . -mode db

You can print usage:

sa -h
# or
go run . -h

Documentation

Overview

Package main includes samples of err2. It works as a playground for users of the err2 package to test how different APIs work. We suggest you take your favorite editor and start to play with the main.go file. The comments on it guide you.

We have only a few examples built over the CopyFile and CallRecur functions, but with them you can try all the important APIs from err2, try, and assert. Just follow the comments and try suggested things :-)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL