if dotenv file does not exist, do not load it

This commit is contained in:
c9s 2021-02-04 20:33:20 +08:00
parent bd895149ad
commit dbfc1caa53

View File

@ -19,11 +19,15 @@ import (
func main() {
dotenvFile := ".env.local"
if err := godotenv.Load(dotenvFile); err != nil {
log.WithError(err).Error("error loading dotenv file")
return
if _, err := os.Stat(dotenvFile) ; err == nil {
if err := godotenv.Load(dotenvFile); err != nil {
log.WithError(err).Error("error loading dotenv file")
return
}
}
var args []string
if runtime.GOOS == "linux" {
args = append(args, "--class=bbgo")