You would probably know that, there’s a new font type called “gofont” specially designed for go programing and this post will show you, how to install gofont on your Ubuntu or Mac OS X machine and then use it on vscode (which is one of the good IDEs avaiable today for golang).

Here’s the tweet about gofont from official golang twitter account:

Note: This post assumes that, you have git and vscode installed on your machine.

Installing gofont on Ubuntu or any Linux machine:

  • Dowload the font files using git:
git clone https://go.googlesource.com/image
  • Use your file browser to open this path: (I am using nautilus here)
nautilus image/font/gofont/ttfs
  • Now double click on the tff files to preview the font and also to install the fonts you like.

  • List of files inside the ttfs folder:

total 1496
-rw-rw-r-- 1 ravitezu ravitezu 138956 Feb 12 00:00 Go-Bold.ttf
-rw-rw-r-- 1 ravitezu ravitezu 141872 Feb 12 00:00 Go-Bold-Italic.ttf
-rw-rw-r-- 1 ravitezu ravitezu 142368 Feb 12 00:00 Go-Medium.ttf
-rw-rw-r-- 1 ravitezu ravitezu 146496 Feb 12 00:00 Go-Medium-Italic.ttf
-rw-rw-r-- 1 ravitezu ravitezu 138588 Feb 12 00:00 Go-Italic.ttf
-rw-rw-r-- 1 ravitezu ravitezu   1913 Feb 12 00:00 README
-rw-rw-r-- 1 ravitezu ravitezu 134988 Feb 12 00:00 Go-Regular.ttf
-rw-rw-r-- 1 ravitezu ravitezu 160760 Feb 12 00:00 Go-Mono.ttf
-rw-rw-r-- 1 ravitezu ravitezu 169824 Feb 12 00:00 Go-Mono-Italic.ttf
-rw-rw-r-- 1 ravitezu ravitezu 164936 Feb 12 00:00 Go-Mono-Bold.ttf
-rw-rw-r-- 1 ravitezu ravitezu 173600 Feb 12 00:00 Go-Mono-Bold-Italic.ttf
  • Each font has its own name (You can see the font name on the top of installer window which is opened when you double clcik on the ttf file) and I have installed “Go-Medium” (File: Go-Medium.ttf) on my machine. I am saying this because, you have to know the font name to use it on your vscode.

Installing gofont on Mac OS X:

  • Dowload the font files using git:
git clone https://go.googlesource.com/image
  • Use your file browser to open this path:
open image/font/gofont/ttfs
  • Now double click on the tff files to preview the font and also to install the fonts you like.

  • List of files inside the ttfs folder:

total 2992
-rw-rw-r-- 1 ravitezu ravitezu 138956 Feb 12 00:00 Go-Bold.ttf
-rw-rw-r-- 1 ravitezu ravitezu 141872 Feb 12 00:00 Go-Bold-Italic.ttf
-rw-rw-r-- 1 ravitezu ravitezu 142368 Feb 12 00:00 Go-Medium.ttf
-rw-rw-r-- 1 ravitezu ravitezu 146496 Feb 12 00:00 Go-Medium-Italic.ttf
-rw-rw-r-- 1 ravitezu ravitezu 138588 Feb 12 00:00 Go-Italic.ttf
-rw-rw-r-- 1 ravitezu ravitezu   1913 Feb 12 00:00 README
-rw-rw-r-- 1 ravitezu ravitezu 134988 Feb 12 00:00 Go-Regular.ttf
-rw-rw-r-- 1 ravitezu ravitezu 160760 Feb 12 00:00 Go-Mono.ttf
-rw-rw-r-- 1 ravitezu ravitezu 169824 Feb 12 00:00 Go-Mono-Italic.ttf
-rw-rw-r-- 1 ravitezu ravitezu 164936 Feb 12 00:00 Go-Mono-Bold.ttf
-rw-rw-r-- 1 ravitezu ravitezu 173600 Feb 12 00:00 Go-Mono-Bold-Italic.ttf
  • Each font has its own name (You can see the font name on the top of installer window which is opened when you double clcik on the ttf file) and I have installed “Go-Medium” (File: Go-Medium.ttf) on my machine. I am saying this because, you have to know the font name to use it on your vscode.

Using gofont on vscode:

  • Open vscode and click “File” (if you are on Linux) or “Code” (if you are on Mac OS X).

  • Now select “Preferences” > “Settings” and now you will see a “settings.json” file with empty braces, if you don’t have any settings defined.

  • Add the following line into those braces and save the file.

    "editor.fontFamily":"Go Medium"
    
  • You “settings.json” file content should look like this:

    // Place your settings in this file to overwrite the default settings
    {
    "editor.fontFamily":"Go Medium"
    }
    
  • If you have any other setting along with the fontFamily setting above, you would need to seperate those setting with a comma, like the following:

// Place your settings in this file to overwrite the default settings
{
    "editor.fontFamily":"Go Medium",
    "something.something": "something-here",
    "anything.anything": "anything-here"
}