I’ve been playing with a go package called safekeeper. The way it works is that it takes a xxxxxxx.go.safekeeper file as input and does a search/replace on various environment variables that you specify and outputs a .go file which is then compiled into your project.
One of the things I don’t like about the project is that since one of the input files is, in fact, a .go file with a different filename extension (.go.safekeeper) the atom.io editor does not know what syntax highlighting to apply.
Thankfully there is a package called file-mode which you’ll install in the usual atom way so I’m not going to detail that here. But I had a number of challenges getting things to work once the package was installed… and I do not have a specific recipe that made things work but in the end it did.
- install atom.io if not already installed and launch it
- open the settings tab
- search for and install the file-mode package
- it might be a good thing to restart the editor here
- open the file you want to edit
- add the sentinel string anywhere in the file. Some editors like it on line 1 and others at the EOF
- For go, my tag looked like:
- // -- mode: Go --
- I used uppercase ‘Go’ because when I opened a real Go file I noticed the file-mode indicator in the bottom right
The first few times I tried it failed. It might work for you. The documentation is sketchy but it recommended reloading the file after adding the sentinel. I tried that. I also tried restarting the editor. And the very last thing I tried was ctl+alt+l
. (that’s the lowercase L)
And it worked.