Skip to content

Adding code sample on how to load the .env variables #282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RayRemnant
Copy link

Hello, I was following the quickstart guide on Go and I got a bit stuck trying to load the .env variables into my program. I think an example snippet on how to do it would make it a bit easier for future developers.

@notrab
Copy link
Member

notrab commented Mar 5, 2025

Hey @RayRemnant

Do you have a good example of anyone who does this best? There's been a few discussions on this topic in the past, with one side saying it's not the responsibility of individual platform docs to teach the core primitives of each language, then some in the middle (I think I'm one of these) who just use placeholder strings, and then there's what you suggested.

If there's any good examples you can share, I'd love to incorporate that into our docs.

@RayRemnant
Copy link
Author

I have little experience with Go. What I got from my initial research is that there's no general consensus on how to structure a Go project. Straying away from popular languages also means that developers are looking to do things more in "their way". Probably because of that any implementation will be perceived as opinionated.
In my view, a working code example would help developers get started and they could rethink and restructure their project accordingly later on, maybe question and contribute to the resources they initially found here.
But, I get it that this might not be a shared view. If you're looking for an example from an experienced Go dev, I'm definitely not it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants