Skip to content

Commit

Permalink
helpers/common: functions common to all helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaeldtinoco authored and Rafael David Tinoco committed Sep 2, 2021
1 parent 43fae25 commit 59c9cc3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions helpers/common.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package helpers

import (
"fmt"
"os"
)

func checkEnvPath(env string) (string, error) {
filePath, _ := os.LookupEnv(env)
if filePath != "" {
_, err := os.Stat(filePath)
if err != nil {
return "", fmt.Errorf("could not open %s %s", env, filePath)
}
return filePath, nil
}
return "", nil
}

0 comments on commit 59c9cc3

Please sign in to comment.