May 2010
4 posts
The Changelog Podcast - Interview with Rob Pike →
May 16th
Why Google's Go is a Bore →
May 11th
Asynchronous Go API idioms  →
May 11th
May 11th
1 note
April 2010
1 post
Hacker News: An Introduction to Google's Go... →
Apr 14th
1 note
March 2010
14 posts
release.2010-03-30 →
Maps now return a default value! Not really sure of the other features yet or what they mean, need to look into panic and recover more though.
Mar 31st
1 note
Broken abstractions in Go →
Mar 30th
1 note
Rendering distance fields using the Go-language →
Mar 29th
2 notes
Proposal for an exception-like mechanism →
Mar 25th
autodetect go.vim highlighting
Instead of constantly having to hit :setf go when editing your Go files in vim, just drop this into ~/.vim/ftdetect/go.vim: autocmd BufNewFile,BufReadPost *.go set filetype=go
Mar 24th
1 note
go.vim : Syntax file for the Go programming... →
Mar 22nd
1 note
Installing Go on Ubuntu →
Mar 22nd
1 note
regexp.MatchString
Everyone loves Regular Expressions, right? Instead of writing an annoying parser for our first assignment, expr, it was definitely easier to just use Go’s built in regexp package. The easiest way is just to use regexp.MatchString: matched, error := regexp.MatchString("[0-9]+", "1337") This returns a boolean, matched, and an os.Error in the second variable. This whole multiple return thing...
Mar 15th
1 note
git precommit hook for gofmt
It’s no surprise I like Ruby, and gofmt is a great idea I wish Ruby could enforce. Instead of forgetting to run it constantly, let’s have git run it. In your .git/hooks/pre-commit: #!/usr/bin/env ruby Dir["**/*.go"].each do |go| if File.basename(go) !~ /^_/ puts "gofmt #{go}" system("gofmt -w=true #{go} && git add #{go}") end end Make sure you run chmod a+x on...
Mar 10th
6 notes
flag
Checking out the flag package, Go’s built in command line argument parser. Here’s a simple example: // flag.go package main import ( "flag" "fmt" ) var code *int = flag.Int("areacode", 716, "give me your codes") func main() { fmt.Printf("Testing out flags!\n"); flag.Parse(); fmt.Println("areacode has value ", *code); } # Makefile include $(GOROOT)/src/Make.$(GOARCH) ...
Mar 10th
25 notes
gofmt
From the FAQ: …the program gofmt is a pretty-printer whose purpose is to enforce layout rules; it replaces the usual compendium of do’s and don’ts that allows interpretation. All the Go code in the repository has been run through gofmt. usage: gofmt [flags] [path ...] -tabwidth=8: tab width -trace=false: print parse trace -r="": rewrite rule (e.g., 'α[β:len(α)] ->...
Mar 10th
go-repl →
Took some hacking to get working since recently in go the way to convert a String into a series of Bytes changed: There is one language change: the ability to convert a string to []byte or []int. This deprecates the strings.Bytes and strings.Runes functions. You can convert your existing sources using these gofmt commands: gofmt -r 'strings.Bytes(x) -> []byte(x)' -w...
Mar 10th
hg log -r 0:4
changeset: 0:f6182e5abf5e user: Brian Kernighan <bwk> date: Tue Jul 18 19:05:45 1972 -0500 summary: hello, world changeset: 1:b66d0bf8da3e user: Brian Kernighan <bwk> date: Sun Jan 20 01:02:03 1974 -0400 summary: convert to C changeset: 2:ac3363d7e788 user: Brian Kernighan <research!bwk> date: Fri Apr 01 02:02:04 1988...
Mar 10th
Installing Go on OSX 10.5
Heavily inspired by this blog post. With MacPorts installed: sudo port install python easy_install sudo easy_install -U mercurial In your .zshrc: export GOROOT=[path to where you want the language installed] export GOOS=darwin export GOARCH=386 export GOBIN=[path to where you store personal bin files] Run: source .zshrc hg clone -r release https://go.googlecode.com/hg/ $GOROOT cd...
Mar 8th
2 notes