Codekru

How to read a file in Golang?

This post will discuss how to read a file in Golang. We will use the below packages to work with the files. os package provides a platform-independent interface to perform the operating level operations. ioutil package provides easy-to-use utility functions to work with files without knowing much about the internal implementations. bufio package implements buffered

How to read a file in Golang? Read More »

Arrays in Go Language

An array is a data structure used to store similar elements at contiguous memory locations. What we meant by contiguous memory location is that the elements will be present next to each other in the memory and not at random places. So, it is easy to get to the desired element from any element by directly

Arrays in Go Language Read More »

Functions in Go Language

Functions contain a set of statements bundled together to achieve a particular outcome. Now, a function may call other functions based on its requirements. But, why do we need functions? There are many reasons to use functions in a program. It helps in the reusability of the code because now we don’t have to rewrite

Functions in Go Language Read More »

Pointers in Golang

A Pointer is a variable that stores the address of any other variable. We can get the address of the variables by using the & ( an ampersand ) operator, which is also Go’s address of operator. And why do we need pointers? It is a manual overhead to remember the address where the variable

Pointers in Golang Read More »