Get Programming with Go
Nathan Youngman, Roger Peppé
  • August 2018
  • ISBN 9781617293092
  • 360 pages
  • printed in black & white

Perfectly organized for learning Go quickly; especially useful for inexperienced programmers.


Get Programming with Go introduces you to the powerful Go language without confusing jargon or high-level theory. By working through 32 quick-fire lessons, you'll quickly pick up the basics of the innovative Go programming language!

About the Technology

Go is a small programming language designed by Google to tackle big problems. Large projects mean large teams with people of varying levels of experience. Go offers a small, yet capable, language that can be understood and used by anyone, no matter their experience.

About the book

Hobbyists, newcomers, and professionals alike can benefit from a fast, modern language; all you need is the right resource! Get Programming with Go provides a hands-on introduction to Go language fundamentals, serving as a solid foundation for your future programming projects. You’ll master Go syntax, work with types and functions, and explore bigger ideas like state and concurrency, with plenty of exercises to lock in what you learn.

Table of Contents detailed table of contents

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


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


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


Lesson 4 Variable scope

4.1 Looking into scope

4.2 Short declaration

4.3 Narrow scope, wide scope


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


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


Lesson 8 Big numbers

8.1 Hitting the ceiling

8.2 The big package

8.3 Constants of unusual size


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


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


Lesson 11 Capstone: The Vigenère cipher

Unit 3 Building blocks

Lesson 12 Functions

12.1 Function declarations

12.2 Writing a function


Lesson 13 Methods

13.1 Declaring new types

13.2 Bring your own types

13.3 Adding behavior to types with methods


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


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


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


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


Lesson 19 The ever-versatile map

19.1 Declaring a map

19.2 Maps aren’t copied

19.3 Preallocating maps with make

19.4 Using maps to count things

19.5 Grouping data with maps and slices

19.6 Repurposing maps as sets


Lesson 20 Capstone: A slice of life

20.1 A new universe

20.1.1 Looking at the universe

20.1.2 Seeding live cells

20.2 Implementing the game rules

20.2.1 Dead or alive?

20.2.2 Counting neighbors

20.2.3 The game logic

20.3 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


Lesson 22 Go’s got no class

22.1 Attaching methods to structures

22.2 Constructor functions

22.3 The class alternative


Lesson 23 Composition and forwarding

23.1 Composing structures

23.2 Forwarding methods

23.3 Name collisions


Lesson 24 Interfaces

24.1 The interface type

24.2 Discovering the interface

24.3 Satisfying interfaces


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


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


Lesson 28 To err is human

28.1 Handling errors

28.2 Elegant error handling

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


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


Lesson 31 Concurrent state

31.1 Mutexes

31.1.1 Mutex pitfalls

31.2 Long-lived workers


Lesson 32 Capstone: Life on Mars

32.1 A grid to rove on

32.2 Reporting discoveries

Where to Go from here

Under the radar

Beyond the playground

And much more


What's inside

  • Language concepts like slices, interfaces, pointers, and concurrency
  • Seven capstone projects featuring spacefaring gophers, Mars rovers, ciphers, and simulations
  • All examples run in the Go Playground — no installation required!

About the reader

This book is for anyone familiar with computer programming, as well as anyone with the desire to learn.

About the authors

Nathan Youngman organizes the Edmonton Go meetup and is a mentor with Canada Learning Code. Roger Peppé contributes to Go and runs the Newcastle upon Tyne Go meetup.

placing your order...

Don't refresh or navigate away from the page.
print book $29.99 $34.99 pBook + eBook + liveBook
Additional shipping charges may apply
Get Programming with Go (print book) added to cart
continue shopping
go to cart

eBook $24.99 $27.99 3 formats + liveBook
Get Programming with Go (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.

FREE domestic shipping on three or more pBooks