Skip to content

re: Let's write config for your Golang web app on right way β€” YAML πŸ‘Œ VIEW POST


I truly appreciate the contribution to the community. That said though, as this feels targeted at newcomers, I personally wouldn't teach "global variables" or "using the init()" function if I could avoid it. Later in life, those two constructs make it harder to test and much harder to find a certain class of bugs, especially when the code base gets a lot bigger. Feel free to ignore me though lol, just my $0.02.


Didn't really understand, when init() became an anti-pattern for the Go community? Give me a link to an article about it, please. Same thing about "global variables".

Maybe you should write the right article about how to make a Go web app config in the right format? I'd read it, really.

Feel free to ignore me though lol, just my $0.02.

I don't have the slightest idea what you're talking about here. Explain, please. I haven't even met you to ignore you. πŸ€·β€β™‚οΈ


Rather than duplicating the work, I'll just give you an MR on your repo with reference :)

As far as ignoring me, I'm opinionated, so it comes with the territory lol.

Oh, that's would be nice! Thx πŸ˜‰

But, actually, when init() become an "anti-pattern"? Because I see init() on many online books, courses and articles by Go bloggers.

I googled it, but I couldn't find any confirmation of your words.

Even the other way around! For example, "Effective Go" book on official Golang website:

code of conduct - report abuse