You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sync.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ We want to make a counter which is safe to use concurrently.
6
6
7
7
We'll start with an unsafe counter and verify its behaviour works in a single-threaded environment.
8
8
9
-
Then we'll exercise it's unsafeness, with multiple goroutines trying to use the counter via a test, and fix it.
9
+
Then we'll exercise its unsafeness, with multiple goroutines trying to use the counter via a test, and fix it.
10
10
11
11
## Write the test first
12
12
@@ -204,7 +204,7 @@ func (c *Counter) Inc() {
204
204
205
205
This _looks_ nice but while programming is a hugely subjective discipline, this is **bad and wrong**.
206
206
207
-
Sometimes people forget that embedding types means the methods of that type becomes_part of the public interface_; and you often will not want that. Remember that we should be very careful with our public APIs, the moment we make something public is the moment other code can couple themselves to it. We always want to avoid unnecessary coupling.
207
+
Sometimes people forget that embedding types means the methods of that type become_part of the public interface_; and you often will not want that. Remember that we should be very careful with our public APIs, the moment we make something public is the moment other code can couple themselves to it. We always want to avoid unnecessary coupling.
208
208
209
209
Exposing `Lock` and `Unlock` is at best confusing but at worst potentially very harmful to your software if callers of your type start calling these methods.
0 commit comments