[英]Why is this Go-Lang IntelliJ plugin is inconsistent with Go's syntax?
我是Go的新手,所以這可能是Go的問題,而不是IntelliJ:我剛剛設置了https://github.com/go-lang-plugin-org/go-lang-idea- IntelliJ中zip文件中的plugin / 。
我發現編譯器與語法熒光筆不一致。
world, err := redis.String(c.Do("GET", "message1"))
if err != nil {
fmt.Println("key not found")
}
產生以下錯誤消息。
*對Redis.String的調用參數不足。
仔細查看對Redis.String的調用,似乎需要一個interface + args。
func String(reply interface{}, err error) (string, error) {
....
return "", fmt.Errorf("redigo: unexpected type for String, got type %T", reply)
}
因此,我可以通過在調用結束時簡單地添加一個“ err” arg來欺騙IDE刪除錯誤消息,如下所示:
world, err := redis.String(c.Do("GET", "message1"), err)
但是, 唉 ! 此“修復”使go編譯器不滿意...並且它報告此消息(即使IntelliJ插件未將其解釋為錯誤)。
./t1.go:19:單值上下文中的多值c.Do()
關於為什么IntelliJ Go插件需要兩個arg的任何想法,而GoLang只需要一個arg,對此功能將有很大的幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.