In this Go language article, we learn how to replace the items of hash collection from another hash collection using ok idiom method as well as a loop to replace the items of hash collection. A hash collection contains a hashmap which is an efficient data structure Syntax func range(variable) The range function is used to iterate over any data type. To use this, we first have to write the range keyword followed by the data type to which we want to iterate and as a result the loop will iterate till the last element of the variable. Algorithm ... Read More
In this article, we will learn how tp write a Go language programs to delete the item from the hash collection based on a specified key using ok idiom method and delete keyword A hash map is a part of the hash collection. It stores the data as key value pairs which helps in the efficient execution of the program. Algorithm Step 1 − This program imports two packages fmt and main where fmt helps in the formatting of input and output and main helps in generating executable codes Step 2 − Create a main function Step 3 ... Read More
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 in the form of key value pairs. Syntax func make ([] type, size, capacity) The make function in go language is used to create an array/map it accepts the type of variable to be created, its size and capacity as arguments. Algorithm Step 1 − This program imports ... Read More
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 check if a file has readable permission or not. Algortihm First, we need to import the "fmt" and "os" packages. Then, store the text file into a variable and call the specified function present in the respective package. If an error is generated then print it on the screen. ... Read More
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 directory. The directory in which the program is currently running is called the working directory. It is the parent directory for any files or the or directory that are created during runtime. Algorithm First, we need to import the "fmt" and "os" packages. Then, start the main() function. Inside ... Read More
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, error) The ReadDir() function is present in os package and is used to read the directory. The function accepts one argument which is the name of the directory which is to be read and returns a list FileInfo for directory’s content. If an error is generated while reading the ... Read More
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 language program to display all the directories in a directory by using the open() function present in os package. One of the simplest methods to display the directories in a given directory is to use the os.Open() function. Example package main import ( "fmt" ... Read More
In an IT field or any company, the computer systems are interconnected to the same server to share information among them. It follows distributed information systems, in which every computer is physically connected and connected to a common network. RPC stands for Remote Procedure Call which is a type of protocol used in the operating system for making communication over remote devices. Using the RPC message protocol, the message request is sent and after getting the reply the communication is established. Remote Procedure Call The TCP/IP or UDP comes under the low-level transport layer protocol for communication between the networks ... Read More
People are getting connected easily with others using the network for sharing data. The data is transmitted from the sender side to the client side either in a wired or wireless connection and the mode of medium will be guided or unguided. For the wired way of data transmission, the connections can be chosen from the coaxial cable, fiber optic cable, and twisted pair cable. Wireless Communication emerged in the 19th century and is used in every field of communication. Wireless Communication Data communication occurs in the unguided medium when the sender and receiver are not physically connected but use ... Read More
Filtering Filtering is the process of validating or screening, whether input data given by the user meets the standard format or not. Content filtering is the process of screening emails or web pages that are undesirable. These operate with predefined patterns that include user text string or image data. Recent versions of firewalls include filtering options as built-in features either as hardware or software support. Content filtering is used in cybersecurity as it can block malicious or hacked websites and also block social networking websites as per standard policies defined in corporate organizations. Filtering methods can be deployed in applications ... Read More