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.

76 lines
1.1 KiB

3 years ago
package main
import (
"ansi"
"bytes"
"errs/stack"
3 years ago
"fmt"
)
func printTrace (s stack.Trace) {
3 years ago
lf := s.Frames()
for i,f := range lf {
fmt.Printf("%d file %s line %d %s\n",i,f.File,f.LineNumber,f.FuncName)
}
3 years ago
}
func GenerateBinaryString() string {
binaryString := ""
for c := 0; c < 255; c++ {
if ('a' <= byte(c) && byte(c) <= 'z') || ('A' <= byte(c) && byte(c) <= 'Z') || byte(c) == '@' {
binaryString += "1"
} else {
binaryString += "0"
}
}
return binaryString
}
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
}
3 years ago
func main() {
3 years ago
c1 := ansi.Code(0).SetStyle(ansi.StyleBold|ansi.StyleUnderline)
fmt.Printf("%s TexTo con Atts %s\n",c1,c1.End())
c1 = c1.DelStyle(ansi.StyleUnderline)
s:= fmt.Sprintf("%s TexTo con Atts %s\n",c1,c1.End())
fmt.Print(s)
b := &bytes.Buffer{}
w := ansi.NewNonEscapeWriter(b)
w.Write([]byte(s))
fmt.Print(string(b.Bytes()))
3 years ago
}

Powered by TurnKey Linux.