Akhil Sharma has Published 671 Articles

Golang program to get value from the hash collection based on specified key

Akhil Sharma

Akhil Sharma

Updated on 03-May-2023 12:20:11

83 Views

In this golang article, we will write Go language programs to get the value from the hash collection based on a specified key using found variable as well as using ok idiom method. A hash map is a data structure that belongs to the hash collection. It stores the data ... Read More

Golang Program to check a file has readable permission or not

Akhil Sharma

Akhil Sharma

Updated on 03-May-2023 12:17:05

1K+ Views

While working with file in go language it is very important to check if a file has readable permission or not, because without the read permissions a program cannot read the content of files. Here we will use os.Stat() function , os.Open() function, as well as ,ioutil.Readfile() function to ... Read More

Golang Program to Find the current working directory

Akhil Sharma

Akhil Sharma

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

383 Views

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

1K+ Views

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

98 Views

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

1K+ Views

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

133 Views

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

2K+ Views

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

878 Views

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

223 Views

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

Advertisements