refactoring makefile, adding error detail

main
Nick Dumas 2 years ago
parent 5813113d9f
commit 8de6452c64

@ -117,17 +117,15 @@ INSTALL_TARGETS := $(addprefix install-,$(CMDS))
all: debug setup dep format lint test bench build dist all: debug setup dep format lint test bench build dist
release-major: bump-major git-push:
git push origin main --tags git push origin main --tags
git push github main --tags git push github main --tags
release-minor: bump-minor release-major: bump-major git-push
git push origin main --tags
git push github main --tags
release-patch: bump-patch release-minor: bump-minor git-push
git push origin main --tags
git push github main --tags release-patch: bump-patch git-push
setup: setup-dirs setup-build setup-format setup-lint setup-reports setup-bump setup: setup-dirs setup-build setup-format setup-lint setup-reports setup-bump

@ -45,16 +45,16 @@ var validateCmd = &cobra.Command{
if err != nil { if err != nil {
return fmt.Errorf("error generating absolute path for %q", target) return fmt.Errorf("error generating absolute path for %q", target)
} }
target, err := os.Open(absPath) file, err := os.Open(absPath)
if err != nil { if err != nil {
return fmt.Errorf("could not open target file: %w", err) return fmt.Errorf("could not open target file: %w", err)
} }
defer target.Close() defer file.Close()
err = obp.Validate(schema, target) err = obp.Validate(schema, file)
if err != nil { if err != nil {
details, ok := err.(*jsonschema.ValidationError) details, ok := err.(*jsonschema.ValidationError)
if !ok { if !ok {
return err return fmt.Errorf("eror validating %q: %w", path, err)
} }
obp.PrettyDetails(cmd.OutOrStdout(), viper.GetString("format"), details.DetailedOutput(), absPath) obp.PrettyDetails(cmd.OutOrStdout(), viper.GetString("format"), details.DetailedOutput(), absPath)
} }
@ -89,5 +89,4 @@ func init() {
if err != nil { if err != nil {
log.Panicln("error binding viper to format flag:", err) log.Panicln("error binding viper to format flag:", err)
} }
} }

Loading…
Cancel
Save