summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Cipriani <tcipriani@wikimedia.org>2018-03-22 15:05:19 -0600
committerTyler Cipriani <tcipriani@wikimedia.org>2018-03-22 15:05:33 -0600
commit0595606a314bd983df1ba5393831825a65a34ed5 (patch)
treef92db6972c5a4ef33bfa601cf767c9774de93e1c
parentcffb77e9dbb14db23ed11c24c68579bd75891f9d (diff)
downloadblubber-0595606a314bd983df1ba5393831825a65a34ed5.tar.gz
No need to export NewValidator
Summary: It occurred to me while looking at code in another patch that there is no need to have this function be public. Test Plan: `go test ./...` Reviewers: dduvall, #release-engineering-team Reviewed By: dduvall, #release-engineering-team Tags: #release-engineering-team Differential Revision: https://phabricator.wikimedia.org/D1012
-rw-r--r--config/policy.go2
-rw-r--r--config/validation.go6
2 files changed, 4 insertions, 4 deletions
diff --git a/config/policy.go b/config/policy.go
index 25fe02a..f143f1a 100644
--- a/config/policy.go
+++ b/config/policy.go
@@ -20,7 +20,7 @@ type Policy struct {
// Validate checks the given config against all policy enforcements.
//
func (pol Policy) Validate(config Config) error {
- validate := NewValidator()
+ validate := newValidator()
for _, enforcement := range pol.Enforcements {
cfg, err := ResolveYAMLPath(enforcement.Path, config)
diff --git a/config/validation.go b/config/validation.go
index 3359211..646e49d 100644
--- a/config/validation.go
+++ b/config/validation.go
@@ -63,10 +63,10 @@ type ctxKey uint8
const rootCfgCtx ctxKey = iota
-// NewValidator returns a validator instance for which our custom aliases and
+// newValidator returns a validator instance for which our custom aliases and
// functions are registered.
//
-func NewValidator() *validator.Validate {
+func newValidator() *validator.Validate {
validate := validator.New()
validate.RegisterTagNameFunc(resolveYAMLTagName)
@@ -87,7 +87,7 @@ func NewValidator() *validator.Validate {
// user-friendly message describing all invalid field values.
//
func Validate(config Config) error {
- validate := NewValidator()
+ validate := newValidator()
ctx := context.WithValue(context.Background(), rootCfgCtx, config)