I decided it was a good time to learn another programming language. So I chose Go. Why did I choose Go? I don't know, somebody gave a presentation about it once and it seemed kind of interesting. I see other people use Go. It is used in many network and devops projects (ones that I use, like Docker). Why not see what it's about?

I created some simple web apps (see: hget.org) to learn it. I used the Gin web framework 1 because even though the standard http and net libraries are great, I did not want to spend time writing this code.

Instead I wanted to write something more like this:

    r := gin.Default()


    r.GET("/", func(c *gin.Context) {
        c.HTML(http.StatusOK, "base.tmpl", gin.H{
            "title":       "IP",
            "curl":        "curl -H \"Content-Type: application/json\" ip.hget.org/api/",
            "curl_result": "{\"ip\":[\"\"],\"port\":[\"55636\"]}",

That way I could reuse the same base template and then write some Javascript on the front end to build the main body of the page. Add a nginx config that defines a reverse proxy for different subdomains and I could create 3+ websites for the cost of 1 (domains and server bills add up fast).

What did I like about Go? Coming from Python it was refreshing to be able to compile the app, scp it to the server, and execute it. No requirements file. No "pip install -r requirements.txt". No "version 5.3 of x is required but 4.1 is installed" errors. No WSGI. No mucking around with Python versions and virtualenvs (relevant). Because of static typing and a compiler that forces me to write

if err != nil { 

every time there are very few surprises I would handle errors better than this in a more serious project. Also, having written a fair amount of async code, I can appreciate Goroutines. Having a synchronous API for asynchronous code is in my opinion and in most cases preferable. I liked structs and how they are embeddable with field promotion. Interfaces are great tools for design. In my time poking around the standard lib source code, I found much of it to be extremely concise and readable. It reminded me of what I learned in Patterns of Enterprise Application Architecture. So much so that I question if Python really is the least complex and most readable after all. On the whole, I feel like Go forces me to be a better programmer.