GO is available to be installed on Win, Mac, and Linux platforms. Let’s see the installation set up for Linux Install Download the archive of latest version of GO from here –…
Tag: go
Install GO (aka Golang) on MAC
Overview GO is available to be installed on Win, Mac, and Linux platforms. GO can be installed on MAC in three ways Using archive Using brew Using .pkg installer Let’s look at…
Wait for all Go routines to finish execution in Golang
sync package of golang provides WaitGroup struct which can be used to wait for collection of goroutines to finish execution. The WaitGroup provides: Add method to set the number of goroutines to…
Parse a bool or Check if given string is a bool in Go (Golang)
strconv.ParseBool() function can be used to parse a string representation of a bool. https://golang.org/pkg/strconv/#ParseBool Below is the signature of the function Let’s see a working code Output:
Check if a string is a number in Go (Golang)
strconv.Atoi() function can be used to check if the string is a number. If this function returns an error if the passed string is not a number. This function parses the number…
Understanding Rune in Golang
Overview rune in Go is an alias for int32 meaning it is an integer value. This integer value is meant to represent a Unicode Code Point. To understand rune you have to know…
Append to an existing file in Go (Golang)
os.OpenFile() function of the os package can be used to open to a file in an append mode and then write to it Let’s see an example. In the below program: First,…
Get Current Working Directory in Go (Golang)
os.Getwd() is used to get the current working directory. Output will similar to pwd command on linux Output: Current Working Direcoty: <will be current working directory on the machine>
Iterative Binary Search Tree in Go (Golang)
Introduction A binary search tree abbreviated as BST is a binary tree. For each node in a Binary Search Tree Value of each node in the left subtree is less than the…
Default Zero Value of all Types in Go (Golang) With Examples
Default Value Table Type Default Value Integer 0 Float 0 Complex Number 0 Real and 0 Imaginary Part Byte 0 Rune 0 String “” Bool false Array Every array value to its…