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
NOTE: capturing the state means that, the closure will somehow associate that specific closure with the variables passed to it. In the above example, this specific instance of a function is linked with the variable passed to it. It becomes particularly important when enclosing closures in loops. So each instance of closure will be given a unique reference to variable s.
39
39
40
40
# Pointers
41
+
- Share memory by pointer
41
42
- Map by default is reference in go
42
43
- Passing pointer by reference example
43
44
@@ -80,6 +81,13 @@ fetch(&data)
80
81
- If all goroutines are deadlocked, go raises panic to kill program, but if there is partial failure of go-routines, the program
81
82
continues to function but may behave uncertain.
82
83
84
+
# Interface:
85
+
- They define behaviour of an Object, by expecting presence of certain methods.
86
+
- This helps us to implement OOP in go.
87
+
- passing interface as parameter provides a clean way to generalize and allow us to pass different kinds of
88
+
objects
89
+
- See example here: https://github.com/arvryna/sled/blob/main/internal/service/task.go
90
+
83
91
# Go Tools:
84
92
> Detecting race conditions ?
85
93
- Use race flag to detect race conditions in the program
0 commit comments