英文:
What is the difference between "(type func())" and "type func()"
问题
我正在尝试构建一个代码示例,但是我遇到了以下错误:
无法将FuncName(类型为func())用作字段值中的func()错误类型
括号的包裹意味着什么?
英文:
I'm trying to build a code example and I get the following error:
cannot use FuncName (type func()) as type func() error in field value
What does the wrapping parenthesis mean?
答案1
得分: 7
没有区别,但是你误解了错误信息。它的意思是类型 FuncName
,即 func()
不能被用作 func() error
,因为它不返回错误。
英文:
There is no difference but you're misinterpreting the error message. What it's saying is that type FuncName
which is func()
cannot be used as func() error
because it doesn't return an error.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论