From 0595606a314bd983df1ba5393831825a65a34ed5 Mon Sep 17 00:00:00 2001 From: Tyler Cipriani Date: Thu, 22 Mar 2018 15:05:19 -0600 Subject: 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 --- config/policy.go | 2 +- config/validation.go | 6 +++--- 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) -- cgit v1.2.1