Dependency Injection in Go

Definitions

Why is dependency injection important in practice?

allow customers to store their code and run them in some sort of containerized environment.

Playing out what tech we’ll use

How will we test these?

# just works without any dependencies at all.
go test ./…
# does integration testing using env vars or flags.
env $(cat .env) go test /… -tags integration

It’s all about the interface

So what about dependency injection?

Will we end up writing a lot of boilerplate mock code?

Footnotes

--

--

--

software engineer at auth0, writing code for humans, with humans.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Make You Own Backup Program with Python in Less than 10 Lines.

But if we have an app with multiple screens, where more than one screen is rendered at once

What is id?

How to deploy an Azure Function app in AKS using the Azure CLI

9D NFT IDO on BSC Station

sorting-phone interview

An AWS Cloud architecture for web hosting — 3 Tiers

Why Abstract Classes? Why not just plain old interfaces and plain old classes?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cyril David

Cyril David

software engineer at auth0, writing code for humans, with humans.

More from Medium

3 ways to tackle the longest increasing subsequence problem(Golang)

In conversation with Go-Lang | Part1

Getting started with GO Programming Language — Part Two