From cabaab6237824ca926e04d20ad9fdfe7f0cba0b0 Mon Sep 17 00:00:00 2001 From: infinoid Date: Fri, 24 Nov 2023 01:56:27 +0000 Subject: [PATCH] Fix #404: nil map error when reading env file (#405) Co-authored-by: Mark Glines Reviewed-on: https://gitea.com/gitea/act_runner/pulls/405 Reviewed-by: Jason Song Co-authored-by: infinoid Co-committed-by: infinoid (cherry picked from commit 934471813a41efabf6a9b5d5b22a2a5770ff12ce) --- internal/pkg/config/config.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/pkg/config/config.go b/internal/pkg/config/config.go index 540c82a..a7bb977 100644 --- a/internal/pkg/config/config.go +++ b/internal/pkg/config/config.go @@ -99,6 +99,9 @@ func LoadDefault(file string) (*Config, error) { if err != nil { return nil, fmt.Errorf("read env file %q: %w", cfg.Runner.EnvFile, err) } + if cfg.Runner.Envs == nil { + cfg.Runner.Envs = map[string]string{} + } for k, v := range envs { cfg.Runner.Envs[k] = v }