channel vs waitgroup in golang
In Go, channels and wait groups (sync.WaitGroup) are both concurrency primitives that help manage synchronization and coordination between goroutines. However, they serve different purposes and …
In Go, channels and wait groups (sync.WaitGroup) are both concurrency primitives that help manage synchronization and coordination between goroutines. However, they serve different purposes and …
In Go, channels are a powerful concurrency techniques that allow communication and synchronization between goroutines. Channels provide a way for one goroutine to send data …
In Go, type assertion is a way to check and extract the underlying value of an interface. It allows you to determine whether the underlying …
In Go, an interface defines a set of method signatures. Any type that implements all the methods of an interface is said to satisfy that …
There are few different ways to run a go program. As it is a compiled language, we will see if we can run it as a script also. Lets see them one by one.
GoLang is a compiled language, with very simple syntax, easy handling of multi-threading app, Garbage-collected, open-source, and many more other features..
At run time, when a program panics, it immediately starts to unwind the call stack. Panics can also be initiated by user, by invoking inbuild panic() directly. Recover is a built-in function that regains control of a panicking goroutine. Recover is called inside a deferred functions.
In general, we use errors to handle the abnormal conditions in programming languages. But there are some unavoidable situations like accessing a nil pointer or …
Defer-statement within a function doesn’t follow the normal execution steps. With multiple defer statements and functions in a program, they are executed in LIFO(Last-In and First-Out) order