List of Figures

Chapter 1. Introducing Go

Figure 1.1. Working hard? (via XKCD)

Figure 1.2. Many goroutines execute on a single OS thread

Figure 1.3. Using channels to safely pass data between goroutines

Figure 1.4. Inheritance versus composition

Figure 1.5. The Go Playground

Chapter 2. Go quick-start

Figure 2.1. The flow of the program architecture

Chapter 3. Packaging and tooling

Figure 3.1. Output of go command help text

Figure 3.2. Local Go documentation

Chapter 4. Arrays, slices, and maps

Figure 4.1. Array internals

Figure 4.2. Values of the array after the declaration of the array variable

Figure 4.3. Values of the array after the declaration of the array variable

Figure 4.4. Values of the array after changing the value of index 2

Figure 4.5. An array of pointers that point to integers

Figure 4.6. Both arrays after the copy

Figure 4.7. Two arrays of pointers that point to the same strings

Figure 4.8. Two-dimensional arrays and their outer and inner values

Figure 4.9. Slice internals with underlying array

Figure 4.10. The representation of a nil slice

Figure 4.11. The representation of an empty slice

Figure 4.12. Two slices sharing the same underlying array

Figure 4.13. The underlying array after the assignment operation

Figure 4.14. The underlying array after the append operation

Figure 4.15. The new underlying array after the append operation

Figure 4.16. A representation of the slice of strings

Figure 4.17. A representation of the new slice after the operation

Figure 4.18. A representation of the new slice after the append operation

Figure 4.19. Using range to iterate over a slice creates a copy of each element.

Figure 4.20. Values for our slice of a slice of integers

Figure 4.21. What index 0 of the outer slice looks like after the append operation

Figure 4.22. Both slices pointing to the underlying array after the function call

Figure 4.23. Relationship of key/value pairs

Figure 4.24. Simple representation of the internal structure of a map

Figure 4.25. Simple view of how hash functions work

Chapter 5. Go’s type system

Figure 5.1. A simple view of an interface value after concrete type value assignment

Figure 5.2. A simple view of an interface value after concrete type pointer assignment

Chapter 6. Concurrency

Figure 6.1. A simple view of a process and its threads for a running application

Figure 6.2. How the Go scheduler manages goroutines

Figure 6.3. Difference between concurrency and parallelism

Figure 6.4. Goroutines being swapped on and off the logical processor’s thread

Figure 6.5. Visual of the race condition in action

Figure 6.6. Synchronization between goroutines using an unbuffered channel

Figure 6.7. Synchronization between goroutines using a buffered channel

Chapter 8. Standard library

Figure 8.1. golang.org/pkg/io/#Writer

Figure 8.2. sourcegraph.com/code.google.com/p/go/.GoPackage/io/.def/Writer

Figure 8.3. View of the archive files inside the pkg folder

Chapter 9. Testing and benchmarking

Figure 9.1. Output from the basic unit test

Figure 9.2. Output from the basic unit test

Figure 9.3. Output from the table test

Figure 9.4. Failed test due to having no internet connection

Figure 9.5. Successful test without having an internet connection

Figure 9.6. Running the web service

Figure 9.7. Web service serving up the JSON document

Figure 9.8. Listing of examples for the json package

Figure 9.9. A view of the Decoder example in the Go documentation

Figure 9.10. godoc view of the handlers package

Figure 9.11. A full view of the example in godoc

Figure 9.12. Running the example

Figure 9.13. Running an example that fails

Figure 9.14. Running a single benchmark

Figure 9.15. Running a single benchmark with the -benchtime option

Figure 9.16. Running all three benchmarks

Figure 9.17. Running a benchmark with the -benchmem option

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset