|
|
|
|
|
by AlbinoDrought
995 days ago
|
|
The one that got me was the implicit wrapping of structs into interface types. As an example, the below code segfaults with `fatal error: panic while printing panic value: type runtime.errorString`: package main
type SomeError struct {
SomeMessage string
}
func (se *SomeError) Error() string {
return se.SomeMessage
}
func doSomethingSomeWay() *SomeError {
return nil
}
func DoSomething() error {
return doSomethingSomeWay()
}
func main() {
err := DoSomething()
if err != nil {
panic(err)
}
}
|
|
For precisely the reason you're demonstrating here! (Among several others.)