top | item 4472923

Free Book: An Introduction to Programming in Go

297 points| cdoxsey | 13 years ago |golang-book.com

70 comments

order
[+] victork2|13 years ago|reply
Thanks, I really want to get serious with that language seeing all the praise from people around. I have began to do some small things with it and it feels like a great language ( I love the no makefile idea !)

My only regret is that this format makes it really hard to print in one motion. Could you provide a link for a PDF version?

The animal on the cover looks really hilarious too!

[+] trustfundbaby|13 years ago|reply
yes, please provide a pdf version (free or paid, doesn't matter for me) ... oftentimes authors will make a kindle version of the book for sale on Amazon and forget to put out a pdf.
[+] netghost|13 years ago|reply
Another great resource is "A Tour of Go": http://tour.golang.org/

You can also install a local version, I've been working through it, and it's great for fiddling with on the plane.

[+] spiffworks|13 years ago|reply
Going through the source code for that tour is also a very good way of getting familiar with the http package and a good introduction to channels.
[+] nhebb|13 years ago|reply
@cdoxsey - Nice work, but you might link to an installer that doesn't include a text editor. I'd be willing to bet that the majority of the target audience already has their preferred text editor installed.

Edit: After reading the first few chapters, I made a false assumption. It looks like the book is aimed at people new to computing (or, at least, it doesn't make the assumption that the reader has programmed before).

[+] akldfgj|13 years ago|reply
http://golang.org/doc/install

I guess the target audience is programming novices who have never written anything like source code before. Go seems like a strange choice for a first language, being neither foundational (C, Assembler, Scheme/Lisp) nor front-end scripty (JS, Logo, Scratch).

[+] lsiebert|13 years ago|reply
I'm kinda bummed that it doesn't cover installing to linux.

Not that installing Linux is difficult, just that A. I suspect we'll see a lot more people on Linux computers, especially in the developing world, and B. beginning programmers should be introduced to the concept of Linux as a programming environment

[+] georgemcbay|13 years ago|reply
There's really not much point in covering that in a book beyond pointing you to http://golang.org/doc/install

Go is dead simple to install to Linux via either binary or source. Even building it from scratch on non-standard Linux systems like embedded armv5 systems is easy. Basically if you have a non-broken gcc already, go will build just by invoking one single shell script they provide.

[+] Evbn|13 years ago|reply
Does B make sense? First install a new OS before learning what a loop is?
[+] emehrkay|13 years ago|reply
Thanks for this. I scanned the document and the language seems pretty straight forward, should be easy to learn. I did a search for classes and object oriented in the document (pdf) and it returned no results.

I did a web search and came up with this https://sites.google.com/site/gopatterns/object-oriented/cla..., maybe the book should reference that somewhere early (maybe not because the intro seems to touch on computer programming in general so I would assume that it was for first-time programmers).

[+] cdoxsey|13 years ago|reply
Go doesn't have classes. I agree that it'd make sense to talk about them in a book aimed at C# or Java programmers, but this book is written for people who are new to programming.
[+] noirman|13 years ago|reply
Love the format (especially reading from mobile). Thanks for the free book!
[+] cjdrake|13 years ago|reply
The TIOBE programming community index rates Go as not being in the top fifty languages used today. That seems strange since it was the "language of the year" in 2009.

http://www.tiobe.com/index.php/content/paperinfo/tpci/index....

I like Go, and it gets a lot of good press. Is TIOBE not accurately portraying Go's popularity?, or is there some other explanation as to why few people use it?

Sorry, not related to the book (which looks cool, btw).

[+] akldfgj|13 years ago|reply
TIOBE has always been a joke, and only even attempt to manage language chatter, not usage. It is based off job boards and internet search trends, and is highly susceptible to homonym confusion, which is especially harmul in the case of "go".
[+] Gazler|13 years ago|reply
I really like the structure of this, very readable and a great intro. I have some confusion on http://www.golang-book.com/6

It says:

Go also provides a shorter syntax for creating arrays:

x := [5]float64{ 98, 93, 77, 82, 83 }

We no longer need to specify the type because Go can figure it out. Sometimes arrays like this can get too long to fit on one line, so Go allows you to break it up like this:

However the type is specified as `float64`

[+] cdoxsey|13 years ago|reply
I meant you didn't need this:

var x [5]float64 = [5]float64{ 98, 93, 77, 82, 83 }

But I explained ":=" earlier so I can see how that would be confusing.

[+] zemo|13 years ago|reply
he means the type of the individual elements. Each element is of type float64, not int.
[+] nyan_sandwich|13 years ago|reply
vs Java-like

float64 myfloat64array[] = new(float64[5], ...)

[+] esschul|13 years ago|reply
It's nice, but I wish there was a summary page of the syntax. As an experienced coder, I don't really need to understand the concept of a map, only how it's done in go, and maybe restrictions.
[+] Kilimanjaro|13 years ago|reply
Can't help it, but it needs some more padding:

    #container { padding:60px }
Btw, great resource, the more the merrier.
[+] jamesbritt|13 years ago|reply
What's the best way to install Go on Linux (Ubuntu in particular)?

Build from source? Any caveats?

[+] jlgreco|13 years ago|reply
Building Go from source is trivial if you want to do that (two commands, one of which just grabs the Hg repo iirc. building only takes a few minutes on my underpowered eeepc.), but you may as well just use the binary distributions of it.
[+] alexk7|13 years ago|reply
I'm worried about Gordon the Gopher. He can't reach the pedals. :)
[+] lanna|13 years ago|reply
I would have named the book "Go Learn Yourself"
[+] lanna|13 years ago|reply
Or "Go Code Yourself"
[+] xtracto|13 years ago|reply
Any chance of providing an ePub version?