DEV Community

loading...

VS Code setup for golang in 2020

amammay profile image Alex Mammay Updated on ・2 min read

My IDE setup usually change quite a bit overtime, so i figured it would be quite nice to document my current setup as a snapshot in time around the current development ecosystem that i am currently in.

My day to day tech stack usually revolves golang, and containers. I guess you could call that stack the 2020 serverless stack at this point really... Between using intellij ultimate and vscode i generally have a pretty consistent setup between either one.

Theme

  • Color Theme: One Dark Pro
  • Icon Theme: Material Icon Theme
  • Font: Jetbrains Mono, Font Ligatures enabled
  "workbench.colorTheme": "One Dark Pro",
  "editor.fontFamily": "'JetBrains Mono', Consolas, 'Courier New', monospace",
  "editor.fontSize": 13,
  "editor.fontLigatures": true,
  "editor.letterSpacing": 0.4,
  "editor.smoothScrolling": true,
  "workbench.iconTheme": "material-icon-theme",

Theme Setup

Settings for go

  "go.lintOnSave": "file",
  "[go]": {
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
      "source.organizeImports": true
    }
  },
  "go.docsTool": "gogetdoc",
  "go.formatTool": "goimports",
  "go.useLanguageServer": true,

Extensions

  • Cloud Code (googlecloudtools.cloudcode) For all your serverless GCP needs (really nice way to run a cloud run like environment locally with it leveraging minikube)

cloud code example

  • Docker (ms-azuretools.vscode-docker)
  • GO (golang.go)
  • gotemplate-syntax (casualjim.gotemplate)
  • Golang postfix code completion (yokoe.vscode-postfix-go) This might be the most important extension to have installed. I find myself having more productive rhythm when using postfix tools across any language since i worry more about the core pieces of code and any thing else can be an afterthought.

demo

  • Intellij IDEA key mapping (k--kato.intellij-idea-keybindings)

Discussion (0)

pic
Editor guide