Templates in GoLang

In this post, we will see templates and their usages in the Go programming language. What are templates? Templates are a common view through which we can pass data to make that view meaningful. It can be customized in any way to get any output possible. Template packages Templating in Go comes with two packages …

Templates in GoLang Read More »

Using JSON with GoLang

In this post, we are going to see how to use JSON in the Go programming language. What is JSON? JSON is short for JavaScript Object Notation, a widely-used data interchange format. JSON is an extremely useful data format and is used almost everywhere today. Data-types supported in JSON and Go Below are some data-types …

Using JSON with GoLang Read More »

Slices in GoLang

Slices are resizable arrays that provide huge flexibility when working with it. In this post, we will see how to use slices in GoLang. Declaration of a slice A slice is declared just like an array but without mentioning its size. Difference between slices and arrays Arrays, after declared of some size, cannot be resized, …

Slices in GoLang Read More »

Structs in GoLang

Structs are a way to structure and use data. It allows us to group data. In this article, we will see how to declare and use it. Defining a Struct in Go To use a struct we declare the type of struct we are going to use. The code below shows how to define a …

Structs in GoLang Read More »

Maps in GoLang

Maps are one of the most useful data structures. It can store in key-value pairs and doesn’t allow for duplicate keys. Now, we will learn how the Go programming language implements maps. What is a map? A map is a key-value pair storage container. It offers fast and efficient lookups. And it doesn’t allow duplicate …

Maps in GoLang Read More »

Booleans in GoLang

In this post, we will discuss boolean values and operators in GoLang. Boolean values in Go Boolean values are those which can be assigned true or false and has the type bool with it. In the code above “bVal” is not initialized and thus has a zero-value. The zero-value for a boolean is false. Boolean …

Booleans in GoLang Read More »

Strings in GoLang

Strings are essential in every programming language. Go is no different here. We will see how to initialize and use those strings. Initializing Strings in GoLang We can initialize strings just like any other data-type. String concatenation can be done effortlessly. Accessing by index Strings in Go can be accessed just like an array or …

Strings in GoLang Read More »

Arrays in GoLang

Arrays are consecutive storage of the same data-type. In this post, we will see how arrays work in GoLang. Declaration of an Array To declare an array in Go we first give its name, then size, then type as shown below. Initialization of an Array Let’s see how to initialize an array. If we don’t …

Arrays in GoLang Read More »

Complex Numbers in GoLang

There are two complex types in Go. The complex64 and the complex128. Initializing Complex Numbers Initializing complex numbers is really easy. You can use the constructor or the initialization syntax as well. Parts of a Complex Number There are two parts of a complex number. The real and imaginary part. We use functions to get …

Complex Numbers in GoLang Read More »