O'Reilly logo

Go: Design Patterns for Real-World Projects by Mat Ryer, Mario Castro Contreras, Vladimir Vivien

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required