Photo by Fotis Fotopoulos on Unsplash

Setting up VS Code for Golang (2021)

Rafael Piovesan C Machado
4 min readNov 30, 2021

--

Love VS Code and is looking for how to set it up so you can start hacking with Go? Look no further! (ok ok, probably not 100% accurate, but, at least, it’ll put you in the right direction ^^).

Starting with the basics

  • Install or update Go Tools by pressing Ctrl+Shift+P, then type in “Go” and select “Go: Install/Update Tools”:

Next steps

Up until this point we’ve covered the minimum to get you up and running. Now it’s time to go a bit further.

  • And here’s a comparison between the default dark theme and Ayu:
VS Code Default Dark theme
Ayu Mirage Bordered
Sample of VS Code “settings.json” file
  • In the example above, font ligatures are enabled, so operators like ==, !=, :=, >= and so on are replaced with their corresponding ligatures:
Font ligatures in use, notice the special symbols in place of logical operators
  • Moving on, another really cool feature you could turn on is:
Sample of VS Code “settings.json” file
  • It’ll enable the use of semantic tokens provided by gopls (the Go Language Server) which will improve syntax highlighting defined by Ayu theme:
Syntax highlight based on semantic tokens

Wait, there’s more …

As a bonus, take a look at these last tips:

--

--

Rafael Piovesan C Machado

Software Engineer passionate about learning new technologies and skills. Enthusiastic about Big Data, Advanced Analytics and Machine Learning.