Systems | Development | Analytics | API | Testing

Go

6 Golang Testing Frameworks for Every Type of Test

What do good tests look like, and do you even need a Golang testing framework? It’s a loaded question with an open answer. Not only do tests help ensure that your code will work as intended, but good tests can also serve as documentation for your codebase, making it easier to update and maintain in the future, while accelerating and streamlining your software development process. In this article, we outline 6 Golang testing frameworks for every type of test.

Golang Wrapper: Dependency Wrapping, in Go

All but the simplest applications borrow code. You could write everything yourself from just core language features but who has time for that? Instead you take on dependencies, pieces of code written by others that usually give us 80% or more of what we need with 20% of the effort. Sometimes these dependencies are made to interact with a specific technology like a database, or perhaps it’s just a library providing some feature that would be onerous to write yourself.

Testing Golang with httptest

Go, often referred to as Golang, is a popular programming language built by Google. Its design and structure help you write efficient, reliable, and high-performing programs. Often used for web servers and rest APIs, Go offers the same performance as other low-level languages like C++ while also making sure the language itself is easy to understand with a good development experience.

Mastering Golang Mocks for Efficient Testing and Improved Code Quality

Although GoMock is one of the most popular ways to create mocks in Golang, it’s important to understand the broader landscape of mocking methods in the language to fully leverage its potential value in testing. Mocking is a powerful technique that allows developers to isolate their code, improve test reliability, and ultimately enhance overall code quality.

Crafting the Best Golang Developer Environments

Go is an open-source programming language and developer environment from Google that allows for incredibly efficient and powerful applications. Go’s expressive syntax enables developers to write clean, efficient, concise code, allowing faster development cycles and easier maintenance. Whether you’re developing complex distributed systems or lightweight microservices, Go and its powerful libraries provide the tools necessary to create robust and scalable solutions.

How To Use Covdata For Better Code Coverage In Go

When you run your Go programs or integration tests, numbers of raw coverage files are typically generated and dumped into a directory specified by the GOCOVERDIR environment variable. These files contain valuable data about which parts of your code were executed during tests, offering a glimpse into your code’s effectiveness and robustness. However, sifting through these raw files to extract actionable insights can be daunting and unclear for many developers.

Adding Colour To The Log Output Of Logging Libraries In Go

Logging is an integral part of software development, providing developers with valuable insights into the behaviour and performance of their applications. In the Go programming language, various logging libraries, such as the standard library’s log package or third-party options like logrus , zap and zerolog, facilitate the generation of log output.

Managing Go Processes

While working on an application that required executing a command to run a blocking program, such as a TCP/HTTP server, I encountered an interesting challenge. I needed a way to stop the application and its child processes when a signal was sent to the main program, such as SIGINT (Ctrl+C) or SIGTERM. This blog post shares my journey and the solutions I found to manage processes effectively in a Go application, focusing on Linux environments.

Write Clean And Efficient Table Driven Unit Tests In Go

Table driven tests, also known as parameterized tests, have became very popular over the past few years, due to their ability to eliminate repetition. Table driven tests make it quite a bit easier to re-use the same values for different sets of tests by just moving the table outside of the scope of the test function. Different tests may benefit from the same input, and each test may have completely different configration, concurrency etc…

Top 7 Go Logging Libraries

Are you still relying on basic stdout and stderr for logging in your Go applications? It's time to level up your logging game! Logging with stdout and stderr can be complex and limiting. Messages lack structure, context, and extensibility, making monitoring and analyzing errors hard. Manual inspection of log file is time-consuming and error-prone, especially as your application grows. But There's a better way. Join us as we explore logging libraries in Go.