shad-go/lectures/02-interfaces/temporary/main.go
2021-02-25 14:42:06 +03:00

18 lines
224 B
Go

package main
import "errors"
type Temporary interface {
IsTemporary() bool
}
func do() error { return nil }
func main() {
err := do()
var terr Temporary
if errors.As(err, &terr) && terr.IsTemporary() {
//...
}
}