doukui2011
2017-06-13 13:52
浏览 63
已采纳

WebStorm问题与GoLang结构

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?

图片转代码服务由CSDN问答提供 功能建议

由于某些原因,WebStorm(由JetBrains编写)将以下简单的GoLang结构标记为错误。 具体来说,它不喜欢 string

  type Person struct {
 Name string`json:“ name”`
 Address string`json:  “ address”`
} 
   
 
 

但是从外观上看,这没有错吗? WebStorm中缺少我没有的插件吗?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • doujiling4377 2017-06-13 14:02
    已采纳

    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

    点赞 打赏 评论
  • douzai9405 2017-06-13 14:27

    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.

    点赞 打赏 评论

相关推荐 更多相似问题