Sabid Ansari has Published 199 Articles

Generate UUID in Golang

Sabid Ansari

Sabid Ansari

Updated on 18-Apr-2023 11:34:34

2K+ Views

Universally Unique Identifier (UUID) is a 128-bit value that is used to uniquely identify objects or entities. UUID is widely used in computer systems for generating unique IDs for objects, documents, and data records. In Golang, we can generate UUID using the "github.com/google/uuid" package. Installing the "github.com/google/uuid" Package Before we ... Read More

Getting the current date and time with timestamp in local and other timezones in Golang

Sabid Ansari

Sabid Ansari

Updated on 18-Apr-2023 10:55:41

1K+ Views

In Go, it's easy to work with dates and times using the time package. This package provides a set of functions and types for working with dates and times, including the ability to get the current date and time with a timestamp in local and other timezones. In this article, ... Read More

Splitting a slice of bytes after the specified separator in Golang

Sabid Ansari

Sabid Ansari

Updated on 18-Apr-2023 10:40:46

238 Views

In Golang, it is often required to split a slice of bytes after a specific separator. This can be done using the built-in function bytes.SplitAfter(). This function splits a slice of bytes into sub-slices after each occurrence of a specified separator. In this article, we will discuss how to split ... Read More

Searching an element of int type in slice of ints in Golang

Sabid Ansari

Sabid Ansari

Updated on 18-Apr-2023 10:13:22

84 Views

Slices are an essential feature of Go programming language that allows you to store and manipulate an ordered collection of elements. Slices are similar to arrays, but unlike arrays, they are dynamic and can be resized. In Go, you can perform a search operation on a slice to find an ... Read More

Replacing all String which Matches with Regular Expression in Golang

Sabid Ansari

Sabid Ansari

Updated on 18-Apr-2023 10:12:34

4K+ Views

In Golang, you can replace all the string occurrences that match a regular expression with the help of the regexp package. The regexp package in Golang provides a ReplaceAllString() function that replaces all occurrences of the matched string with a new string. Example Here's an example of how to replace ... Read More

Polymorphism Using Interfaces in Golang

Sabid Ansari

Sabid Ansari

Updated on 18-Apr-2023 10:11:43

2K+ Views

Polymorphism is a powerful concept in object-oriented programming that allows you to write flexible and reusable code. In Go, you can achieve polymorphism using interfaces.  An interface is a collection of method signatures that any type can implement. This means that you can write code that can work with any ... Read More

How to find the index of rune in the string in Golang?

Sabid Ansari

Sabid Ansari

Updated on 18-Apr-2023 10:10:57

660 Views

Golang offers many built-in functions and packages to perform string operations. One common operation is finding the index of a particular rune in the string. In this article, we will explore how to find the index of a rune in a string in Golang. Rune in Golang is an alias ... Read More

Goroutine vs Thread in Golang

Sabid Ansari

Sabid Ansari

Updated on 18-Apr-2023 10:10:08

6K+ Views

Goroutines and threads are both used for achieving concurrency in programming languages. In Golang, goroutines are the primary mechanism for achieving concurrency, while threads are a lower-level construct that is managed by the operating system. In this article, we will explore the differences between goroutines and threads in Golang, their ... Read More

Golang GOPATH and GOROOT

Sabid Ansari

Sabid Ansari

Updated on 18-Apr-2023 10:09:01

6K+ Views

If you are new to Golang, you may have heard of the terms GOPATH and GOROOT. These are important concepts that every Golang developer should understand. In this article, we will discuss what GOPATH and GOROOT are and how to use them effectively. What is GOPATH? GOPATH is an environment ... Read More

Golang Environment Variables

Sabid Ansari

Sabid Ansari

Updated on 18-Apr-2023 10:08:37

694 Views

Environment variables are an essential part of any software development process. They provide a way to configure an application's behavior without hard-coding values into the code. In Golang, environment variables are straightforward to use and can be set in many ways. In this article, we will discuss how to use ... Read More

Previous 1 ... 7 8 9 10 11 ... 20 Next
Advertisements