You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
786 B
60 lines
786 B
package main
|
|
|
|
import (
|
|
"ansi"
|
|
"errs/stack"
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
|
|
func printTrace (s stack.Trace) {
|
|
lf := s.Frames()
|
|
for i,f := range lf {
|
|
fmt.Printf("%d file %s line %d %s\n",i,f.File,f.LineNumber,f.FuncName)
|
|
}
|
|
}
|
|
|
|
|
|
type (
|
|
|
|
MiCustomErr struct {
|
|
error
|
|
ms string
|
|
}
|
|
)
|
|
|
|
func (c MiCustomErr) Message() string {
|
|
return "esto es un custom werro"
|
|
}
|
|
|
|
|
|
/*
|
|
func fm (b *bytes.Buffer, e error, l int) {
|
|
b.WriteString("Link :"+e.(MiCustomErr).Link+"\n")
|
|
}
|
|
*/
|
|
|
|
func (c MiCustomErr) Unwrap () error {
|
|
return c.error
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
c := ansi.ColorRed.SetBgColor(ansi.ColorHWhite).SetBlink(true)
|
|
fmt.Printf("Attributes %s\n",c.Atts())
|
|
|
|
s := fmt.Sprintf("%sColor Red y White \n",c.Escape())
|
|
|
|
w := ansi.NewNonEscapeWriter(os.Stdout)
|
|
|
|
os.Stdout.WriteString(s)
|
|
|
|
w.Write([]byte(s))
|
|
|
|
}
|