WebStorm与GoLang结构的问题

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

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,确保所有设置都正确。

参考:Go语言(golang.org)支持插件

英文:

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.

huangapple
  • 本文由 发表于 2017年6月13日 21:52:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/44523559.html
匿名

发表评论

匿名网友

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

确定