weixin_39960920
2021-01-11 19:45"func" type not supported
IDEA version: 14.1.4 OS version: 4.0.7-2-ARCH 1 SMP PREEMPT Tue Jun 30 07:50:21 UTC 2015 x86_64 GNU/Linux (Xfce desktop env) Java version: java version "1.8.0_45" Java(TM) SE Runtime Environment (build 1.8.0_45-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode) Go IntelliJ plugin version: 0.9.388 Go version: 1.4.2
In my project, I have a "func" type: https://github.com/pierrre/imageserver/blob/master/server.go#L10
go
// ServerFunc is a Server func.
type ServerFunc func(params Params) (*Image, error)
// Get implements Server.
func (f ServerFunc) Get(params Params) (*Image, error) {
return f(params)
}
It implements:
go
// Server represents an Image server
type Server interface {
Get(Params) (*Image, error)
}
But it's not detected as a Server
.
See https://github.com/pierrre/imageserver/blob/master/server_test.go#L18 .
go
server := ServerFunc(func(params Params) (*Image, error) {
called = true
return testdata.Medium, nil
})
server.Get(Params{})
IntelliJ says: "Unresolved reference 'Get'"
Get
is highlighted in red.
"ctrl+click" doesn't go to definition.
Autocompletion suggests my server
variable is an *Image
...
该提问来源于开源项目:go-lang-plugin-org/go-lang-idea-plugin
- 点赞
- 回答
- 收藏
- 复制链接分享
7条回答
为你推荐
- Linux中安装tensorflow2.0出现如下问题
- linux
- tensorflow
- 3个回答
- 样式表不适用于使用chi路由器的go html模板
- templates
- 1个回答
- 实际遗失电话
- oop
- polymorphism
- 1个回答
- 我们可以为Go中的错误创建子类型吗?
- types
- error-handling
- 1个回答
- 冲突的匹配嵌入式接口方法是功能,错误还是其他功能?
- interface
- 1个回答