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 »