<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>explorations into google’s new language by nick quaranto</description><title>go</title><generator>Tumblr (3.0; @golang)</generator><link>http://golang.tumblr.com/</link><item><title>The Changelog Podcast - Interview with Rob Pike</title><description>&lt;a href="http://thechangelog.com/post/259401776/episode-0-0-3-googles-go-programming-language"&gt;The Changelog Podcast - Interview with Rob Pike&lt;/a&gt;</description><link>http://golang.tumblr.com/post/604606130</link><guid>http://golang.tumblr.com/post/604606130</guid><pubDate>Sun, 16 May 2010 15:55:37 -0400</pubDate></item><item><title>Why Google's Go is a Bore</title><description>&lt;a href="http://monoc.mo.funpic.de/go-rant/"&gt;Why Google's Go is a Bore&lt;/a&gt;</description><link>http://golang.tumblr.com/post/590644672</link><guid>http://golang.tumblr.com/post/590644672</guid><pubDate>Tue, 11 May 2010 18:43:49 -0400</pubDate></item><item><title>Asynchronous Go API idioms </title><description>&lt;a href="http://jb55.com/132/asynchronous-go-api-idioms/"&gt;Asynchronous Go API idioms &lt;/a&gt;</description><link>http://golang.tumblr.com/post/590641597</link><guid>http://golang.tumblr.com/post/590641597</guid><pubDate>Tue, 11 May 2010 18:42:26 -0400</pubDate></item><item><title>Rob Pike on Go</title><description>&lt;iframe width="400" height="300" src="http://www.youtube.com/embed/rKnDgT73v8s?wmode=transparent&amp;autohide=1&amp;egm=0&amp;hd=1&amp;iv_load_policy=3&amp;modestbranding=1&amp;rel=0&amp;showinfo=0&amp;showsearch=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Rob Pike on Go&lt;/p&gt;</description><link>http://golang.tumblr.com/post/590638585</link><guid>http://golang.tumblr.com/post/590638585</guid><pubDate>Tue, 11 May 2010 18:41:05 -0400</pubDate></item><item><title>Hacker News: An Introduction to Google's Go Programming Language</title><description>&lt;a href="http://news.ycombinator.com/item?id=1263394"&gt;Hacker News: An Introduction to Google's Go Programming Language&lt;/a&gt;</description><link>http://golang.tumblr.com/post/519785796</link><guid>http://golang.tumblr.com/post/519785796</guid><pubDate>Tue, 13 Apr 2010 22:51:25 -0400</pubDate></item><item><title>release.2010-03-30</title><description>&lt;a href="http://groups.google.com/group/golang-nuts/browse_thread/thread/7f4d3e74d90a3ad0"&gt;release.2010-03-30&lt;/a&gt;: &lt;p&gt;Maps now return a default value! Not really sure of the other features yet or what they mean, need to look into &lt;a href="http://golang.org/doc/go_spec.html#Handling_panics"&gt;panic and recover&lt;/a&gt; more though.&lt;/p&gt;</description><link>http://golang.tumblr.com/post/485943166</link><guid>http://golang.tumblr.com/post/485943166</guid><pubDate>Wed, 31 Mar 2010 01:05:23 -0400</pubDate></item><item><title>Broken abstractions in Go</title><description>&lt;a href="http://research.swtch.com/2010/03/broken-abstractions-in-go.html"&gt;Broken abstractions in Go&lt;/a&gt;</description><link>http://golang.tumblr.com/post/484136343</link><guid>http://golang.tumblr.com/post/484136343</guid><pubDate>Tue, 30 Mar 2010 09:04:40 -0400</pubDate></item><item><title>Rendering distance fields using the Go-language</title><description>&lt;a href="http://www.infi.nl/blog/view/id/47/Rendering_distance_fields_using_the_Go_language"&gt;Rendering distance fields using the Go-language&lt;/a&gt;</description><link>http://golang.tumblr.com/post/482069157</link><guid>http://golang.tumblr.com/post/482069157</guid><pubDate>Mon, 29 Mar 2010 13:38:30 -0400</pubDate></item><item><title>Proposal for an exception-like mechanism</title><description>&lt;a href="http://groups.google.com/group/golang-nuts/browse_thread/thread/1ce5cd050bb973e4?pli=1"&gt;Proposal for an exception-like mechanism&lt;/a&gt;</description><link>http://golang.tumblr.com/post/473027259</link><guid>http://golang.tumblr.com/post/473027259</guid><pubDate>Thu, 25 Mar 2010 15:35:38 -0400</pubDate></item><item><title>autodetect go.vim highlighting</title><description>&lt;p&gt;Instead of constantly having to hit &lt;code&gt;:setf go&lt;/code&gt; when editing your Go files in vim, just drop this into &lt;code&gt;~/.vim/ftdetect/go.vim&lt;/code&gt;:

