Skip to content

Commit

Permalink
Fixing return type
Browse files Browse the repository at this point in the history
  • Loading branch information
ycombinator committed Apr 20, 2021
1 parent 1ea625d commit 30c3dc1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ import (
// object files that define IDs not matching the file's name. That is, it returns
// validation errors if a Kibana object file, foo.json, in the package defines
// an object ID other than foo inside it.
func ValidateKibanaObjectIDs(pkgRoot string) error {
func ValidateKibanaObjectIDs(pkgRoot string) ve.ValidationErrors {
var errs ve.ValidationErrors

filePaths := filepath.Join(pkgRoot, "kibana", "*", "*.json")
objectFiles, err := pkgpath.Files(filePaths)
if err != nil {
return errors.Wrap(err, "unable to find Kibana object files")
errs = append(errs, errors.Wrap(err, "error finding Kibana object files"))
return errs
}

var errs ve.ValidationErrors
for _, objectFile := range objectFiles {
name := objectFile.Name()
objectID, err := objectFile.Values("$.id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

package semantic

import "github.com/elastic/package-spec/code/go/internal/errors"

// ValidateKibanaNoDanglingObjectIDs returns validation errors if there are any
// dangling references to Kibana objects in any Kibana object files. That is, it
// returns validation errors if a Kibana object file in the package references another
// Kibana object with ID i, but no Kibana object file for object ID i is found in the
// package.
func ValidateKibanaNoDanglingObjectIDs(pkgRoot string) error {
func ValidateKibanaNoDanglingObjectIDs(pkgRoot string) errors.ValidationErrors {
// TODO: will be implemented in follow up PR
return nil
}

0 comments on commit 30c3dc1

Please sign in to comment.