
With book on Go, Kernighan guides students at Princeton and beyond - baijum
https://www.princeton.edu/main/news/archive/S45/61/59I61/index.xml
======
alblue
I wrote a review of this book at InfoQ earlier this year:

[http://www.infoq.com/articles/the-go-programming-language-
bo...](http://www.infoq.com/articles/the-go-programming-language-book-review)

There's a free chapter available from the book's website
[http://gopl.io](http://gopl.io) which should give you an idea of what the
rest of the book is like. The intro goes into a little bit too much detail but
if you gloss over that the remaining chapters are pretty else detailed. There
are some nuggets distributed through the book but you could easily gloss over
them if you were skim reading it, such as learning that exported identifiers
begin with an upper case letter and those that are private are lower case.

~~~
ape4
from the book: The Body stream is closed to avoid leaking resources.

I would have thought that a modern language would automatically take care of
such things.

~~~
jerf
I'm not sure exactly where you see that so I'm not entirely sure of the
context (I tried looking in the first chapter), but a general problem with
garbage-collected languages is that while the runtime will eventually get
around to cleaning up unused resources, you don't always have guarantees about
when. So you still generally need to close files when you're done with them,
or you may run out of filehandles. I've encountered this issue in multiple
languages, it's not Go-specific.

~~~
ape4
Its on page 16 when they are showing how to download multiple urls
concurrently - which is cool. In Firefox Ctrl-F "leak" works for me.
[http://www.gopl.io/ch1.pdf](http://www.gopl.io/ch1.pdf)

------
rottencupcakes
I should have figured out context based on the name Kernighan, but the word Go
(especially as it relates to google) is awfully overloaded for the time being.

~~~
oneeyedpigeon
Fooled me too. Aren't we supposed to refer to it as "golang" for this very
reason?

~~~
ArmandGrillet
The language is officially called Go and often referenced as Golang.

Go should be rebranded Golang (while keeping the go command) in my opinion:
the language is still fairly young and has been developed to be the C for the
21st century but "Go" is nearly as bad regarding SEO as "C".

There is still time to change the name before Go becomes the programming
language taught to people who start programming (and are googling a lot to
learn more about it). I would also love to see this transformation so that I
can finally know if the new trendiest article on HN is about AI or Golang!

~~~
echelon
Do you think Go will become "the" language students and beginners are taught?
Why? (I'm genuinely curious!)

~~~
ArmandGrillet
I (and a lot of other French students) have started programming during my
bachelor's mainly in Java and C. I now develop in Golang and I know it would
have been better for me to start with it:

\- The logic of Golang is straightforward, e.g. you need to import the package
fmt to do a fmt.Println("") in Golang but you do not need to explicitly import
anything to do a System.out.println("") in Java. Some things could still be
weird for a beginner, e.g. methods like len(), but the official documentation
gives a clear explanation about a lot of things.

\- gofmt, the best way for a beginner to understand what is pretty code.
Golang forces you to write clear code (e.g. no unused variable) and that is an
excellent way to learn as a beginner.

\- The goroutines / gochannels are simple to understand, I wish I would have
started concurrent programming by developing in Golang instead of C.

\- Golang works on every computers and installing it is simple (simpler than
installing Java and Eclipse).

This list is subjective, other languages like Python are also excellent for
new developers from what I heard but Golang could also do the job.

~~~
masklinn
> \- The logic of Golang is straightforward, e.g. you need to import the
> package fmt to do a fmt.Println("") in Golang but you do not need to
> explicitly import anything to do a System.out.println("") in Java.

You don't need to import println in Go[0]. The logic is exactly the same[1]:
there's a pre-imported "prelude" (java.lang in Java, builtin in Go) and you
import the rest.

> \- Golang works on every computers and installing it is simple (simpler than
> installing Java and Eclipse).

Why do you have to install go alone but java _and eclipse_?

[0]
[https://play.golang.org/p/ZWLaVuJNgq](https://play.golang.org/p/ZWLaVuJNgq)
you don't need to import append or cap or complex128 either

[1] and the same as in more or less every language out there

------
clishem
I have read the book this article is referring to. Contrary to the raving
reviews on Amazon, I wasn't that impressed by it. I imagine that it is a great
book for those coming from dynamically typed languages, but if you already
know C, for example, the book is probably way too verbose for you.

~~~
dominotw
I tried to power through it last month but couldn't do it despite my best
intentions.

Book is a major snoozefest and nothing like its famous cousin 'The C
programming language' . I credit the C programming language as one of the
books that made my choose writing code as a career. This book on contrary can
make no such claims.

Save your money and stay away from it.

~~~
_ph_
I would have quite the contrary verdict: if you are an experienced programmer
and want to read a book about Go, this is the book to get. If you are a
programmer, any book which tries to cover a language thoroughly will have slow
parts, because they might not be entirely new to you. Yet they need to be told
to be thorough. But this book is way faster paced than many books about a
programming languages and it is full of short programs, which pack a lot of
functionality in a few lines of code - often a small eye-opener.

~~~
skybrian
But if you're an experienced programmer, why get a book at all? Effective Go
and the Go language specification (which unlike most specifications is very
readable) tell you what you need to get started.

~~~
_ph_
Oh, I got myself started with online resources and was using Go for some
months when I got the book - I mostly got it because of the author, to match
my "The C programming language". And because I was reasonably fluent with Go,
certainly some parts were redundant for my knowledge, but I was very
pleasantly surprised how much I still learned from this book and that is why I
recommend it. Sometimes it was a little detail in the sample programs which
made me say: oh, I had not thought of that.

------
bitteralmond
The magic of Kernighan:

"When we were choosing among typesetting systems, Brian never let on that he
was one of the original authors of Troff, the system we ultimately went with,"
Donovan said. "I realized this only after researching many early papers on
digital typesetting; Brian co-wrote all of them."

~~~
erikpukinskis
It's funny how times change. My first thought was "that's a conflict of
interest and it would've been polite to mention it." He apparently doesn't
believe that his collaborators might have their own ways of dealing with
conflicts. But then: I think it's a generational thing. He is from a world
where people have simple allegiances and hidden conflicts are rare. In the
Internet age relationships are so fragmented conflicts of interest are part of
the day to day collaboration process.

------
DocSavage
Brett Slatkin wrote a positive review from the perspective of an experienced
Go programmer: [http://www.onebigfluke.com/2016/03/book-review-go-
programmin...](http://www.onebigfluke.com/2016/03/book-review-go-programming-
language.html)

------
kozukumi
golang is a nice language but I just can't find a reason to use it over other
languages for anything other than networking/server projects.

How many HN readers are using golang for things you would normally use Java or
C++ or Python or ... for? What is it you are working on? And how have you
found using golang?

~~~
iheartmemcache
Originally it was positioned as a 'systems' programming language (i.e. the
C/C++/Rust/D domain) - the community quickly re-oriented itself to more of a
Python replacement for the obvious benefits it offered.

Network/server projects is exactly what I see it being handy at. You get a
fast compile-time language that can do things with your logs/analytic
aggregate information in an ad-hoc fashion (really fast compile times and
better-than-dynamic-languages-performance), which previously would have costed
a lot of time in learning the whole Pig/Hadoop/etc ecosystem or a lot of money
in any of the BusinessObjects-esque tooling.

Gofmt eliminated styling wars, go doc integration is handy, great 'batteries
included' tools out of the box for, typing safety that's comfortable for
people who are used to dynamically typed languages to move over without too
much hassle[1]. Out of the box code-coverage tooling, good DVCS support,
import support for Github is clever (though arguably not the best idea re:
security, handy nonetheless since you avoid having YetAnotherPackageManagerWar
(pip vs setuptools in Python). The lack of generics (interface{} is such a
hack, just like void * in C) is problematic for some, unfortunately.

I don't use Go much because I'm a self-admitted typed language elitist but it
is definitely a well-designed language[2].

[1] I don't think the average Pythoner really wants to think about
co/contravariance unlike in Scala, or Haskell98's type system + the bevy of
lang extensions that fall in and out of fashion. [2] Though there's tons of
room for improvement-- my hope is that Go moves at the Meijers-C# pace which
seems to be a perfect trade-off between adding features not too slowly (i.e.
the first 15 years of Java/JVM -- only recently has this changed) but not too
quickly either (stability is certainly important, no one wants to see their
old code break because a new keyword was added which you previously used as a
variable; or far worse, subtle semantic changes in pre-existing constructs).

~~~
Animats
Go was created to do what Google does - server side software run in huge data
centers. C++ was too bug-prone, and Python was too slow. Go has the right
feature set for that job. Google then provided good libraries for most of the
things you'd want to do on a server. It lets mid-level programmers do
competent work without much trouble.

It's not a great choice for operating system development, real time work,
client side code, graphics, games, supercomputing, or "frameworks". That's OK.
For the job it was designed to do, the features are there.

~~~
unscaled
The main problem with Go is that it was originally pushed by its developers as
the perfect language for these applications, and it's still actively pushed as
a systems language in some circles.

The Go language FAQ still states that no "No major systems language has
emerged in over a decade". Besides ignoring the system languages which did
emerge, this sentence misleads the reader into thinking that Go is a systems
language.

And I'm not talking about garbage collection here, which is often cited as why
Go can't be a systems language. GC makes it hard to write some of the
applications of a systems programming language, such as OS kernels and games,
but it's not mutually exclusive, and OSes have been written in GC languages
before (Lisp Machines, Singularity with Sing#). It's the entire approach: Go
offers its own scheduler (which is really great, but if you need to use
something else, you're in for some pain) and no support of writing dynamically
linked modules. It makes go very inconvenient for most common system
applications, unfortunately. Essentially, it's manages to be less high level
than C++ (it has fewer robust typing and features), while not being low level
enough to beat C++ in the same time (very inflexible binary target, GC-only,
no inline assembly).

~~~
Animats
Go, the language, is better than Go, the PR. The early promotional materials
claimed way too much. Some of those documents are still out there, especially
"Effective Go". But the language, although overhyped, came out OK.

Go is really the successor to Java and COBOL. It's what you write your
business logic in. We needed that. Java had accumulated too much excess
baggage.

------
muyfine
On the positive side, taking COS 333 with Kernighan could not possibly be
worse than taking it with Koenig!

------
frik
Direct link to the books website: [http://www.gopl.io/](http://www.gopl.io/)

------
dominotw
does gooracle work with 1.6 vendoring ? I can't seem to find an issue tracker
for the project.

------
gravypod
I don't understand why we "need" textbooks, specifically in the world of
Computer Science. Most of the amazing work done to make computers are what
they are today is available online.

~~~
danieldk
Carefully crafted textbooks are comprehensive, balanced, and have a good
learning curve (not too steep, not too shallow). Perhaps as importantly, they
are edited and contain far fewer errors than a typical blog or Stack Overflow
post. As such, they are invaluable as an introduction to new topics.

Just to give an example: reading Hopcroft, Motwani & Ullman is far more
effective than trying to scrape together automata theory via blog posts or
Stack Overflow. As a beginner, you can't even identify what is correct and
what is wrong.

~~~
gravypod
Maybe it's just the books for my course, but I have never seen a book with up
to day information, a lack of spelling/subject matter errors, and an easily
digestible format.

Every textbook I buy has turned into a huge paper weight.

Can you recommend some textbooks that aren't like that? I'm interested in EE,
CE, and CS (Software engineering, DSP, and concurrency).

~~~
danieldk
_Maybe it 's just the books for my course, but I have never seen a book with
up to day information_

Basic CS theory does not really get outdated. There's a couple of dozens book
that I could recommend. Anything from Sedgewick & Wayne to Hopcroft, Motwani &
Ullman.

~~~
gravypod
The theory might not be out of date, but the notes on implementation are
quickly outpaced.

------
plg
Page margins are so small!

~~~
rangibaby
I had a look at the PDF and the margins are normal for a magazine, but the
font size is what I would consider normal for a book, which means there are
too many words per line.

For designers: technical publications should have larger margins than a
magazine, to leave room for notes, and smaller margins than a book, to save
room for graphics.

~~~
pklausler
As an interesting aside, the article points out that the book was formatted
with troff.

~~~
kps
As was _The C Programming Language_ 38+ years ago — at about the same time as
troff was rewritten in C. Maybe it would have been appropriate to rewrite
troff in Go for this one!

~~~
pklausler
And by the same programmer, namely the author.

------
dbpokorny
What problems would you rather attack with C + Go vs. a somewhat more mature C
+ Python?

~~~
weberc2
As someone who has much more experience with Python, the only time I reach for
Python is the odd case where there isn't a comparable Go library (think pyqt).
Writing Go programs is just easier than Python--the language is much simpler,
static typing is a huge boon, documentation for all packages is available at
godoc.org in a consistent format, great standard library, single-binary
deployment, great concurrency, more performant, standard formatting, standard
testing tools, better static analysis support (IDEs can autocomplete, for
example), etc.

~~~
rhodysurf
FYI [https://github.com/visualfc/goqt](https://github.com/visualfc/goqt)

~~~
weberc2
Thanks; I'm aware. The project is nowhere near mature though. Not compared to
the Python Qt bindings, anyway. It's also not actively developed.

