Akhil Sharma has Published 671 Articles

Golang Program to remove a specified directory

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 14:25:39

3K+ Views

Golang provides several methods to remove a specified directory, including using the os and filepath packages. Removing a directory is a critical operation, and caution should be exercised when performing this task. This article will discuss the different methods to remove a directory in Golang, along with the syntax and ... Read More

Golang Program to get the list the name of files in a specified directory

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 14:24:24

3K+ Views

In Golang, we have two internal functions - ReadDir() and Walk function to get a list of filenames prenent in a specific directory. Here we have write three examples. In the first example We will use the ReadDir() function present in ioutil package while in the second one we are ... Read More

Golang Program to print the home directory of the current user

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 14:23:29

1K+ Views

The Go programming language provides various methods to obtain the home directory of the current user. This information can be useful in many applications, such as file management, system configuration, etc. In this article, we will discuss different methods to get the home directory in Go along with syntax and ... Read More

Golang Program to get the List of filenames matching the specified wild card pattern

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 14:20:48

3K+ Views

One of the features of Go is the ability to search and retrieve files based on a specified pattern. In this article, we will discuss different methods to get the list of filenames that match a specified wildcard pattern in Go, and provide syntax and examples for each method. Method ... Read More

Golang Program to check if a file is directory or a file

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 14:18:40

2K+ Views

In Go, a directory is a special type of file that holds other files and directories. A directory is used to organize files on a file system and provides a structure to the file system. Go provides several functions in the os package to work with directories, including: os.mkdir, os.remove, ... Read More

Golang Program to Count number of lines present in the file

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 14:17:00

2K+ Views

In the Go programming language, a file is a named resource for storing data that can be read from or written to. It provides a way for the program to persist data, even after the program has finished executing. Here in this article we will discuss different methods using which ... Read More

Golang Program to Perform the postorder tree traversal

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 14:14:39

136 Views

In Go, postorder tree traversal is a technique in which the left child is visited first, then the right child, and finally the root node is the definition of the order. This order is frequently used to carry out certain activities on a tree, including releasing memory that the tree ... Read More

Golang Program to Count number of leaf nodes in a tree

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 14:02:39

308 Views

In Go programming language, a tree is a data structure in which each node has a value and zero to many nodes as children. The root node is the node without a parent, while the leaf node is the node without children. Trees can be employed for a variety of ... Read More

Golang Program to Perform the preorder tree traversal

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 14:01:05

711 Views

In Go programming language, pre-order traversal is a tree traversal technique in which the root node is visited first, then the left subtree, and finally the right subtree. A recursive function is used that calls itself on the root node, the left child node, the right child node, and finally ... Read More

Golang program to detect a loop in linked list

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 13:56:08

436 Views

In Golang data structures, a linked list is the one that contains nodes which contains two fields: a next pointer and the data of the list. We will use two methods to detect a loop in linked list. In the first method two-pointer approach will be used and in the ... Read More

Advertisements