Skip to content

Commit

Permalink
fix: tools-2875 display all errors generated while using the validati…
Browse files Browse the repository at this point in the history
…on command
  • Loading branch information
dwelch-spike committed Mar 27, 2024
1 parent d694a4a commit c65b57e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ ifdef GOARCH
GO_ENV_VARS += GOARCH=$(GOARCH)
endif

SOURCES := $(shell find . -name "*.go")

# Builds asconfig binary
$(ACONFIG_BIN): $(wildcard *.go)
$(ACONFIG_BIN): $(SOURCES)
$(GO_ENV_VARS) go build -ldflags="-X 'github.com/aerospike/asconfig/cmd.VERSION=$(VERSION)'" -o $(ACONFIG_BIN) .

# Clean up
Expand Down
7 changes: 3 additions & 4 deletions cmd/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,14 @@ func newValidateCmd() *cobra.Command {
}

verrs, err := conf.NewConfigValidator(asconfig, mgmtLibLogger, version).Validate()
if verrs != nil {
// verrs is an empty slice if err is not nil but no
// validation errors were found
if len(verrs.Errors) > 0 {
// force validation errors to be written to stdout
// so they can more easily be grepd etc.
cmd.Print(verrs.Error())
return errors.Join(conf.ErrConfigValidation, ErrSilent)
}
if err != nil {
return err
}

return err
},
Expand Down

0 comments on commit c65b57e

Please sign in to comment.