Get Programming with Go
Nathan Youngman, Roger Peppe
  • MEAP began October 2015
  • Publication in September 2018 (estimated)
  • ISBN 9781617293092
  • 360 pages (estimated)
  • printed in black & white

A great book about Go, written for beginners but useful for the seasoned developer too.

Mikael Dautrey

Get Programming with Go introduces you to the powerful Go language without the confusing jargon or high-level theory. By working through 32 quick-fire chapters, you'll quickly pick up the basics of the innovative Go programming language! Most of the examples in this book can be executed in the Go playground, so you don't need to worry about setting up a practice environment. Chock-full of engaging projects, you'll crack ancient ciphers, discover the wonders of cellular automatons, plan a vacation on Mars, and direct rovers to gather weather data!

Table of Contents detailed table of contents



Nathan Youngman

Roger Peppe

About this book

Code conventions and downloads
Author Online
About the authors

Unit 0: Getting started

Lesson 1 Get ready, get set, Go

1.1 What is Go?

1.2 The Go Playground

1.3 Packages and functions

1.4 The one true brace style

1.5 Summary

1.6 Try this

1.7 Answers to quick checks

Unit 1: Imperative programming

Lesson 2 A glorified calculator

2.1 Performing calculations

2.2 Formatted print

2.3 Constants and variables

2.4 Taking a shortcut

2.4.1 Declare multiple variables at once

2.4.2 Increment and assignment operators

2.5 Think of a number

2.6 Summary

2.7 Try this

2.8 Answers to quick checks

Lesson 3 Loops and branches

3.1 True or false

3.2 Comparisons

3.3 Branching with if

3.4 Logical operators

3.5 Branching with switch

3.6 Repetition with loops

3.7 Summary

3.8 Try this

3.9 Answers to quick checks

Lesson 4 Variable scope

4.1 Looking into scope

4.2 Short declaration

4.3 Narrow scope, wide scope

4.4 Summary

4.5 Try this

4.6 Answers to quick checks

Lesson 5 Capstone: Ticket to Mars

Unit 2: Types

Lesson 6 Real numbers

6.1 Declaring floating point variables

6.1.1 Single precision floating point numbers

6.1.2 The zero value

6.2 Displaying floating point types

6.3 Floating point accuracy

6.4 Comparing floating point numbers

6.5 Summary

6.6 Try this

6.7 Answers to quick checks

Lesson 7 Whole numbers

7.1 Declaring integer variables

7.1.1 Integer types for every occasion

7.1.2 Knowing your type

7.2 The uint8 type for 8-bit colors

7.3 Integers wrap around

7.3.1 Looking at the bits

7.3.2 Avoid wrapping around time

7.4 Summary

7.5 Try this

7.6 Answers to quick checks

Lesson 8 Big numbers

8.1 Hitting the ceiling

8.2 The big package

8.3 Constants of unusual size

8.4 Summary

8.5 Try this

8.6 Answers to quick checks

Lesson 9 Multilingual text

9.1 Declaring string variables

9.1.1 Raw string literals

9.2 Characters, code points, runes, and bytes

9.3 Pulling the strings

9.4 Manipulating characters with Caesar cipher

9.4.1 A modern variant

9.5 Decoding strings into runes

9.6 Summary

9.7 Try this

9.8 Answers to quick checks

Lesson 10 Converting between types

10.1 Types don’t mix

10.2 Numeric type conversions

10.3 Convert types with caution

10.4 String conversions

10.5 Converting Boolean values

10.6 Summary

10.7 Try this

10.8 Answers to quick checks

Lesson Capstone: The Vigenère cipher

Unit 3: Building blocks<

Lesson 12 Functions

12.1 Function declarations

12.2 Writing a function

12.3 Summary

12.4 Try this

12.5 Answers to quick checks

Lesson 13 Methods

13.1 Declaring new types

13.2 Bring your own types

13.3 Adding behavior to types with methods

13.4 Summary

13.5 Try this

13.6 Answers to quick checks

Lesson 14 First-class functions

14.1 Assigning functions to variables

14.2 Passing functions to other functions

14.3 Declaring function types

14.4 Closures and anonymous functions

14.5 Summary

14.6 Try this

14.7 Answers to quick checks

Lesson 15 Capstone: Temperature tables

Unit 4: Collections

Lesson 16 Arrayed in splendor

16.1 Declaring arrays and accessing their elements

16.2 Don’t go out of bounds

16.3 Initialize arrays with composite literals

16.4 Iterating through arrays

16.5 Arrays are copied

16.6 Arrays of arrays

16.7 Summary

16.8 Try this

16.9 Answers to quick checks

Lesson 17 Slices: windows into arrays

17.1 Slicing an array

17.1.1 Default indices for slicing

17.2 Composite literals for slices

17.3 The power of slices

17.4 Slices with methods

17.5 Summary

17.6 Try this

17.7 Answers to quick checks

Lesson 18 A bigger slice

18.1 The append function

18.2 Length and capacity

18.3 Investigating the append function

18.4 Three-index slicing

18.5 Preallocate slices with make

18.6 Declaring variadic functions

18.7 Summary

18.8 Try this

18.9 Answers to quick checks

Lesson 19 The ever versatile map

19.1 Declaring a map

19.2 Maps are not copied

19.3 Preallocate maps with make

19.4 Using maps to count things

19.5 Grouping data with maps and slices

19.6 Repurposing maps as sets

19.7 Summary

19.8 Try this

19.9 Answers to quick checks

Lesson 20 Capstone: A slice of life

20.1 A new universe

20.2 Looking at the universe

