Interfaces in Golang

In general programming interfaces are contracts that have a set of functions to be implemented to fulfill that contract. Go is no different. Go has great support for interfaces and they are implemented in an implicit way. They allow polymorphism in Go. In this post, we will talk about interfaces, what they are, and how […]

Interfaces in Golang Read More »

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 »