Skip to content

Instantly share code, notes, and snippets.

@dsk52
Created July 12, 2020 03:08
Show Gist options
  • Save dsk52/9a4968a6059587da2efb95519ccaadb0 to your computer and use it in GitHub Desktop.
Save dsk52/9a4968a6059587da2efb95519ccaadb0 to your computer and use it in GitHub Desktop.

VSCode の golang 設定

gopls というLanguage Serverで補完をかけれるみたい。

vscode/setting.json

{
  "go.useLanguageServer": true,
  "go.alternateTools": {
      "go-langserver": "gopls"
  },
  "[go]": {
      "editor.snippetSuggestions": "none",
      "editor.tabSize": 4,
      "editor.insertSpaces": false,
      "editor.formatOnSave": true,
      "editor.formatOnPaste": false,
      "editor.formatOnType": false,
      "editor.codeActionsOnSave": {
          "source.organizeImports": true
      }
  },
  "go.autocompleteUnimportedPackages": true,
  "gopls": {
      "usePlaceholders": true
  }
}
$ go get golang.org/x/tools/gopls

go get したら $GOPATH/pkg におかれるらしい。 import してるものも同時にダウンロードされるらしい。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment