Introduction to Unit Testing in GoUnit testing is a crucial practice in software development, ensuring that individual components of your code work as expected. In Go, testing is straightforward, with robust built-in tools that make it easy to write and run tests. Why Unit Testing Ma...Aug 11, 2024 · 2 min readomkarbhagat.hashnode.dev
Handy GoLang Date Time Snippets1. Getting the Current Date and Time currentTime := time.Now() fmt.Println("Current Time:", currentTime) // Output: Current Time: 2024-08-10 14:30:05.123456789 +0000 UTC m=+0.000000001 Explanation: Retrieves the current date and time including nanos...Aug 10, 2024 · 7 min readomkarbhagat.hashnode.dev
A Beginner's Guide to Time Handling in GoHandling time is a fundamental part of many applications, and Go provides a robust set of tools for working with time. Whether you're working with timestamps, time zones, or durations, Go’s time package is both powerful and easy to use. In this artic...Aug 9, 2024 · 4 min readomkarbhagat.hashnode.dev
Go Error Handling Essentials: A Beginner’s Guide1. The Basics: Errors in Go What is an Error? In Go, an error is a value indicating that something went wrong. Think of it as a signal saying, "Oops, something didn't go as planned!" Basic Error Handling Functions in Go often return two values: the r...Aug 7, 2024 · 4 min readomkarbhagat.hashnode.dev
Sentinel Errors and Error Chaining in Go: A Concise GuideSentinel Errors In Go, sentinel errors are specific, pre-defined error values that are used throughout a codebase to indicate particular error conditions. They are often used for comparison to handle specific error cases. Here's a brief explanation w...Aug 6, 2024 · 4 min readomkarbhagat.hashnode.dev