&lt;pre&gt;&lt;code&gt;autocmd BufNewFile,BufReadPost *.go set filetype=go
&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;</description><link>http://golang.tumblr.com/post/470791323</link><guid>http://golang.tumblr.com/post/470791323</guid><pubDate>Wed, 24 Mar 2010 16:07:28 -0400</pubDate></item><item><title>go.vim : Syntax file for the Go programming language</title><description>&lt;a href="http://www.vim.org/scripts/script.php?script_id=2854"&gt;go.vim : Syntax file for the Go programming language&lt;/a&gt;</description><link>http://golang.tumblr.com/post/466480762</link><guid>http://golang.tumblr.com/post/466480762</guid><pubDate>Mon, 22 Mar 2010 18:31:52 -0400</pubDate></item><item><title>Installing Go on Ubuntu</title><description>&lt;a href="http://rubayeet.wordpress.com/2009/11/13/installing-go-on-ubuntu/"&gt;Installing Go on Ubuntu&lt;/a&gt;</description><link>http://golang.tumblr.com/post/466448178</link><guid>http://golang.tumblr.com/post/466448178</guid><pubDate>Mon, 22 Mar 2010 18:15:20 -0400</pubDate></item><item><title>regexp.MatchString</title><description>&lt;p&gt;Everyone loves Regular Expressions, right? Instead of writing an annoying parser for our first assignment, &lt;a href="http://www.cs.rit.edu/~ats/go-2009-3/1/problem.xml"&gt;expr&lt;/a&gt;, it was definitely easier to just use Go&amp;#8217;s built in &lt;code&gt;regexp&lt;/code&gt; package.

The easiest way is just to use &lt;code&gt;regexp.MatchString&lt;/code&gt;:

&lt;pre&gt;&lt;code&gt;matched, error := regexp.MatchString("[0-9]+", "1337")&lt;/code&gt;&lt;/pre&gt;

This returns a boolean, &lt;code&gt;matched&lt;/code&gt;, and an &lt;code&gt;os.Error&lt;/code&gt; in the second variable. This whole multiple return thing is pretty crazy.

So using it in an if statement is a bit clunky if we want to do it in one line. Here&amp;#8217;s a short example:

&lt;pre&gt;&lt;code&gt;package main

import (
	"os"
	"regexp"
	"fmt"
)

func main() {
  if len(os.Args) == 1 {
    fmt.Println("Usage: regexp [string]")
    os.Exit(1)
  } else if m, _ := regexp.MatchString("^[0-9]+$", os.Args[1]); m {
    fmt.Println("Totally numbers")
  } else {
    fmt.Println("Totally not numbers")
  }
}&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;% ./bin/regexp 
Usage: regexp [string]

% ./bin/regexp 1234
Totally numbers

% ./bin/regexp abcd
Totally not numbers

% ./bin/regexp 12zx34
Totally not numbers&lt;/pre&gt;

