doukui2011
doukui2011
2017-06-13 13:52

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?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • doujiling4377 doujiling4377 4年前

    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 douzai9405 4年前

    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.

    点赞 评论 复制链接分享

为你推荐