a common base lib for golang
go get github.com/lingdor/spannerlib
Normal
num,numErr:=strconv.Itoa("123")
if numErr!=nil {
panic(numErr)
}
age,ageErr:=strconv.Itoa("18")
if ageErr!=nil {
panic(ageErr)
}
Must get
num := E.Must1(strconv.Itoa("123"))
//or
age := E.Catch1(strconv.Itoa("123")).IfErrorDataFunc(func()any{
return "number was input wrong"
}).Must()
//or
num:=E.Catch1(strconv.Itoa("123")).Do(func(err error){
panic(err)
})
err:=fmt.Errorf("123")
err:=errors.Wrap(err,0,"msg")
fmt.printf("%v",err)
output
Exception MSG
testing.tRunner(/usr/local/go/src/testing/testing.go:1689)
if str.StartWith("hello world","hello") {
//true
}
fmt.Println(E.Must1(StringPick("<html><body>123</body></html>", "<body>", "</body>")))
output:
123