PrintIface

This commit is contained in:
xushiwei
2024-05-27 09:56:42 +08:00
parent 8536fe4987
commit df13e3ab82
5 changed files with 28 additions and 1 deletions

21
cl/_testgo/errors/in.go Normal file
View File

@@ -0,0 +1,21 @@
package main
// New returns an error that formats as the given text.
// Each call to New returns a distinct error value even if the text is identical.
func New(text string) error {
return &errorString{text}
}
// errorString is a trivial implementation of error.
type errorString struct {
s string
}
func (e *errorString) Error() string {
return e.s
}
func main() {
err := New("an error")
println(err, err.Error())
}

0
cl/_testgo/errors/out.ll Normal file
View File