3 ms·
I'm litteraly using that same function func getEnvOrDefault(name, defaultValue string) string { value, ok := os.LookupEnv(name) if !ok {
by aziis98 4y ago
I'm litteraly using that same function
func getEnvOrDefault(name, defaultValue string) string {
value, ok := os.LookupEnv(name)
if !ok {
value = defaultValue
}
return value
}
for some of my projects
- hu3 4y agoCurious, is this coincidence related to GitHub Copilot?
- benhoyt 4y agoHeh, that's funny. I distinctly remember typing it in from scratch just the other day (no Copilot), and I guess it's short enough it sorta writes itself: the function name is kind of obvious, the name of "defaultValue" is necessary because "default" is a keyword, and so on. I normally do early returns, so it's somewhat surprising I wrote "value = defaultValue" instead of "return defaultValue", but whatever.