Golang

The Go Programming Tutorials

Waitgroups in Golang

When doing concurrent programming in Go, it can be seen that the goroutine may not execute and the main thread stops before it finishes executing. This is a problem that frequently appears when doing concurrent programming. Waitgroups solves the problem in an easy way. How Golang waitgroups work? Waitgroup is a blocking mechanism that blocks […]

Waitgroups in Golang Read More »

Select statement in Golang

Golang select statement is like the switch statement, which is used for multiple channels operation. This statement blocks until any of the cases provided are ready. This post will explore the select statement in the Go programming language. Golang Select Statement Syntax The syntax of the select statement is like the switch statements. It is

Select statement in Golang Read More »

Multiple goroutines in Golang

In this post, we will see how to work with multiple goroutines. If you are looking for the basics, please go through Goroutines in Golang and Channels in Golang. Multiple Goroutines Simple Example This code shows how two goroutines will interact when running concurrently. The output order will not be maintained and each time this

Multiple goroutines in Golang Read More »

Channels in Golang

Channels are a medium that the goroutines use in order to communicate effectively. It is the most important concept to grasp after understanding how goroutines work. This post aims to provide a detailed explanation of the working of the channels and their use cases in Go. Golang Channels syntax In order to use channels, we

Channels in Golang Read More »

Goroutines in Golang

Goroutines are one of the most important aspects of the Go programming language. It is the smallest unit of execution. This post explores the different aspects of a goroutine and how to work with it. What is a goroutine? A goroutine is a lightweight thread in Golang. It can continue its work alongside the main

Goroutines in Golang Read More »

Substring in Golang

Substrings are a part of a string. Creating it from a string is really easy in Go. This post covers the best possible ways to generate substring from a string. Get a single character from a string Getting a single character can be done using simple indexing. Here is an example. Remember to convert it

Substring in Golang Read More »

The math Package in Golang

The math package in Go contains entirely of many math functions that can be used to do different things. Here are the main math functions that are used frequently. Regular math functions The most common math functions are as follows. Most of the functions work with float64 type here. We need to import the package

The math Package in Golang Read More »