internal error: proxy not found for interface type <error>
xdays opened this issue · 2 comments
xdays commented
Here's my code:
import (
"fmt"
"log"
"errors"
)
type sqrError struct{
lat string
long string
err error
}
func (se sqrError) Error() string {
return fmt.Sprintf("math error: %v %v %v", se.lat, se.long, se.err)
}
func test4() {
_, err := sqrt(-10)
if err != nil {
log.Println(err)
}
}
func sqrt(f float64) (float64, error) {
if f<0 {
e := errors.New("more cola needed")
return 0, sqrError{"50 N", "99 W", e}
}
return 42, nil
}
test4()
result is:
repl.go:122:19: internal error: proxy not found for interface type <error>
Here's code from play.golang.org https://play.golang.org/p/gXuiTQmUroW
and result is:
2009/11/10 23:00:00 math error: 50 N 99 W more cola needed
Thanks!
cosmos72 commented
ops, my fault!
There's a lot of code to allow interpreted types to implement interfaces, yet somehow I forgot about the humble error
.
Fixing it.