Some small code refactorings (#1727)

Refactorings taken from pull requests #1722 and #1725
This commit is contained in:
6543
2023-04-30 17:02:47 +02:00
committed by GitHub
parent 54d4ec04c0
commit f3074ddaf9
6 changed files with 26 additions and 15 deletions

View File

@@ -125,8 +125,8 @@ var validDockerImageString = regexp.MustCompile(
// Validate validates the required fields and formats.
func (s *Secret) Validate() error {
for _, event := range s.Events {
if !ValidateWebhookEvent(event) {
return fmt.Errorf("%w: '%s'", ErrSecretEventInvalid, event)
if err := ValidateWebhookEvent(event); err != nil {
return errors.Join(err, ErrSecretEventInvalid)
}
}
if len(s.Events) == 0 {