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

Convenient way to read a file resource into Java unit test

MASAI PROJECT

popshop customer care number//8584892738/8584892738/popshop customer care…

How to install Flutter on Windows?

How to install Flutter on Windows?

GROUPBY IN PANDAS

Configure Azure Application Insights With Existing Application

Running and Monitoring Postman API Tests

Scalable Serverless Microservice Demo AWS Lambda Kinesis Terraform

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

gRPC for Absolute Beginners, in Go

Golang installation in Ubuntu

Golang language variable declaration methods and use scenarios

Detect Objects Including Types and Locations in an Image using Go