Go build and install on save in SublimeText3

Update: Turns out every new Go developer makes this mistake. I realized the err of my ways with a week of writing this. When you just accept the Go way, everything gets better. Ignore my stupidity below.

Recently I have been dabbling more and more with go. And I write my go apps in SublimeText3. Soon after starting this I found the awesome SublimeGo plugin. So without knowing much, this makes life a lot easier. What I especially enjoy is the ability to run an argument on save. So every time I save a go file, it can do something. At first this ran a build . errors && go vet. But then I wanted a bit more. I wanted it run that, then if successful build the app and move the compiled app to my bin directory.

Unfortunately, the one sucky part of golang is the opinionated way it wants you to organize your filesystem. If you want to keep all your projects together, then your bin directory is going to be required to be in a certain place. The build command claims to allow an output directory with -o but that doesn’t actually work the way it’s documented.

But I managed to find a workaroud and thought I would share. I just build to the current directory then move the file that has the same name as the current directory to my ~/bin which is already in my path. Its not perfect since a file briefly appears in my ST sidebar, but it works.

Here is my full GoSublime.sublime-settings file:

 

 

 

Dealing with slow outbound connections in Vagrant hosted WordPress

When I started working with WordPress on Vagrant yesterday I noticed that it was very slow. Turns out it was due to how Vagrant and VirtualBox were dealing with DNS. It also turned out to be an easy fix. I just needed the following in my Vagrantfile:

 

It’s always good when I can finish my goals for the day

I had two goals for today…yes, it’s a holiday and I had goals. My wife is working today so I figured I might as well work on a few fun things. OK, now one of those things is actually work-related, but that’s what you get when you enjoy what you do. 

So here they are:

  1. Finish up the Datadoghq.com Vagrant box
  2. Migrate Technovangelist.com from Squarespace to WordPress on Digital Ocean

Let me walk you through a bit of that. The first item is the continuation of a project that I had been working on for a while. I spent Christmas with my in-laws and with my parents in Detroit and Seattle. In between far too many family visits to count, I started working on adapting a git deploy workflow for the Datadog corporate website. This meant getting everything set up for developing locally. And that meant requiring Apache, PHP, and mysql on the local machine.

I have this configured on my machine, but one of the main reasons for going through this process was to ensure it was easy for anyone to work with. After working with one dev on setting up their local machine, I was frustrated. Then on Friday one of my colleagues, Mike Fiedler, suggested going the Vagrant/Chef route. 

Of course!!! So I started down the rabbit hole and tumbled faster and faster as I went. Every step I made inspired another turn and with every turn I experienced the joy of solving a puzzle and the grief of creating another. But finally this morning I had a single repo to clone, then run a script and within a few minutes both production and staging are ready to go; ready for your improvements. I am psyched!!

So the other goal was pretty easy: migrate off of Squarespace. Why do I want to do this? Squarespace didn’t do anything wrong, but for the functionality it provides, its just a bit too expensive. I pay $20 per month and have paid that or something similar for about 10 years. Normally that would be fine. But I have hosted another two sites on a Digital Ocean droplet for $5 per month (total, not each). When I signed up for sqsp, I wanted to stop managing my own server. Back then it was harder. Plus my server was hand built by me, then later on it was Community Server and Graffiti. Squarespace was easy. And it wasn’t that much more than what I was paying. Well, except when I was at Microsoft and at the time they were running their own hosting which was free for employees. 

So I started another site on my multisite install of WordPress which took all of a minute. Then exported my content from Squarespace…saying it took a minute would be an exaggeration. Importing it to WordPress was super easy. And I had a theme I liked that I spent a little while customizing. All that was left was a simple DNS change and now the site is live. I’ll give it a few days then will cut the cord with Squarespace.