I suppose it could be two lines, but why bother? Check out the &lt;a href="http://golang.org/pkg/regexp"&gt;package documentation&lt;/a&gt; for more, and the code is &lt;a href="http://github.com/qrush/go/tree/master/regexp/"&gt;here on GitHub&lt;/a&gt;.&lt;/p&gt;</description><link>http://golang.tumblr.com/post/450853281</link><guid>http://golang.tumblr.com/post/450853281</guid><pubDate>Mon, 15 Mar 2010 19:03:32 -0400</pubDate></item><item><title>git precommit hook for gofmt </title><description>&lt;p&gt;It&amp;#8217;s no surprise I like Ruby, and &lt;a href="http://golang.org/cmd/gofmt/"&gt;gofmt&lt;/a&gt; is a great idea I wish Ruby could enforce. Instead of forgetting to run it constantly, let&amp;#8217;s have git run it. In your &lt;code&gt;.git/hooks/pre-commit&lt;/code&gt;:

&lt;pre&gt;&lt;code&gt;#!/usr/bin/env ruby
Dir["**/*.go"].each do |go|
  if File.basename(go) !~ /^_/
    puts "gofmt #{go}"
    system("gofmt -w=true #{go} &amp;amp;&amp;amp; git add #{go}")
  end
end&lt;/code&gt;&lt;/pre&gt;

Make sure you run &lt;code&gt;chmod a+x&lt;/code&gt; on that hook too. Also, this will mess up any incremental commits with &lt;code&gt;git add -p&lt;/code&gt;, but you can use &lt;code&gt;git commit --no-verify&lt;/code&gt; to bypass the hooks if you need to.&lt;/p&gt;</description><link>http://golang.tumblr.com/post/439868556</link><guid>http://golang.tumblr.com/post/439868556</guid><pubDate>Wed, 10 Mar 2010 18:37:00 -0500</pubDate></item><item><title>flag</title><description>&lt;p&gt;Checking out the &lt;a href="http://golang.org/pkg/flag/#PrintDefaults"&gt;flag package&lt;/a&gt;, Go&amp;#8217;s built in command line argument parser. Here&amp;#8217;s a simple example:

&lt;pre&gt;&lt;code&gt;// 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);
}&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;# Makefile
include $(GOROOT)/src/Make.$(GOARCH)
 
TARG=flag
GOFILES=\
        flag.go
 
include $(GOROOT)/src/Make.cmd
&lt;/code&gt;&lt;/pre&gt;

Compile and run away:

&lt;pre&gt;% make
/Users/qrush/Progs/8g -o _go_.8 flag.go
/Users/qrush/Progs/8l -o flag _go_.8

% ./flag
Testing out flags!
areacode has value  716

% ./flag -areacode=585
Testing out flags!
areacode has value  585&lt;/pre&gt;

Mindblowing, I know. Also cool: &lt;code&gt;flag.PrintDefaults()&lt;/code&gt; gives a nice printout of the command line arguments with default values.&lt;/p&gt;</description><link>http://golang.tumblr.com/post/439732032</link><guid>http://golang.tumblr.com/post/439732032</guid><pubDate>Wed, 10 Mar 2010 17:22:00 -0500</pubDate></item><item><title>gofmt</title><description>&lt;p&gt;From the &lt;a href="http://golang.org/doc/go_faq.html"&gt;FAQ&lt;/a&gt;:

&lt;blockquote&gt;&amp;#8230;the program gofmt is a pretty-printer whose purpose is to enforce layout rules; it replaces the usual compendium of do&amp;#8217;s and don&amp;#8217;ts that allows interpretation. All the Go code in the repository has been run through gofmt.&lt;/blockquote&gt;

&lt;pre&gt;
usage: gofmt [flags] [path ...]
  -tabwidth=8: tab width
  -trace=false: print parse trace
  -r="": rewrite rule (e.g., 'α[β:len(α)] -&amp;gt; α[β:]')
  -debug=false: print debugging information
  -tabindent=true: indent with tabs independent of -spaces
  -l=false: list files whose formatting differs from gofmt's
  -w=false: write result to (source) file instead of stdout
  -spaces=true: align with spaces instead of tabs
  -comments=true: print comments
