how to write go rest apis on a pixelbook: day 2
Filed under: Category
Day 2 is here, so let's jump back into our series on setting up our Pixelbook (or any chromebook, really) for developing web services with Go.
I left off at testing out my installation of go, and seeing it work properly from the terminal. The next thing I'll do is setup my default file system for working in go, such that I don't need to setup a
$GOPATH, but also it just matches my mental model for working here.
One interesting note about Chrome OS, is that all your files that live in
userspace do not map to the home path like it would in a traditional environment (think a default Ubuntu install, or OS X). So, when you share files between Chrome OS and its linux container, it gets mounted on the
/mnt/chromeos path. That was a nice surprise for me, because I can now safely make my linux home root my root path for code.
I start out by setting up my default folders for go, so from the user home, I create my directories:
mkdir go; mkdir -p go/src go/bin; and now I'm ready for code.
Next, I installed Atom for my development. I tried to get VS Code going but I just wasn't happy with its UI performance. I installed Atom by downloading the
.deb package from https://atom.io/. Once saved in my downloads folder, I right-clicked on it, and selected
Install using Linux (Beta), and a short wait later, it was installed.
Next, I installed a couple of packages to help with go development (
go-signature-statusbar), and get prepped for developing in Go.
Next, I prepare my tools for getting started in building some REST API Services using go - namely, the stack I will use (Gorilla Mux, PostgreSQL and Heroku for deployment, and the frontend will either be React or Vue - I haven't decided yet). I also add a couple of env variables for my local machine:
APP_ENV (which is always set to local, and I will use in any language I write in) and
GO111MODULES=true (so I can use go modules to manage dependencies).
After a day of research and tinkering, I called it a night, and I'll pick up where I left off tomorrow by writing my first lines of code for a project I have brewing.
Jayson is a former(-ish) DJ turned software engineer and now leader, having written code or led teams for over 18 years. Currently, he's a Senior Engineering Manager, speaker, bootcamp instructor, and sometimes distance runner.
In his downtime, he can be found trying to put dent in his Netflix queue, playing FPS and fighting games, and livestreaming code and technology on his Twitch channel.