Learning How to Write Go REST APIs on a Pixelbook: Day 1

Well, I’ve seen a few folks post their experience on using some chromebooks as a lightweight web development tool, but what about building web services in compiled languages? Let’s take our first shot at doing so with Go!

Well, I’m working on a project in golang, and I sold my trusty iPad Pro, because while it’s an amazing tablet, it’s not enough of a portable dev/entertainment machine that I’d like. I want to be able to leave the 15” MacBook Pro at home when I take flights or travel and I’m not gonna need all the power (read: and weight) of the machine with me.

Enter, used pixelbook. The awesome part about the iPad Pro was that it took less than 2 hours to find a buyer for it (it was in like new condition, under warranty, and I still had all the boxes, like a madman). Now armed with unexpected new cash, I turned around and procured a used, excellent condition, Google Pixelbook with the following configuration:

Core i7-7Y75 Processor 16GB RAM 512GB NVMe SSD HD

Now, I could have gotten by with a lower spec’d machine (Core i5/8GB), but I was concerned about the eMMC SSD (yes, it’s solid state, but more akin to a fast embedded SD Card and not like the SSD in my MacBook Pro), and since I planned to do a lot of development in file-system heavy ways (oh, _nodemodules, also compilation of binaries in Go. Or Java. Or something else), I figured I might as well go with a spec I’m used to in my day-to-day dev life.

Pretty good pickup at $700 (I was eyeing the Pixelbook Go, but the max config w/ 16GB RAM is still pre-order only, the iPad Pro cash was burning a hole in my pocket… and y’all don’t care about any of this. My bad).

So, I boot the thing up, and damn - I’ve only had one other machine in my life boot to a GUI this fast in recent years (my home linux NUC, that thing is a beaut).

Sign in w/ my Google account, and here we are.

Step one: Enable Linux in chrome://settings Less than 10 minutes later, I have Linux enabled and a terminal prompt (would’ve likely been faster over a faster wifi connection - this one clocked in at 2.4Mbps, but I wasn’t complaining. It was free and at my favorite coffee shop).

Step two: Install golang Well, I downloaded the linux tarball from this link, and then wondered how I would access it in my terminal. Using the Files app, I right-clicked and shared it with Linux, and that… was it. Damn.

After that, we run a quick command to untar the package into my userspace: sudo tar -xzvf -C /usr/local go1.13.4.linux-amd64.tar.gz and let it do its thing… pretty fast too. (If you’re new to terminal or haven’t dealt with tarballs often, that command translates to: “while using superuser privileges, untar this package into the path I specified in the -C option”. Here’s the manual pages if you’d like to get the actual definitions for each of the options.

Step three: Add the go command to my user’s PATH So, in order to make go accessible without me having to type /usr/local/... every time, we want to add it to our user’s path. I did that with export PATH=$PATH:/usr/local/go/bin, and now all of the executables that come with golang’s install are available to my user without needing explicit file paths. From there, I want to make sure this is always available, so I edit ~.bash_profile, and add that line to it. Then to make sure it loads, I type source ~/.bash_profile, and boom, it’s there.

And now, my golang install is done.

Step Four: Fix something at work This is where I’ll stop the post, as I have to finish this setup later tonight, but I wanted to get this all down before I went to teach my class later tonight and forgot what all I did.

Tune in for part 2!