Curious About Technology

Welcome to Coding Explorations, your go-to blog for all things software engineering, DevOps, CI/CD, and technology! Whether you're an experienced developer, a curious beginner, or simply someone with a passion for the ever-evolving world of technology, this blog is your gateway to valuable insights, practical tips, and thought-provoking discussions.

Recent Posts

Go Testing with Fake HTTP Requests and Responses
go, golang, testing, mocks Benjamin Parrish go, golang, testing, mocks Benjamin Parrish

Go Testing with Fake HTTP Requests and Responses

Go provides a robust testing framework right out of the box. When working with web applications or services, a common challenge developers face is testing code that involves HTTP requests and responses without actually hitting the real endpoints. In this post, we'll dive deep into creating and using fake HTTP requests and responses for testing in Go.

Read More
Table-Driven Testing in Go
go, golang, testing Noah Parker go, golang, testing Noah Parker

Table-Driven Testing in Go

In the realm of software development, particularly in Go, testing plays a pivotal role. One of the most effective and popular testing paradigms in the Go community is "Table-Driven Testing". Let's delve into what it is, its benefits, and how to effectively employ it.

Read More
Dependency Injection in Go: A Primer
go, golang, patterns Noah Parker go, golang, patterns Noah Parker

Dependency Injection in Go: A Primer

Dependency Injection (DI) is a software design pattern that allows for decoupling components and layers in a system. By providing dependencies from the outside rather than hard-coding them within a component, we achieve better modularity, testability, and flexibility. Go, despite its simplicity, can be enhanced with DI patterns to build scalable and maintainable applications. In this blog post, we'll explore what Dependency Injection is, why it's useful, and how to implement it in Go with code examples.

Read More
Implementing the Singleton Pattern in Go
go, golang, patterns Noah Parker go, golang, patterns Noah Parker

Implementing the Singleton Pattern in Go

The Singleton pattern ensures that a particular class has only one instance throughout the runtime of an application and provides a global point of access to that instance. In the Go programming language, often referred to as "Golang", implementing the Singleton pattern is relatively straightforward, thanks to its inherent concurrency and package-oriented nature.

Read More
Testing GORM with SQLMock
go, golang, programming, testing Noah Parker go, golang, programming, testing Noah Parker

Testing GORM with SQLMock

GORM is one of the most popular ORM (Object-Relational Mapper) libraries in Go, providing a simplified and consistent way to interact with databases. As with all application code, it's imperative to ensure that your database operations are thoroughly tested. However, hitting a real database during unit tests isn't ideal. This is where SQLMock comes in. SQLMock provides a way to mock out your SQL database so you can test your GORM code without needing a live database.

Read More
Defensive Programming in Go: The Power of defer and Nil Checks
go, golang, programming, safety, best practice Noah Parker go, golang, programming, safety, best practice Noah Parker

Defensive Programming in Go: The Power of defer and Nil Checks

In the vast ecosystem of software development, safety and robustness are two of the primary goals every developer should aspire to achieve. As our software becomes an integral part of modern infrastructure, the margin for error narrows. Ensuring that our software behaves predictably even under unexpected conditions is crucial. In this blog post, we’ll delve into two core techniques that bolster safety in the Go programming language: using the defer statement to ensure resources are cleaned up and guarding against nil pointer dereferences.

Read More
Graceful Shutdown in Go: Safeguarding Containerized Applications
go, golang, microservice, programming Noah Parker go, golang, microservice, programming Noah Parker

Graceful Shutdown in Go: Safeguarding Containerized Applications

In today's container-driven world, applications must be prepared to handle interruptions and terminations with grace and elegance. Especially in orchestrated environments like Kubernetes, an application could be rescheduled, moved, or terminated due to a myriad of reasons. For developers, this emphasizes the importance of ensuring their application can handle shutdown signals gracefully. Go (or Golang), with its lightweight concurrency model and robust standard library, offers tools to achieve a graceful shutdown. Let's delve into how we can implement this in a Go application.

Read More
Reducing Binary Size in Go: Strip Unnecessary Data with -ldflags "-w -s"
go, golang Noah Parker go, golang Noah Parker

Reducing Binary Size in Go: Strip Unnecessary Data with -ldflags "-w -s"

When building Go applications, the generated binary can sometimes be larger than what you might expect, especially when it contains debug information for the Go runtime and symbols for the linker. Fortunately, Go provides a handy way to reduce the binary size by stripping away unnecessary data. In this post, we'll dive into how to use the -ldflags "-w -s" option with go build to achieve this.

Read More
Utilizing Protocol Buffers (Protobuf) to Create API Contracts Between Web Server and Client
go, golang, protobuf, web Noah Parker go, golang, protobuf, web Noah Parker

Utilizing Protocol Buffers (Protobuf) to Create API Contracts Between Web Server and Client

As web applications continue to evolve, so does the necessity for efficient, scalable, and clear communication protocols between the server and the client. Traditional methods like RESTful APIs using JSON or XML have been popular, but there's another player in the arena: Protocol Buffers, or "Protobuf" for short. In this blog post, we'll explore how Protobuf can be used to establish clear API contracts between a web server and a client.

Read More
Packages and Modularization in Go: A Comprehensive Guide
go, golang, programming, modules Noah Parker go, golang, programming, modules Noah Parker

Packages and Modularization in Go: A Comprehensive Guide

In the world of software development, modularization is a key principle that ensures maintainability, reusability, and clarity. In the Go programming language, this principle is embodied through the use of packages and modules. In this blog post, we'll delve deep into the world of Go packages, Go Modules, and the best practices surrounding them.

Read More