Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

learning-go/ch08/interface_impl3.go #2

Open
modernix opened this issue Mar 31, 2018 · 1 comment
Open

learning-go/ch08/interface_impl3.go #2

modernix opened this issue Mar 31, 2018 · 1 comment

Comments

@modernix
Copy link

Hi Vladimir,

I ran into this issue while testing out the interface examples.
./interface_impl3.go:83:37: s.area undefined (type interface {} is interface with no methods)

To workaround the issue, I modified the shapeInfo func.

func shapeInfo(s interface{}) string {
if str, ok := s.(shape); ok {
return fmt.Sprintf("Area = %.2f", str.(shape).area())
}
return ""
}

@vladimirvivien
Copy link
Owner

Thanks for pointing this out @modernix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants