Golang

all tags

Pages tagged with "Golang":

zsh Autocompletion Caveat

23 Aug 2019 , tagged: zsh, Go, Golang

I spent a good hour trying to get a custom completion script working while porting my app Harbormaster to Cobra. It would and would not work. I retried writing the file, restarting the shell and it would just not offer any completions. Eventually I stumbled upon a innocent looking post on Github that held the solution: remove the .zcompdump file which holds the cached completions. So I ran rm ~/.zcompdump && compinit and everything works as expected.

read more →

null, Software Design, and Scala's Option

26 May 2018 , tagged: Scala, Software Development, null, TypeScript, Go, Golang

For the past year or so I’ve been writing a lot of Scala and fallen in love with its Option type and how it allows me to avoid nulls. I reflected on null, why they are bad, and how optional types allow you to write more expressive code. What is null? Most programming languages have the concept of null (or nil) that represents the absence of a given value or object.

read more →

Google Appengine, Go, and Vendoring

22 May 2016 , tagged: Golang, Go, Google App Engine

I’m working on a small app running on Google App engine using Go and upgraded to the latest version of the GAE SDK. The latest version uses Go 1.6 instead of 1.4 like the older version I had. Upgrading was mostly straightforward, but once I started using vendoring I got strange build errors like this: 2016/05/22 13:26:47 go-app-builder: Failed parsing input: parser: bad import "syscall" in vendor/golang.org/x/net/ipv4/dgramopt_posix.go I got different variations of this, but all came down to the same problem: some code was importing packages that GAE doesn’t want you tu use.

read more →

gorename and invalid expression

23 Oct 2015 , tagged: Golang, Go, zsh, Refactoring

This took me longer to figure out than I care to admit, so here’s the solution. The issue comes up when trying to use gorename: $ gorename -from "github.com/ilikeorangutans/foo".MyType -to 'MyBetterType' gorename: -from "github.com/ilikeorangutans/foo.MyType": invalid expression Even though the from query looks normal, gorename just refuses to work. However the issue is not so much with gorename but rahter my shell, zsh. Turns out properly escaping your from query, fixes the issue:

read more →

Using Golang and Graphviz to Visualize Complex Grails Applications

03 May 2014 , tagged: Golang, Go, Grails, Graphviz, Visualization, Software Development

At work we are maintaining several large and complex grails applications. In order to improve stability and reliability, we’re trying to increase test coverage. But as with all projects, time and resources are limited. In order to get a better understanding of what parts of the application are more important than others, I decided to use Graphviz to help me get a better overview of our applications. Meet Graphviz I discovered my love for the dot language when I used it years ago to analyze template hierarchies in a proprietary CMS system I worked on.

read more →

Golang Reading and Notes for April 2014

27 Apr 2014 , tagged: Go, Golang, Reading List

Last week I attended the Toronto Golang Usergroup Meetup and it was plenty of fun. If you’re in or near Toronto and like to dabble with Go, come out. Oh, and did I mention free pizza? Notes Casting in Go is slightly different than in C related languages. Instead of a cast, you perform a type conversion: var myVariable SomeGenericType = ... casted, ok := myVariable.(MoreSpecificType) // ok is a bool if ok { // Type conversion successful } else { // myVariable does not implement MoreSpecificType } The range keyword when used with two return values does not return references, but rather copies.

read more →

First impressions: Go

12 Nov 2013 , tagged: Go, First Impression, Golang

Ever since Google release Go I’ve been curious. Many good things were said and I always read bits and pieces here and there. Last week I decided to dive deeper and write some small things and get to know the language. So far I’m really impressed. This is a quick list of things I’ve noticed: Language The go language is full of nice surprises. I haven’t seen everything, but just a few things that really impressed me:

read more →