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
release-major: bump-major
git-push:
git push origin main --tags
git push github main --tags
release-minor: bump-minor
git push origin main --tags
git push github main --tags
release-major: bump-major git-push
release-patch: bump-patch
git push origin main --tags
git push github main --tags
release-minor: bump-minor git-push
release-patch: bump-patch git-push
setup: setup-dirs setup-build setup-format setup-lint setup-reports setup-bump

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

Loading…
Cancel
Save