Verbose Logging

software development with some really amazing hair

T + S G I F R

Articles tagged with "golang"

The Philosophy of Naming Variables

· Posted in Software
Russ Cox made a good comment on the golang-dev mailing list about the philosophy of naming variables. He links to his original short post on the subject as well. A TL;DR version is that i makes more sense than index when you're looking at a small loop. For local variables that are only relevant for a short number of lines, having long verbose names actually makes them less efficient. As the context or reach of a variable increases, having longer…

manbearpig: Mutation Testing for Go

· Posted in Programming
Mutation testing isn't about testing your code, but about improving your tests. What happens is the testing tool looks through your source code for instances of some known thing. This usually something easily tweaked, like ==. For each instance, it changes it to some opposite value that makes sense. In the case of ==, we can change it to !=. For each single change it makes, it runs the tests. The idea is that the tests should fail. If they don't…

A Timing Attack In Action

· Posted in Programming
Last week I wrapped up the chapter on the crypto package in Go, The Standard Library Within the crypto package we have the crypto/subtle package. This package contains functions for doing constant time operations which are an important part of cryptography. Constant time functions help prevent timing attacks which are caused when operations take different amounts of time to complete a task based on some input. When the time something takes leaks…

The crypto Chapter In Go, The Standard Library Is Available

· Posted in Books
Wow, that was a big one. Late Wednesday night I finished the crypto chapter in Go, The Standard Library, and it's a doozy. It pushes the size of the book up to 100 pages. Think about that. It's only 7 out of 40 chapters complete. It's kind of freaking me out. There's a mailing list, Twitter account, and a feedback form, so head over to The Standard Library for all things related to that. You can buy the book for only $39, and please do, because …

Simple Twitter Streaming For Go

· Posted in Programming
I scratched my own itch. I made twitterstream I was working on a little script to pull some images from Twitter, and wasn't happy with what was out there. The ruby gems available were throwing random exceptions or just pulled the JSON down into a hash. I'm all about the Go programming language lately, so I started working in Go instead. There were two libraries available, both named twitterstream, but neither worked the way I liked. Both use oat…

Go 1.0.2 Is Out

· Posted in Programming
Go 1.0.2 was released late last night. It's a bunch of bug fixes, including some nasty ones with hashes. It's completely backwards compatible with go1.0.1 and go1, so there's no reason not to update: cd $GOROOT hg pull hg update -r go1.0.2 cd src ./all.bash And you're done! You'll probably have to update some packages along the way. It will complain about how it was expecting a package for go1 or go1.0.1, which just means you need to recompile. …

Go, The Standard Library Updates

· Posted in Books
Since I posted about the starting at the beginning of April, naturally I've made some progress. I haven't been posting updates here because there's the mailing list and Twitter for that, but I've got five chapters out so it's time for a blog update. I'm going through the packages alphabetically so archive, bufio, builtin, bytes, and compress are ready to go. Head over to to subscribe to the mailing list and …

Go, The Standard Library Available

· Posted in Books
It's actually happening. I'm writing a book. I saw a gap in the programming world. Most languages have an extensive standard library and core that a lot of programmers are missing out on. I was doing things the long way because I just didn't know the standard library had something built in. I'm trying to fill that gap with deep looks at the standard library of your favorite language. My first step is called Go, The Standard Library, about the ne…

Idiomatic Go Channel Timeout

· Posted in Programming
I've been doing a lot of Go programming lately, and it's good stuff. Go is a fairly new programming language coming out of Google from the minds of some really smart people, like Rob Pike and Russ Cox (among others). It's a C family language, so it has curly braces, has simple yet advanced concurrency features, and garbage collection. It's both high and low level, and was originally billed as a systems programming language. Now though, it seems …

My Watch List, Into 2010

· Posted in Software
Lots of interesting things are afoot, and I try to keep track of them. Here's what I'm watching. Rails 3 Lots of new changes are coming with Rails 3, and it's pretty exciting. I wrote about some of the cool ones here. Rails is shaping up to be faster, more modular, and generally better and easier to work with. With all the smart people working on it, you don't have to look very hard to realize this is going to be a big release, and is only going…