Golang

The Go Programming Tutorials

Variadic functions in Golang

In many cases, multiple parameters are needed to be passed in a function. Sometimes we know how many and other times we don’t. Golang variadic function applies to the second case where we don’t know how many arguments could be passed when calling that function. What are variadic functions in Golang? Variadic functions are just […]

Variadic functions in Golang Read More »

Anonymous Functions in Golang

There can be functions that don’t need a name in order to be defined. These are anonymous functions. Go has support for first-class functions. In this post, we will see how to use anonymous functions in the Go programming language. What are Anonymous Functions? Anonymous functions are those which don’t need a name to be

Anonymous Functions in Golang Read More »

Recursion in Golang

Recursion is one of the important concepts in programming languages. In this post, we will learn how to use recursion in Go. What is Recursion? Recursion happens when a function calls itself, i.e it recurs. When a function inside a program calls itself recursion occurs. Criteria for Recursion To be a recursive function it has

Recursion in Golang Read More »

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 »