Golang Golang Guarantee to process only once by using sync.Once If a shared resource is needed on multiple goroutines and the initialization must be done only once on one of the gorout... 2024.03.11 Golang
Golang Golang Use a pointer receiver to define a function for a struct Do you recognize that there are two ways to define a method for a struct? func (m StructName) FuncName(){ // do somethin... 2024.03.08 Golang
Golang Golang How/When to use sync.Cond When should sync.Cond be used instead of channel? Golang provides easy ways for asynchronous processing. As you know, ch... 2024.03.06 Golang
Golang Golang Set channel direction to prevent usage error Do you often use a channel? Have you ever considered the channel direction? To use a channel, someone sends data to the ... 2024.03.04 Golang
Golang Golang Check variable order in Struct if you must reduce memory usage A recent computer has enough resources and thus we might not have the opportunity to reduce memory usage. However, it's ... 2024.02.26 Golang
Golang Golang Dynamic access to a property in a struct I needed dynamic access to all properties in a struct in unit tests. In my case, the struct has only boolean properties.... 2024.02.16 Golang
Golang Golang Is Compiling Regex In Loop Really Expensive? A regex is a useful feature to check whether a string contains a special format. If we have many formats, we might want ... 2024.02.05 Golang
Golang Golang Implement Debounce logic in different ways There are multiple ways to implement Debounce Logic in Golang. I want to compare the differences and check which one is ... 2023.12.27 Golang
Golang Golang How to implement Debounce and how to use time.Timer properly timer.Timer is simple but it's not as straightforward to use it as it looks. What can we do with time.Timer? There are t... 2023.12.13 Golang
Golang Golang Which way is the best to declare array/slice Have you ever considered the best way to declare an array/slice in Golang? Golang offers several ways to declare it. It'... 2023.12.11 Golang