Skip to content

Commit

Permalink
Renaming import alias
Browse files Browse the repository at this point in the history
  • Loading branch information
ycombinator committed Apr 20, 2021
1 parent 01353b0 commit d87e426
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions code/go/internal/validator/folder_item_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"regexp"
"sync"

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

"github.com/pkg/errors"
"github.com/xeipuuv/gojsonschema"
Expand Down Expand Up @@ -69,11 +69,11 @@ func (s *folderItemSpec) isSameType(file os.FileInfo) bool {
return false
}

func (s *folderItemSpec) validate(fs http.FileSystem, folderSpecPath string, itemPath string) errors2.ValidationErrors {
func (s *folderItemSpec) validate(fs http.FileSystem, folderSpecPath string, itemPath string) ve.ValidationErrors {
// loading item content
itemData, err := loadItemContent(itemPath, s.ContentMediaType)
if err != nil {
return errors2.ValidationErrors{err}
return ve.ValidationErrors{err}
}

var schemaLoader gojsonschema.JSONLoader
Expand All @@ -100,14 +100,14 @@ func (s *folderItemSpec) validate(fs http.FileSystem, folderSpecPath string, ite
loadDataStreamNameFormatChecker(filepath.Dir(itemPath))
result, err := gojsonschema.Validate(schemaLoader, documentLoader)
if err != nil {
return errors2.ValidationErrors{err}
return ve.ValidationErrors{err}
}

if result.Valid() {
return nil // item content is valid according to the loaded schema
}

var errs errors2.ValidationErrors
var errs ve.ValidationErrors
for _, re := range result.Errors() {
errs = append(errs, fmt.Errorf("field %s: %s", re.Field(), adjustErrorDescription(re.Description())))
}
Expand Down
6 changes: 3 additions & 3 deletions code/go/internal/validator/folder_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"regexp"
"strings"

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

"github.com/pkg/errors"
"gopkg.in/yaml.v3"
Expand Down Expand Up @@ -62,8 +62,8 @@ func newFolderSpec(fs http.FileSystem, specPath string) (*folderSpec, error) {
return &spec, nil
}

func (s *folderSpec) validate(packageName string, folderPath string) errors2.ValidationErrors {
var errs errors2.ValidationErrors
func (s *folderSpec) validate(packageName string, folderPath string) ve.ValidationErrors {
var errs ve.ValidationErrors
files, err := ioutil.ReadDir(folderPath)
if err != nil {
errs = append(errs, errors.Wrapf(err, "could not read folder [%s]", folderPath))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"path/filepath"
"strings"

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

"github.com/elastic/package-spec/code/go/internal/pkgpath"
"github.com/pkg/errors"
Expand All @@ -26,7 +26,7 @@ func ValidateKibanaObjectIDs(pkgRoot string) error {
return errors.Wrap(err, "unable to find Kibana object files")
}

var errs errors2.ValidationErrors
var errs ve.ValidationErrors
for _, objectFile := range objectFiles {
name := objectFile.Name()
objectID, err := objectFile.Values("$.id")
Expand Down
6 changes: 3 additions & 3 deletions code/go/internal/validator/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"path"
"strconv"

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

"github.com/elastic/package-spec/code/go/internal/validator/semantic"

Expand Down Expand Up @@ -48,8 +48,8 @@ func NewSpec(version semver.Version) (*Spec, error) {
}

// ValidatePackage validates the given Package against the Spec
func (s Spec) ValidatePackage(pkg Package) errors2.ValidationErrors {
var errs errors2.ValidationErrors
func (s Spec) ValidatePackage(pkg Package) ve.ValidationErrors {
var errs ve.ValidationErrors

rootSpecPath := path.Join(s.specPath, "spec.yml")
rootSpec, err := newFolderSpec(s.fs, rootSpecPath)
Expand Down

0 comments on commit d87e426

Please sign in to comment.