use os.LookupEnv like a regular human being

This commit is contained in:
Lilian Jónsdóttir 2024-05-29 13:05:36 -07:00
parent 349fe9ef3d
commit 89006797fa

8
pkg/env/env.go vendored
View file

@ -13,10 +13,10 @@ import (
// variables EDITOR and VISUAL // variables EDITOR and VISUAL
func GetEditor() string { func GetEditor() string {
var editor string var editor string
if os.Getenv("EDITOR") != "" { if v, ok := os.LookupEnv("EDITOR"); ok {
editor = os.Getenv("EDITOR") editor = v
} else if os.Getenv("VISUAL") != "" { } else if v, ok := os.LookupEnv("VISUAL"); ok {
editor = os.Getenv("VISUAL") editor = v
} /* else { } /* else {
// TODO: maybe pick something based on the OS // TODO: maybe pick something based on the OS
} */ } */