DEV Community

Discussion on: Working with Context in Go

georgeoffley profile image
George Offley Author • Edited on

Hey Cory,

Thanks for reading. I'm glad you got something out of it. To elaborate a little, when doing my research I came across a lot of articles which suggested not passing along critical assets via context. I find that the ability to do that makes a context far more useful. That said I'm sure there are ways to get in trouble doing so. Even if you look into the context source code they flat out tell you not to do that.

Context Source

However, point out a system which is coded perfectly to a language specification. Everyone's needs are different. So doing what you described probably won't sink you but it might be better to store that stuff in a new class to be reloaded when needed. I'm not a genius so I'm sure there are plenty of use cases for it regardless of what some guy on the internet thinks.

That might be your next project is seeing how to be best set up external services to be used from system to system. I might look more into it.

Thanks again for reading.