From 2c2da3750ba036b848e5b52f8f5614076b0d36d6 Mon Sep 17 00:00:00 2001 From: Joshua Thomas Date: Wed, 26 Nov 2025 20:57:30 -0800 Subject: [PATCH] ensuring args and vars maps are created before populating them --- settings.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/settings.go b/settings.go index a3e600b..dc3b30c 100644 --- a/settings.go +++ b/settings.go @@ -366,12 +366,22 @@ func (s *settings) reflectTagOverrideArgs(out any, opts *ReadOptions, pFldNm ... // read "arg" tag arg := fld.Tag.Get("arg") if arg != "" { + // ensure args map ready + if opts.ArgsMap == nil { + opts.ArgsMap = map[string]string{} + } + opts.ArgsMap[arg] = fldNm } // read "env" tag env := fld.Tag.Get("env") if env != "" { + // ensure we have a vars map ready + if opts.VarsMap == nil { + opts.VarsMap = map[string]string{} + } + opts.VarsMap[env] = fldNm } }