Overview In Golang string are UTF-8 encoded. strings package of GO provides an EqualFold method that can be used to do case insensitive comparison of two strings in Go. Below is the…
Tag: golang
Find and delete a character in string in Go (Golang)
Overview strings package of GO provides a ReplaceAll method that can be used to replace all non-overlapping instances of a given substring with a new substring. We can use this method to…
Index character in a string in Go (Golang)
In Golang string is a sequence of bytes. A string literal actually represents a UTF-8 sequence of bytes. In UTF-8, ASCII characters are single-byte corresponding to the first 128 Unicode characters. All other…
Install GO (aka Golang) on Linux
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 –…
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…
Implement while loop in Go (Golang)
Go doesn’t have the while keyword. Instead, it has the for keyword only. However for keyword can be used to simulate the functionality the same as while. for loop in GO basically…
User defined function types in Go (Golang)
Overview In GO, the function is also a type. Two functions will be of the same type if They have the same number of arguments with each argument is of the same type They…
Anonymous Function in Go (Golang)
Overview As the name suggests anonymous functions are function which does not have any name. In Golang function are first-class variables meaning that They can be assigned to a variable Passed around…
IIF or Immediately Invoked Function in Go (Golang)
Overview: IIF or Immediately Invoked Function are those function which can be defined and executed at the same time. A function can be invoked immediately by appending a () after the end…
Get the IP address from an incoming HTTP request
Overview In this article, we will get the IP address of the client for an incoming HTTP request using X-REAL-IP header If X-REAL-IP is empty then we will fall back to X-FORWARDED-FOR header….