20.3 Seeding live cells

20.4 Implementing the game rules

20.4.1 Dead or alive?

20.4.2 Counting neighbors

20.4.3 The game logic

20.5 Parallel universe

Unit 5: State and behavior

Lesson 21 A little structure

21.1 Declaring a structure

21.2 Reusing structures with types

21.3 Initialize structures with composite literals

21.4 Structures are copied

21.5 A slice of structures

21.6 Encoding structures to JSON

21.7 Customizing JSON with struct tags

21.8 Summary

21.9 Try this

21.10 Answers to quick checks

Lesson 22 Go’s got no class

22.1 Attaching methods to structures

22.2 Constructor functions

22.3 The class alternative

22.4 Summary

22.5 Try this

22.6 Answers to quick checks

Lesson 23 Composition and forwarding

23.1 Composing structures

23.2 Forwarding methods

23.3 Name collisions

23.4 Summary

23.5 Try this

23.6 Answers to quick checks

Lesson 24 Interfaces

24.1 The interface type

24.2 Discovering the interface

24.3 Satisfying interfaces

24.4 Summary

24.5 Try this

24.6 Answers to quick checks

Lesson 25 Capstone: Martian animal sanctuary

Unit 6: Down the gopher hole

Lesson 26 A few pointers

26.1 The ampersand and the asterisk

26.1.1 Pointer types

26.2 Pointers are for pointing

26.2.1 Pointing to structures

26.2.2 Pointing to arrays

26.3 Enabling mutation

26.3.1 Pointers as parameters

26.3.2 Pointer receivers

26.3.3 Interior pointers

26.3.4 Mutating arrays

26.4 Pointers in disguise

26.4.1 Maps are pointers

26.4.2 Slices point at arrays

26.5 Pointers and interfaces

26.6 Use pointers wisely

26.7 Summary

26.8 Try this

26.9 Answers to quick checks

Lesson 27 Much ado about nil

27.1 Nil leads to panic

27.2 Guarding your methods

27.3 Nil function values

27.4 Nil slices

27.5 Nil maps

27.6 Nil interfaces

27.7 An alternative to nil

27.8 Summary

27.9 Try this

27.10 Answers to quick checks

Lesson 28 To err is huma

28.1 Handling errors

28.2 The road to wisdom

28.2.1 Writing a file

28.2.2 The defer keyword

28.2.3 Creative error handling

28.3 New errors

28.3.1 Which error is which

28.3.2 Custom error types

28.4 Don’t panic

28.4.1 Exceptions in other languages

28.4.2 How to panic

28.4.3 Keep calm and carry on

28.5 Summary

28.6 Try this

28.7 Answers to quick checks

Lesson 29 Capstone: Sudoku rules

Unit 7: Concurrent programming

Lesson 30 Goroutines and concurrency

30.1 Starting a goroutine

30.2 More than one goroutine

30.3 Channels

30.4 Channel surfing with select

30.5 Blocking and deadlock

30.6 A gopher assembly line

30.7 Summary

30.8 Try this

30.9 Answers to quick checks

Lesson 31 Concurrent state

31.1 Mutexes

31.1.1 Mutex pitfalls

31.2 Long lived workers

31.3 Try this

31.4 Summary

31.5 Answers to quick checks

Lesson 32 Capstone: Life on Mars

32.1 A grid to rove on

32.2 Life on Mars

Where to Go from here

Under the radar

Beyond the playground

And much more


Appendix A: Solutions

Unit 0

Lesson 1

Unit 1

Lesson 2

Lesson 3

Lesson 4

Capstone 5

Unit 2

Lesson 6

Lesson 7

Lesson 8

Lesson 9

Lesson 10

Capstone 11

Unit 3

Lesson 12

Lesson 13

Lesson 14

Capstone 15

Unit 4

Lesson 16

Lesson 17

Lesson 18

Lesson 19

Capstone 20

Unit 5

Lesson 21

Lesson 22

Lesson 23

Lesson 24

Capstone 25

Unit 6

Lesson 26

Lesson 27

Lesson 28

Capstone 29

Unit 7

Lesson 30

Capstone 32

About the Technology

Are you unsatisfied by the dichotomy between happiness-optimized scripting languages and high performance workhorse languages? Created at Google, Go is designed by and for working programmers who care about performance, reliability, and the experience of writing software. With its restrained and well considered design, Go is approachable to newcomers and refreshing for seasoned polyglots. With Go, you have the tools you need for rapidly building web, cloud, and systems applications. Best of all, it doesn't take long to become productive in Go. Are your ready?

What's inside

  • Broad coverage of Go syntax and features
  • A dip into the expansive standard library
  • Object-oriented design without objects or class
  • The nitty-gritty of memory management

About the reader

Accessible for developers and non-developers looking to get started using Go for modern development. Some familiarity with computer programming concepts is recommended, but not required.

About the authors

Nathan Youngman is a self-taught web developer and lifelong learner. He serves as organizer for the Edmonton Go meetup, mentor for Canada Learning Code, and paparazzi for VIP gopher plushies.

Roger Peppe is a Go contributor, maintains a number of open source Go projects, runs the Newcastle upon Tyne Go meetup, and works on Go cloud infrastructure software.

Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.
MEAP combo $34.99 pBook + eBook + liveBook
MEAP eBook $27.99 pdf + ePub + kindle + liveBook

FREE domestic shipping on three or more pBooks

Get Programming With Go was an amazing introduction into the language.

Thomas Goodheart

Get Programming with Go is the book I wish I had had when I started learning Go a year ago with zero programming experience whatsoever.

Esther Tsai