Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
Signed-off-by: Luke Massa <lukefrederickmassa@gmail.com>
  • Loading branch information
lukemassa committed Jan 24, 2025
1 parent 41acd7b commit 829fce8
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions server/core/config/parser_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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, " ")
}
Expand Down
1 change: 0 additions & 1 deletion server/core/config/raw/autodiscover.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
4 changes: 2 additions & 2 deletions server/core/config/raw/global_cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion server/core/config/raw/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 1 addition & 2 deletions server/core/config/valid/repo_cfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

"github.com/bmatcuk/doublestar/v4"
version "github.com/hashicorp/go-version"
"github.com/pkg/errors"
)

// RepoCfg is the atlantis.yaml config after it's been parsed and validated.
Expand Down Expand Up @@ -122,7 +121,7 @@ func (r RepoCfg) IsPathIgnoredForAutoDiscover(path string) (bool, error) {
if err != nil {
// Per documentation https://pkg.go.dev/github.com/bmatcuk/doublestar, this only
// occurs if the pattern itself is invalid, and we already checked this when parsing raw config
return false, fmt.Errorf("unexpectedly found invalid ignore pattern (this is a bug, should have been validated at startup): %v", err)
return false, fmt.Errorf("unexpectedly found invalid ignore pattern (this is a bug, should have been validated at startup): %w", err)
}
if matches {
return true, nil
Expand Down

0 comments on commit 829fce8

Please sign in to comment.