Akhil Sharma has Published 507 Articles

Golang Program to Iterate through Elements of Dictionary

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 13:52:09

2K+ Views

In Golang, a dictionary is like a map which is a group of key-value pairs with a unique key for each value. The values can be of any type, and the keys can be of any type that is similar, such as strings or integers. We can build an empty ... Read More

Golang program to use different types of a collection

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 13:50:27

1K+ Views

In Golang, a collection is a data structure that stores a number of elements, usually of the same type. The collection types in Go offers arrays, slices, maps, and channels. Slices are considered as dynamic arrays whose size can be changed whereas arrays have a fixed size. Channels give goroutines ... Read More

Golang program to join two linked list

Akhil Sharma

Akhil Sharma

Updated on 22-Feb-2023 11:12:10

490 Views

In Go, a linked list is a linear data structure that contains a node which further contains two fields one is data and the other one is next. The next contains the address of the next node in continuation. We will execute this program with the help of two methods. ... Read More

Golang program to perform inorder tree traversal

Akhil Sharma

Akhil Sharma

Updated on 21-Feb-2023 12:18:30

949 Views

In Go programming language, a tree is a frequently used data structure that resembles an upside-down tree or an inverted tree with parent-child relationships between the nodes. In a tree, each node has a value and zero to many nodes as offspring. The root node is the node without a ... Read More

Golang program to convert the arraylist into string and vice-versa

Akhil Sharma

Akhil Sharma

Updated on 21-Feb-2023 12:17:44

837 Views

In go we can use strings.Join to convert a arraylist into string. Here we will understand how we can use strings.Join to combine multiple texts from an array that are separated by commas and spaces also, strings. To create an array of strings, use the Split function on the string. ... Read More

Golang program to convert a linked list into an array and vice-versa

Akhil Sharma

Akhil Sharma

Updated on 21-Feb-2023 12:16:29

476 Views

In the Go programming language, a linkedlist is a data structure made up of a series of nodes, each of which has a value and a reference (pointer) to the node after it. Since items can be added to or removed from a list without rearranging the entire data set, ... Read More

Golang program to make a file read-only

Akhil Sharma

Akhil Sharma

Updated on 21-Feb-2023 12:15:32

2K+ Views

We can use chmod function and syscall package in Golang to make a file read-only file. To convert a file into read-only files, the chmod function set the file’s right to 044. The os.Chmod function is then used to modify the file's mode. In syscall package of Golang we are ... Read More

Golang program to write into a file

Akhil Sharma

Akhil Sharma

Updated on 21-Feb-2023 12:14:20

6K+ Views

In go programming language we can use os.create and ioutil.WriteFile to write into a file. In Go, the OS can be used to represent a file. os package file type that offers ways to open, read from, write to, and manipulate files. Method 1: Using os.Create function We make use ... Read More

Golang program to create a temporary file

Akhil Sharma

Akhil Sharma

Updated on 21-Feb-2023 12:13:30

3K+ Views

In Go programming language we can use ioutil.TempFile function to create a temporary file. To create a new temporary file in the default temporary directory, this program uses the ioutil. TempFile function. The directory in which the file should be created is the first argument to TempFile, and the pattern ... Read More

Golang program to create a new file

Akhil Sharma

Akhil Sharma

Updated on 21-Feb-2023 12:12:31

7K+ Views

Golang has two internal function – os.create and ioutil.WriteFile to create a new file. The "file" is a disk-based file that a Go program may read from or write to. In Go, the OS can be used to represent a file. os package file type that offers ways to open, ... Read More

Advertisements