Go Help

Syntax Highlighting


I downloaded Go the day after it was announced.  As I worked with Gedit to make coding easier, I saw that it supported syntax highlighting.  A search didn’t find a language-spec file for Go, so I started looking at the requirements to write one.  Thank goodness, I put it off and a few days later 3 people had done it.  Thank you to Jim Teeuwen, Javier Pérez, and Tonic Artos.  Here is the link:  http://go-lang.cat-v.org/text-editors/gedit/ .  Download the one you want,  they all seem to work fine.

After the download, the instructions say to copy the file  go.lang into the directory  /usr/share/gtksourceview-2.0/language-specs.  This works fine, but you have to mess with super user and your system directories.  As pointed out by Alessio in Post Comments, check your go.lang file permissions, it needs to be readable by everyone!

Alternatively, you can copy the file  go.lang into the directory  $HOME/.local/share/gtksourceview-2.0/language-specs. Notice the hidden directory .local, under your home directory.  Be sure to check the show hidden files box under View in your File Manager, or if you use the terminal command line, use the -a option, for example, ls -a. If the subdirectories do not exist, you can create them.

Now start Gedit and you will see, on the bottom status bar, a list box with many language specific syntax highlighters,  choose Go.  You now have syntax highlighting for Go in glorious color!

Note: There is also a highlighter for shell scripting and many other languages already installed.

Create a free website or blog at WordPress.com.

%d bloggers like this: