Month: September 2023

Autoreload go code on code change

For developers, the ability to autoreload code upon any changes is nothing short of a game-changer. It not only streamlines the development process but also fosters an environment of continuous improvement and experimentation. There are so many packages for languages such as JavaScript for such a behaviour, but I struggled to easily find a simple-to-use…

By addshore September 22, 2023 0

Automatic cobra command registration with fx

Cobra is a popular Go package for creating CLIs. It provides a lot of functionality for creating commands, subcommands, and flags. However, it can be tedious to manually register all of your commands. fx is a Go package that provides a dependency injection framework. It can be used to automatically register your application components, including…

By addshore September 9, 2023 3

A copy-paste go SQL mock for GORM

When it comes to writing robust and reliable tests for your Go applications, having a well-structured and efficient testing setup is crucial. One common challenge in testing Go applications is dealing with database interactions. To ensure that your code functions correctly, it’s essential to create a controlled environment for database operations during testing. In this…

By addshore September 8, 2023 0