Akhil Sharma has Published 550 Articles

Golang Program to Find the current working directory

Akhil Sharma

Akhil Sharma

Updated on 03-May-2023 12:16:09

In go language we can use the functions present in os package like Getwd() and Args to find the current directory in which our code is getting executed. The directory from which the program is currently being run is called the current directory. It is also known as present working ... Read More

Golang Program to Get the size of a directory

Akhil Sharma

Akhil Sharma

Updated on 03-May-2023 12:15:07

In golang, it is easy to get the size of file, but getting the size of a directory is a bit complex. Here in this article we will use os.Open() function , walk function as well as readdir() function to get the size of a directory. Syntax funcReadDir(dirname string) ([]fs.FileInfo, ... Read More

Golang Program to Display all the directories in a directory

Akhil Sharma

Akhil Sharma

Updated on 03-May-2023 12:14:12

In this golang article, we will write a go language program to display all the directories in a given directory using the Go programming language using the open() function, using the walk function as well as using the readdir function. Method 1 In this Example we will write a go ... Read More

Golang Program to Search for a file in a directory

Akhil Sharma

Akhil Sharma

Updated on 03-May-2023 11:52:40

In this golang article we will write a go language program to search for a file in a directory using os.Open() function as well as using the ioutil.ReadDir() function. Searching for a specific file in golang can be very difficult task, if you have a lot of files to search, ... Read More

Golang Program to Delete a Directory

Akhil Sharma

Akhil Sharma

Updated on 03-May-2023 11:50:51

In this golang article, we will delete a directory in Golang using thhe os.Remove() function as well as using os.RemoveAll() function. There are many inbuilt functions present in go to remove a directory, and we will discuss two of such methods in this program. In computer languages a directory is ... Read More

Golang Program to Create directories recursively

Akhil Sharma

Akhil Sharma

Updated on 03-May-2023 11:47:00

In this golang article we will write a program to create directories recursively using os.MkdirAll() function as well as using recursion. One of the main use cases of Go is to create scalable and concurrent applications. Method 1 In this Example we will write a go language program to create ... Read More

Sending Email Using Smtp in Golang

Akhil Sharma

Akhil Sharma

Updated on 03-May-2023 11:38:16

In this golang article, we can send email using SMTP’s SendMail method, as well as using SMTP with go mail method, SMTP stands for simple mail transfer protocol. This protocol is used to send messages between the servers. The net/smtp package provides a medium to send messages hence it must ... Read More

Golang program to implement recursive anonymous function

Akhil Sharma

Akhil Sharma

Updated on 03-May-2023 11:36:18

In this Go language article, we will write programs to implement recursive anonymous function by generating fibonacci numbers, by using cache, as well as factorial of a number. An anonymous function is the function which does not have its name and it calls itself within its own body and when ... Read More

Overview of Testing Package in Golang

Akhil Sharma

Akhil Sharma

Updated on 03-May-2023 11:34:44

In this golang article, we will learn the overview testing package using two test functions as well as using iteration. Testing is of two types: manual testing and automated testing, manual testing is done manually with defined set of test cases whereas in automated testing a program is created with ... Read More

Golang program to depict short variable declaration operator(:=)

Akhil Sharma

Akhil Sharma

Updated on 03-May-2023 11:33:03

In this golang article, we will write Go language programs to depict short variable declaration operator using var keyword and variable declaration. In shorthand variable, initialization is done at the time of declaration where it’s not necessary in var keyword. Here, we will use a string method, as well as ... Read More

Advertisements