GoLang Sort Package

Sorting is an essential operation for many algorithms. Go provides sorting functions for many different data types. In this post, we will discuss about GoLang sort package, which is used to sort elements in an array, list, slice, etc. Importing GoLang sort Package To sort data types in Go we need to import the sort …

GoLang Sort Package Read More »

The init function in GoLang

The init function is a powerful function in Go. It allows doing things like initialization of a package that otherwise really hard to achieve. In this post, we are going to take a look at Go’s init function. What is the init function in GoLang? The init function is a function that takes no argument …

The init function in GoLang Read More »

Methods in GoLang

Methods are just like functions, except it has a special argument and that is a receiver. In this post, we will dive deeper into GoLang methods. GoLang Methods Syntax A method consists of the func keyword, the receiver argument, and the function body. Here is the syntax of a Go method. So, when we want …

Methods in GoLang Read More »

The if-else expression in GoLang

The if-statement is present in almost every programming language out there. It is one of the most important control-flow statements in programming. In this post, we will explore the different ways we can use the if statement to make our programs robust and concise. 1. The syntax of if-expression in GoLand The syntax of the …

The if-else expression in GoLang Read More »

Delete files in GoLang

Deleting files is important when we want to do routine work with files. E.g. we save some log data and then after some time we may want to remove it automatically. This file deletion can be easily done in Go. In this post, we are going to discuss how to delete files in Go. Remove …

Delete files in GoLang Read More »

Write files in GoLang

In this post, we are going to explore how to write into files in GoLang. Go has the ioutil package which makes writing a file a lot easier. So, let’s see what are the ways we can do it. First step: Creating a File In order to write something inside a file, we must create …

Write files in GoLang Read More »

Reading files in GoLang

Reading files is one of the most essential tasks in programming. It allows us to see content, modify and write it using programming. In this post, we will see how to read file contents in Go. 1. Open a file for reading The first step is to open the file for reading. We can use …

Reading files in GoLang Read More »