August 21, 2015

Go, Strings, and Character Encoding

I recently had a conversation with a friend about how UTF-8 and character encoding works in general, centered around why strings seem weird in Go if you’re used to how they’re handled in other languages. The way that Go handles strings is pretty cool: a string is slice of bytes. Period. End of story. It also just so happens that a Go program is defined as a sequence of UTF-8 characters (that’s all that is supported), so unless you insert raw bytes into them using escapes, a string literal is always UTF-8 in Go. Read more

August 19, 2015

Go Editor Setup

After a few nights reading the golang-book and hacking around with golang in general, I finally broke down and set up Vim to make it not feel like Unix circa 1970. I took a look at the IDE and text editor plugins list on the go github page and finally settled on a setup. Setup Vundle for managing vim plugins fatih/vim-go for code completion and syntax awareness fatih/molokai color scheme What I learned I’ve used vim for over a decade and know nothing about it Vundle’s required config breaks git if you are using the vi alias. Read more

November 15, 2014

Go CD with github via ssh

Trying to use a [email protected] url to pull from using the Go continous delivery agent? I found http://support.thoughtworks.com/entries/21593593-Issues-with-Go-and-Github-SSH-Keys-?flash_digest=53af7e8bf011eda1e9112350616a350880049a70 on the thoughtworks go support forum. Dave Green correctly said that all you had to do was: sudo su - go # do the following commands as the ‘go’ user ssh-keygen # don’t set a passsphrase on the key add the ~go/.ssh/id_rsa.pub contents to a new key on github git clone # this adds the github ssh server to known_hosts The last step was what was tripping me up; the test clone adds the host signature to the known_hosts file. Read more

August 22, 2014

Jekyll Syntax Highlighting

Jekyll and github-pages support syntax highlighting using the pygments library. To use it: include pygments aware CSS somewhere in your page template put highlight code block, referencing the desired syntax {% raw %} {% highlight groovy %} class GroovyClass { def cry() { println ‘Whaaa!’ } } {% endhighlight %} {% endraw %} For instance, the code above should appear like the following: {% highlight groovy %} class GroovyClass { def cry() { println ‘Whaaa! Read more

August 20, 2014

Ratpack - Simpler HTTP Services

After writing http services in spring-mvc and jax-rs a number of times, I’m of the opinion that the stacks are a bit too complicated. Its not that they don’t work, or even that they are hard to understand. They just feel a bit heavyweight (and surprisingly awkward) for implementing restful services, which is what I seem to be writing for the backend these days. I understand why the java REST frameworks look the way they do: they were built on standards (the servlet api), and grew out of their respective historical uses, XML-based HTTP web services for jax-rs, and MVC web framework for spring-mvc. Read more

© Brandon Atkinson 2017

Powered by Hugo & Kiss.