• // try to avoid this pattern

    What to avoid, why to avoid? No explanation at all! In the end it's perfectly fine to ask for environment variables. Just don't do it every time.

    I guess @jot thinks os.Getenv is called all the time here and she/he could be right.

    Or @jot is talking about something completely different, nobody knows.

    Saying to avoid something without explanation isn't very helpful. All I could do was guessing.