Go Time: Golang, Software Engineering cover image

The bits of Go we avoid (and why)

Go Time: Golang, Software Engineering

CHAPTER

Is There a Way to Avoid Global State?

I would actually do away with global state altogether. If you're going to try and sort of mock it or something, it'll interfere with it in weird ways. I think that the key is with usages of global state that aren't bad is they're essentially constant. So some of those, you can't actually use the const keyword because for example, the file store has to be a fs variable so there's no such thing as anfs constant. But once the application starts up, you're not changing it. You're not modifying it. Yeah. It probably shouldn't live at the package level after if you're modifying it after startup. That's pretty much a very clear bright

00:00
Transcript
Play full episode

Remember Everything You Learn from Podcasts

Save insights instantly, chat with episodes, and build lasting knowledge - all powered by AI.
App store bannerPlay store banner