From 554b97d5710d5f2a25966e8e85b5c65a4c355788 Mon Sep 17 00:00:00 2001 From: Luke Massa Date: Thu, 23 Jan 2025 23:21:13 -0500 Subject: [PATCH] Fix Signed-off-by: Luke Massa --- server/core/config/parser_validator.go | 4 ++-- server/core/config/raw/autodiscover.go | 1 - server/core/config/raw/global_cfg.go | 4 ++-- server/core/config/raw/project.go | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/server/core/config/parser_validator.go b/server/core/config/parser_validator.go index 41edd63e0d..0c12b7aeb6 100644 --- a/server/core/config/parser_validator.go +++ b/server/core/config/parser_validator.go @@ -111,7 +111,7 @@ func (p *ParserValidator) ParseRepoCfgData(repoCfgData []byte, globalCfg valid.G func (p *ParserValidator) ParseGlobalCfg(configFile string, defaultCfg valid.GlobalCfg) (valid.GlobalCfg, error) { configData, err := os.ReadFile(configFile) // nolint: gosec if err != nil { - return valid.GlobalCfg{}, fmt.Errorf("unable to read %s file: %v", configFile, err) + return valid.GlobalCfg{}, fmt.Errorf("unable to read %s file: %w", configFile, err) } if len(configData) == 0 { return valid.GlobalCfg{}, fmt.Errorf("file %s was empty", configFile) @@ -200,7 +200,7 @@ func (p *ParserValidator) applyLegacyShellParsing(cfg *valid.RepoCfg) error { if s.StepName == "run" { split, err := shlex.Split(s.RunCommand) if err != nil { - return fmt.Errorf("unable to parse %q: %v", s.RunCommand, err) + return fmt.Errorf("unable to parse %q: %w", s.RunCommand, err) } s.RunCommand = strings.Join(split, " ") } diff --git a/server/core/config/raw/autodiscover.go b/server/core/config/raw/autodiscover.go index e7619a209e..fdf18fbec4 100644 --- a/server/core/config/raw/autodiscover.go +++ b/server/core/config/raw/autodiscover.go @@ -7,7 +7,6 @@ import ( "github.com/bmatcuk/doublestar/v4" validation "github.com/go-ozzo/ozzo-validation" - "github.com/pkg/errors" "github.com/runatlantis/atlantis/server/core/config/valid" ) diff --git a/server/core/config/raw/global_cfg.go b/server/core/config/raw/global_cfg.go index 02653fc55b..127e22e3cf 100644 --- a/server/core/config/raw/global_cfg.go +++ b/server/core/config/raw/global_cfg.go @@ -185,7 +185,7 @@ func (r Repo) Validate() error { } _, err := regexp.Compile(id[1 : len(id)-1]) if err != nil { - return fmt.Errorf("parsing: %s: %v", id, err) + return fmt.Errorf("parsing: %s: %w", id, err) } return nil } @@ -201,7 +201,7 @@ func (r Repo) Validate() error { withoutSlashes := branch[1 : len(branch)-1] _, err := regexp.Compile(withoutSlashes) if err != nil { - return fmt.Errorf("parsing: %s: %v", branch, err) + return fmt.Errorf("parsing: %s: %w", branch, err) } return nil } diff --git a/server/core/config/raw/project.go b/server/core/config/raw/project.go index a5af061243..74d12539bf 100644 --- a/server/core/config/raw/project.go +++ b/server/core/config/raw/project.go @@ -76,7 +76,7 @@ func (p Project) Validate() error { withoutSlashes := branch[1 : len(branch)-1] _, err := regexp.Compile(withoutSlashes) if err != nil { - return fmt.Errorf("parsing: %s: %v", branch, err) + return fmt.Errorf("parsing: %s: %w", branch, err) } return nil }