Get Programming with Go
Nathan Youngman, Roger Peppe
  • MEAP began October 2015
  • Publication in July 2018 (estimated)
  • ISBN 9781617293092
  • 300 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

Preface

About this book

Roadmap
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 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 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 Look at the bits

7.3.2 Avoid wrapping around time

7.4 Summary

7.5 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

Lesson 9 Multilingual text

9.1 Declaring string variables

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 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 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 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 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 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 Multi-dimensional arrays

16.7 Summary

16.8 Answers to quick checks

Lesson 17 Slices: a window into an array

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 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 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 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.1 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 Encoding structures to JSON

21.6 Customizing JSON with struct tags

21.7 Summary

21.8 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 Answers to quick checks

Lesson 23 Composition and forwarding

23.1 Composing structures

23.2 Forwarding methods

23.3 Name collisions

23.4 Summary

Lesson 24 Interfaces

24.1 The interface type

24.2 Discovering the interface

24.3 Satisfying interfaces

24.4 Keep interfaces small

24.5 Summary

Lesson 25 Capstone: Martian animal sanctuary

Unit 6: Down the gopher hole

Lesson 26 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 human

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

Lesson 31 Concurrent state

31.1 Mutexes

31.1.1 Mutex pitfalls

31.2 Long lived workers

31.3 Summary

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

Appendixes

Appendix A: Solutions

Lesson 1

Lesson 2

Lesson 3

Lesson 4

Capstone 5

Lesson 6

Lesson 7

Lesson 8

Lesson 9

Lesson 10

Capstone 11

Lesson 12

Lesson 13

Lesson 14

Capstone 15

Lesson 16

Lesson 17

Lesson 18

Lesson 19

Capstone 20

Lesson 21

Lesson 22

Lesson 23

Lesson 24

Capstone 25

Lesson 26

Lesson 27

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

This book assumes you are familiar with a high-level scripting language such as JavaScript, Lua, PHP, Perl, Python, or Ruby.

About the authors

Nathan Youngman is a contributor to Go's open source ecosystem and organizer of the Edmonton Go meetup.

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.
buy
Get Programming with Go (combo) added to cart
continue shopping
go to cart

MEAP combo $34.99 pBook + eBook + liveBook
Get Programming with Go (eBook) added to cart
continue shopping
go to cart

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