What is the difference between "(type func())" and "type func()"

huangapple go评论78阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2016年1月19日 20:08:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/34876438.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定