Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
npolshakova committed Sep 18, 2024
1 parent 59a24d0 commit b78255b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions cmd/krel/cmd/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package cmd

import (
"errors"
"fmt"
"os"
"path/filepath"
Expand Down Expand Up @@ -65,7 +66,7 @@ The 'validate' subcommand of krel has been developed to:
func runValidateReleaseNotes(releaseNotesPath string) (err error) {
// Ensure the path is not empty
if releaseNotesPath == "" {
return fmt.Errorf("release notes path cannot be empty")
return errors.New("release notes path cannot be empty")
}

// Check if the directory exists
Expand All @@ -84,15 +85,15 @@ func runValidateReleaseNotes(releaseNotesPath string) (err error) {

// Validate YAML
if err := ValidateYamlMap(path); err != nil {
return fmt.Errorf("validating YAML file %s: %v", path, err)
return fmt.Errorf("validating YAML file %s: %w", path, err)
}

fmt.Printf("YAML file %s is valid.\n", path)
}
return nil
})
if err != nil {
return fmt.Errorf("validating release notes: %v", err)
return fmt.Errorf("validating release notes: %w", err)
}

fmt.Println("All release notes are valid.")
Expand Down Expand Up @@ -137,11 +138,11 @@ func validateTextFieldPunctuation(data *notes.ReleaseNotesMap) error {
validPunctuation := regexp.MustCompile(`[.!?]$`)

if data == nil {
return fmt.Errorf("the release notes map is nil")
return errors.New("the release notes map is nil")
}

if data.ReleaseNote.Text == nil {
return fmt.Errorf("the 'text' release notes map field is nil")
return errors.New("the 'text' release notes map field is nil")
}

text := *data.ReleaseNote.Text
Expand Down

0 comments on commit b78255b

Please sign in to comment.