英文:
WebStorm issue with GoLang struct
问题
由于某种原因,JetBrains的WebStorm将以下简单的GoLang结构标记为错误。具体来说,它不喜欢string
。
type Person struct {
Name string `json:"name"`
Address string `json:"address"`
}
但从外观上看,这个结构没有问题。我是否缺少WebStorm的插件?
英文:
For some reason, WebStorm (by JetBrains) marks the following simple GoLang struct as error. Specifically, it does not like string
type Person struct {
Name string `json:"name"`
Address string `json:"address"`
}
But from the looks of it, there is nothing wrong with this? Is there a plugin I am missing in WebStorm?
答案1
得分: 0
Go代码是正确的,只要在WebStorm中定义了GoSDK,就应该没问题。确保Golang的设置正确。
点击WebStorm -> Preferences -> Languages & Frameworks -> Go,确保所有设置都正确。
英文:
The Go code is correct so as long as there is a GoSDK is defined in WebStorm it should be okay. Make sure that Golang settings are in place.
Click on WebStorm -> Preferences -> Languages & Frameworks -> Go and make sure everything is set there.
Refer to: Go language (golang.org) support plugin
答案2
得分: 0
Go代码是正确的。如前所述,您需要为每个单独的项目启用Go SDK。
此外,请确保您的WebStorm已安装Go插件,或者只需使用Gogland IDE(类似于WebStorm但用于Go)-它现在是免费的,尽管还在测试阶段。
英文:
The Go code is correct. As mentioned, you need to enable Go SDK for each separate project.
Also, make sure your WebStorm has Go Plugin installed or just use Gogland IDE (that's like WebStorm but for Go) - it is free now while in beta.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论