&lt;/pre&gt;&lt;/p&gt;</description><link>http://golang.tumblr.com/post/439627427</link><guid>http://golang.tumblr.com/post/439627427</guid><pubDate>Wed, 10 Mar 2010 16:26:32 -0500</pubDate></item><item><title>go-repl</title><description>&lt;a href="http://github.com/qrush/go-repl"&gt;go-repl&lt;/a&gt;: &lt;p&gt;Took some hacking to get working since recently in go the way to convert a String into a series of Bytes changed:

&lt;pre&gt;
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) -&gt; []byte(x)' -w file-or-directory-list
gofmt -r 'strings.Runes(x) -&gt; []int(x)' -w file-or-directory-list

After running these you might need to delete unused imports of the
"strings" package.&lt;/pre&gt;

Fixed now and works on my machine™, granted you put semicolons at the end of lines in the REPL.&lt;/p&gt;</description><link>http://golang.tumblr.com/post/439511318</link><guid>http://golang.tumblr.com/post/439511318</guid><pubDate>Wed, 10 Mar 2010 15:16:00 -0500</pubDate></item><item><title>hg log -r 0:4</title><description>&lt;p&gt;&lt;pre&gt;&lt;code&gt;changeset:   0:f6182e5abf5e
user:        Brian Kernighan &amp;lt;bwk&amp;gt;
date:        Tue Jul 18 19:05:45 1972 -0500
summary:     hello, world

changeset:   1:b66d0bf8da3e
user:        Brian Kernighan &amp;lt;bwk&amp;gt;
date:        Sun Jan 20 01:02:03 1974 -0400
summary:     convert to C

changeset:   2:ac3363d7e788
user:        Brian Kernighan &amp;lt;research!bwk&amp;gt;
date:        Fri Apr 01 02:02:04 1988 -0500
summary:     convert to Draft-Proposed ANSI C

changeset:   3:172d32922e72
user:        Brian Kernighan &amp;lt;bwk@research.att.com&amp;gt;
date:        Fri Apr 01 02:03:04 1988 -0500
summary:     last-minute fix: convert to ANSI C

changeset:   4:4e9a5b095532
user:        Robert Griesemer &amp;lt;gri@golang.org&amp;gt;
date:        Sun Mar 02 20:47:34 2008 -0800
summary:     Go spec starting point.&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;</description><link>http://golang.tumblr.com/post/439434744</link><guid>http://golang.tumblr.com/post/439434744</guid><pubDate>Wed, 10 Mar 2010 14:22:40 -0500</pubDate></item><item><title>Installing Go on OSX 10.5</title><description>&lt;p&gt;Heavily inspired by &lt;a href="http://www.kelvinwong.ca/2009/11/12/installing-google-go-on-mac-os-x-leopard/"&gt;this blog post&lt;/a&gt;. With MacPorts installed:

&lt;pre&gt;
sudo port install python easy_install
sudo easy_install -U mercurial
&lt;/pre&gt;

In your .zshrc:

&lt;pre&gt;
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]
&lt;/pre&gt;

Run:

&lt;pre&gt;
source .zshrc
hg clone -r release &lt;a href="https://go.googlecode.com/hg/"&gt;https://go.googlecode.com/hg/&lt;/a&gt; $GOROOT
cd $GOROOT/src
./all.bash 
&lt;/pre&gt;

That should stick some binaries into your GOBIN directory. Create a helloworld.go:

&lt;pre&gt;
package main

import fmt "fmt"

func main() {
  fmt.Printf("HELLO WORLD");
}
&lt;/pre&gt;

Then run&amp;#8230;

&lt;pre&gt;
$ 8g helloworld.go
$ 8l helloworld.8
$ ./8.out
HELLO WORLD
&lt;/pre&gt;&lt;/p&gt;</description><link>http://golang.tumblr.com/post/435551237</link><guid>http://golang.tumblr.com/post/435551237</guid><pubDate>Mon, 08 Mar 2010 18:58:00 -0500</pubDate></item></channel></rss>
