100 Go Mistakes and How to Avoid Them, Video Edition

100 Go Mistakes and How to Avoid Them, Video Edition

English | MP4 | AVC 1280×720 | AAC 44KHz 2ch | 83 Lessons (12h 38m) | 1.55 GB

Spot errors in your Go code you didn’t even know you were making and boost your productivity by avoiding common mistakes and pitfalls.

100 Go Mistakes and How to Avoid Them shows you how to:

  • Dodge the most common mistakes made by Go developers
  • Structure and organize your Go application
  • Handle data and control structures efficiently
  • Deal with errors in an idiomatic manner
  • Improve your concurrency skills
  • Optimize your code
  • Make your application production-ready and improve testing quality

100 Go Mistakes and How to Avoid Them puts a spotlight on common errors in Go code you might not even know you’re making. You’ll explore key areas of the language such as concurrency, testing, data structures, and more—and learn how to avoid and fix mistakes in your own projects. As you go, you’ll navigate the tricky bits of handling JSON data and HTTP services, discover best practices for Go code organization, and learn how to use slices efficiently.

Understanding mistakes is the best way to improve the quality of your code. This unique book examines 100 bugs and inefficiencies common to Go applications, along with tips and techniques to avoid making them in your own projects.

100 Go Mistakes and How to Avoid Them shows you how to replace common programming problems in Go with idiomatic, expressive code. In it, you’ll explore dozens of interesting examples and case studies as you learn to spot mistakes that might appear in your own applications. Expert author Teiva Harsanyi organizes the error avoidance techniques into convenient categories, ranging from types and strings to concurrency and testing.

What’s inside

  • Identify and squash code-level bugs
  • Avoid problems with application structure and design
  • Perfect your data and control structures
  • Optimize your code by eliminating inefficiencies
Table of Contents

1 Chapter 1. Go Simple to learn but hard to master
2 Chapter 1. 100 Go mistakes
3 Chapter 2. Code and project organization
4 Chapter 2. 3 Misusing init functions
5 Chapter 2. 5 Interface pollution
6 Chapter 2. Interface pollution
7 Chapter 2. 7 Returning interfaces
8 Chapter 2. 9 Being confused about when to use generics
9 Chapter 2. 10 Not being aware of the possible problems with type embedding
10 Chapter 2. 11 Not using the functional options pattern
11 Chapter 2. 12 Project misorganization
12 Chapter 2. 14 Ignoring package name collisions
13 Chapter 2. 16 Not using linters
14 Chapter 3. Data types
15 Chapter 3. 19 Not understanding floating points
16 Chapter 3. 20 Not understanding slice length and capacity
17 Chapter 3. 21 Inefficient slice initialization
18 Chapter 3. 22 Being confused about nil vs. empty slices
19 Chapter 3. 24 Not making slice copies correctly
20 Chapter 3. 26 Slices and memory leaks
21 Chapter 3. 27 Inefficient map initialization
22 Chapter 3. 28 Maps and memory leaks
23 Chapter 3. 29 Comparing values incorrectly
24 Chapter 4. Control structures
25 Chapter 4. 31 Ignoring how arguments are evaluated in range loops
26 Chapter 4. 32 Ignoring the impact of using pointer elements in range loops
27 Chapter 4. Map insert during iteration
28 Chapter 5. Strings
29 Chapter 5. 37 Inaccurate string iteration
30 Chapter 5. 39 Under-optimized string concatenation
31 Chapter 5. 41 Substrings and memory leaks
32 Chapter 6. Functions and methods
33 Chapter 6. 43 Never using named result parameters
34 Chapter 6. 45 Returning a nil receiver
35 Chapter 6. 47 Ignoring how defer arguments and receivers are evaluated
36 Chapter 7. Error management
37 Chapter 7. 50 Checking an error type inaccurately
38 Chapter 7. 52 Handling an error twice
39 Chapter 7. 54 Not handling defer errors
40 Chapter 8. Concurrency Foundations
41 Chapter 8. 56 Thinking concurrency is always faster
42 Chapter 8. Parallel merge sort
43 Chapter 8. 58 Not understanding race problems
44 Chapter 8. The Go memory model
45 Chapter 8. 59 Not understanding the concurrency impacts of a workload type
46 Chapter 8. 60 Misunderstanding Go contexts
47 Chapter 8. Catching a context cancellation
48 Chapter 9. Concurrency Practice
49 Chapter 9. 63 Not being careful with goroutines and loop variables
50 Chapter 9. 65 Not using notification channels
51 Chapter 9. 67 Being puzzled about channel size
52 Chapter 9. 68 Forgetting about possible side effects with string formatting
53 Chapter 9. 70 Using mutexes inaccurately with slices and maps
54 Chapter 9. 72 Forgetting about sync.Cond
55 Chapter 9. 73 Not using errgroup
56 Chapter 9. 74 Copying a sync type
57 Chapter 10. The standard library
58 Chapter 10. 77 Common JSON-handling mistakes
59 Chapter 10. 78 Common SQL mistakes
60 Chapter 10. 79 Not closing transient resources
61 Chapter 10. 80 Forgetting the return statement after replying to an HTTP request
62 Chapter 10. HTTP server
63 Chapter 11. Testing
64 Chapter 11. 83 Not enabling the -race flag
65 Chapter 11. 85 Not using table-driven tests
66 Chapter 11. 87 Not dealing with the time API efficiently
67 Chapter 11. 88 Not using testing utility packages
68 Chapter 11. 89 Writing inaccurate benchmarks
69 Chapter 11. Not being careful about compiler optimizations
70 Chapter 11.9 90 Not exploring all the Go testing features
71 Chapter 12. Optimizations
72 Chapter 12. Slice of structs vs. struct of slices
73 Chapter 12. Cache placement policy
74 Chapter 12. 92 Writing concurrent code that leads to false sharing
75 Chapter 12. 93 Not taking into account instruction-level parallelism
76 Chapter 12. 94 Not being aware of data alignment
77 Chapter 12. 95 Not understanding stack vs. heap
78 Chapter 12. 96 Not knowing how to reduce allocations
79 Chapter 12. 97 Not relying on inlining Part 1
80 Chapter 12. 97 Not relying on inlining Part 2
81 Chapter 12. 97 Not relying on inlining Part 3
82 Chapter 12. 99 Not understanding how the GC works
83 Chapter 12. 100 Not understanding the impacts of running Go in Docker and Kubernetes

Homepage