Go in a nutshell

By design, Go has a simple syntax. Its designers wanted to create a language that is clear, concise, and consistent with few syntactic surprises. When reading Go code, keep this mantra in mind: what you see is what it is. Go shies away from a clever and terse coding style in favor of code that is clear and readable as exemplified by the following program:

// This program prints molecular information for known metalloids // including atomic number, mass, and atom count found // in 100 grams of each element using the mole unit. // See http://en.wikipedia.org/wiki/Mole_(unit) package main import "fmt" const avogadro float64 = 6.0221413e+23 const grams = 100.0 type amu float64 func (mass amu) float() float64 { return float64(mass) ...

Get Learning Go Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.