Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
7cba7d1117
|
|||
|
ecea194c0f
|
@@ -118,3 +118,17 @@ func GetPidEnvMapNative(pid uint32) (envMap map[string]interface{}, err error) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
/*
|
||||
HasEnv is much like os.LookupEnv, but only returns a boolean for
|
||||
if the environment variable key exists or not.
|
||||
|
||||
This is useful anywhere you may need to set a boolean in a func call
|
||||
depending on the *presence* of an env var or not.
|
||||
*/
|
||||
func HasEnv(key string) (envIsSet bool) {
|
||||
|
||||
_, envIsSet = os.LookupEnv(key)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ func RealPathExists(path *string) (exists bool, err error) {
|
||||
}
|
||||
|
||||
if _, err = os.Stat(*path); err != nil {
|
||||
if !errors.Is(err, fs.ErrNotExist) {
|
||||
if errors.Is(err, fs.ErrNotExist) {
|
||||
err = nil
|
||||
}
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user