mirror of
https://github.com/teivah/100-go-mistakes.git
synced 2026-06-21 00:47:11 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
28b76b9c04
1 changed files with 7 additions and 8 deletions
15
README.md
15
README.md
|
|
@ -28,7 +28,7 @@ This section contains a summary of the 100 mistakes in the book. Meanwhile, it's
|
|||
* [Interface on the producer side](#interface-on-the-producer-side-6)
|
||||
* [Returning interfaces](#returning-interfaces-7)
|
||||
* [`any` says nothing](#any-says-nothing-8)
|
||||
* [Being confused about when to use generics](#being-confused-about-when-to-use-genericshttpsteivahmediumcomwhen-to-use-generics-in-go-36d49c1aeda-9) ([Read the full excerpt 👀](https://teivah.medium.com/when-to-use-generics-in-go-36d49c1aeda))
|
||||
* [Being confused about when to use generics](#being-confused-about-when-to-use-generics-9) ([Read the full excerpt 👀](https://teivah.medium.com/when-to-use-generics-in-go-36d49c1aeda))
|
||||
* [Not being aware of the possible problems with type embedding](#not-being-aware-of-the-possible-problems-with-type-embedding-10)
|
||||
* [Not using the functional options pattern](#not-using-the-functional-options-pattern-11)
|
||||
* [Project misorganization](#project-misorganization-project-structure-and-package-organization-12)
|
||||
|
|
@ -40,7 +40,7 @@ This section contains a summary of the 100 mistakes in the book. Meanwhile, it's
|
|||
* [Creating confusion with octal literals](#creating-confusion-with-octal-literals-17)
|
||||
* [Neglecting integer overflows](#neglecting-integer-overflows-18)
|
||||
* [Not understanding floating-points](#not-understanding-floating-points-19)
|
||||
* [Not understanding slice length and capacity](#not-understanding-slice-length-and-capacityhttpsteivahmediumcomslice-length-vs-capacity-in-go-af71a754b7d8-20) ([Read the full excerpt 👀](https://teivah.medium.com/slice-length-vs-capacity-in-go-af71a754b7d8))
|
||||
* [Not understanding slice length and capacity](#not-understanding-slice-length-and-capacity-20) ([Read the full excerpt 👀](https://teivah.medium.com/slice-length-vs-capacity-in-go-af71a754b7d8))
|
||||
* [Inefficient slice initialization](#inefficient-slice-initialization-21)
|
||||
* [Being confused about nil vs. empty slice](#being-confused-about-nil-vs-empty-slice-22)
|
||||
* [Not properly checking if a slice is empty](#not-properly-checking-if-a-slice-is-empty-23)
|
||||
|
|
@ -48,7 +48,7 @@ This section contains a summary of the 100 mistakes in the book. Meanwhile, it's
|
|||
* [Unexpected side effects using slice append](#unexpected-side-effects-using-slice-append-25)
|
||||
* [Slice and memory leaks](#slice-and-memory-leaks-26)
|
||||
* [Inefficient map initialization](#inefficient-map-initialization-27)
|
||||
* [Map and memory leaks](#map-and-memory-leakshttpsteivahmediumcommaps-and-memory-leaks-in-go-a85ebe6e7e69-28) ([Read the full excerpt 👀](https://teivah.medium.com/maps-and-memory-leaks-in-go-a85ebe6e7e69))
|
||||
* [Map and memory leaks](#map-and-memory-leaks-28) ([Read the full excerpt 👀](https://teivah.medium.com/maps-and-memory-leaks-in-go-a85ebe6e7e69))
|
||||
* [Comparing values incorrectly](#comparing-values-incorrectly-29)
|
||||
* [Control Structures](#control-structures)
|
||||
* [Ignoring that elements are copied in `range` loops](#ignoring-that-elements-are-copied-in-range-loops-30)
|
||||
|
|
@ -81,8 +81,7 @@ This section contains a summary of the 100 mistakes in the book. Meanwhile, it's
|
|||
* [Not handling `defer` errors](#not-handling-defer-errors-54)
|
||||
* [Concurrency: Foundations](#concurrency-foundations)
|
||||
* [Mixing up concurrency and parallelism](#mixing-up-concurrency-and-parallelism-55)
|
||||
* [Thinking concurrency is always faster](#thinking-concurrency-is-always-fasterhttpsteivahmediumcomconcurrency-isnt-always-faster-in-go-de325168907c-56)
|
||||
* [Thinking concurrency is always faster](#thinking-concurrency-is-always-fasterhttpsteivahmediumcomconcurrency-isnt-always-faster-in-go-de325168907c-56) ([Read the full excerpt 👀](https://teivah.medium.com/concurrency-isnt-always-faster-in-go-de325168907c))
|
||||
* [Thinking concurrency is always faster](#thinking-concurrency-is-always-faster-56) ([Read the full excerpt 👀](https://teivah.medium.com/concurrency-isnt-always-faster-in-go-de325168907c))
|
||||
* [Being puzzled about when to use channels or mutexes](#being-puzzled-about-when-to-use-channels-or-mutexes-57)
|
||||
* [Not understanding race problems](#not-understanding-race-problems-data-races-vs-race-conditions-and-the-go-memory-model-58)
|
||||
* [Not understanding the concurrency impacts of a workload type](#not-understanding-the-concurrency-impacts-of-a-workload-type-59)
|
||||
|
|
@ -118,7 +117,7 @@ This section contains a summary of the 100 mistakes in the book. Meanwhile, it's
|
|||
* [Sleeping in unit tests](#sleeping-in-unit-tests-86)
|
||||
* [Not dealing with the time API efficiently](#not-dealing-with-the-time-api-efficiently-87)
|
||||
* [Not using testing utility packages](#not-using-testing-utility-packages-httptest-and-iotest-88)
|
||||
* [Writing inaccurate benchmarks](#writing-inaccurate-benchmarkshttpsteivahmediumcomhow-to-write-accurate-benchmarks-in-go-4266d7dd1a95-89) ([Read the full excerpt 👀](https://teivah.medium.com/how-to-write-accurate-benchmarks-in-go-4266d7dd1a95))
|
||||
* [Writing inaccurate benchmarks](#writing-inaccurate-benchmarks-89) ([Read the full excerpt 👀](https://teivah.medium.com/how-to-write-accurate-benchmarks-in-go-4266d7dd1a95))
|
||||
* [Not exploring all the Go testing features](#not-exploring-all-the-go-testing-features-90)
|
||||
* [Optimizations](#optimizations)
|
||||
* [Not understanding CPU caches](#not-understanding-cpu-caches-91)
|
||||
|
|
@ -128,7 +127,7 @@ This section contains a summary of the 100 mistakes in the book. Meanwhile, it's
|
|||
* [Not understanding stack vs. heap](#not-understanding-stack-vs-heap-95)
|
||||
* [Not knowing how to reduce allocations](#not-knowing-how-to-reduce-allocations-api-change-compiler-optimizations-and-syncpool-96)
|
||||
* [Not relying on inlining](#not-relying-on-inlining-97)
|
||||
* [Not using Go diagnostics tooling](#not-using-go-diagnostics-tooling-profiling-enabling-pprof-cpu-heap-goroutines-block-and-mutex-profiling-and-execution-tracer-98)
|
||||
* [Not using Go diagnostics tooling](#not-using-go-diagnostics-tooling-98) ([Read the full excerpt 👀](https://medium.com/@teivah/profiling-and-execution-tracing-in-go-a5e646970f5b))
|
||||
* [Not understanding how the GC works](#not-understanding-how-the-gc-works-99)
|
||||
* [Not understanding the impacts of running Go in Docker and Kubernetes](#not-understanding-the-impacts-of-running-go-in-docker-and-kubernetes-100)
|
||||
|
||||
|
|
@ -633,7 +632,7 @@ Reducing allocations is also an essential aspect of optimizing a Go application.
|
|||
|
||||
Use the fast-path inlining technique to efficiently reduce the amortized time to call a function.
|
||||
|
||||
#### Not using Go diagnostics tooling (profiling [enabling pprof, CPU, heap, goroutines, block, and mutex profiling] and execution tracer) (#98)
|
||||
#### [Not using Go diagnostics tooling](https://medium.com/@teivah/profiling-and-execution-tracing-in-go-a5e646970f5b) (#98)
|
||||
|
||||
Rely on profiling and the execution tracer to understand how an application performs and the parts to optimize.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue