From 083f0b20911750dfaf3fa0b23b3ef55bd37a3fd9 Mon Sep 17 00:00:00 2001 From: qiangxue Date: Wed, 4 Dec 2019 10:14:25 -0500 Subject: [PATCH] gofmt fixes --- .travis.yml | 2 +- example_test.go | 2 +- multipleof.go | 6 +++--- validation.go | 4 ++-- validation_test.go | 8 ++++---- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9b4348e..28febbd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ install: - go get golang.org/x/lint/golint script: - - test -z "`gofmt -l .`" + - test -z "`gofmt -l -d .`" - test -z "`golint ./...`" - go test -v -covermode=count -coverprofile=coverage.out - $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci diff --git a/example_test.go b/example_test.go index 13bdb38..6ee5a79 100644 --- a/example_test.go +++ b/example_test.go @@ -73,7 +73,7 @@ func Example_second() { err := validation.Validate(data, validation.Required, // not empty validation.Length(5, 100), // length between 5 and 100 - is.URL, // is a valid URL + is.URL, // is a valid URL ) fmt.Println(err) // Output: diff --git a/multipleof.go b/multipleof.go index 4787764..eb322ee 100644 --- a/multipleof.go +++ b/multipleof.go @@ -7,7 +7,7 @@ import ( ) // MultipleOf returns a validation rule that checks if a value is a multiple of the "base" value. -// Note that "base" should be of integer type. +// Note that "base" should be of integer type. func MultipleOf(base interface{}) *MultipleOfRule { return &MultipleOfRule{ base, @@ -17,8 +17,8 @@ func MultipleOf(base interface{}) *MultipleOfRule { // MultipleOfRule is a validation rule that checks if a value is a multiple of the "base" value. type MultipleOfRule struct { - base interface{} - message string + base interface{} + message string } // Error sets the error message for the rule. diff --git a/validation.go b/validation.go index 7f49f99..af86b7b 100644 --- a/validation.go +++ b/validation.go @@ -53,7 +53,7 @@ var ( // Skip is a special validation rule that indicates all rules following it should be skipped. Skip = &skipRule{} - validatableType = reflect.TypeOf((*Validatable)(nil)).Elem() + validatableType = reflect.TypeOf((*Validatable)(nil)).Elem() validatableWithContextType = reflect.TypeOf((*ValidatableWithContext)(nil)).Elem() ) @@ -235,7 +235,7 @@ func (r *skipRule) Validate(interface{}) error { } type inlineRule struct { - f RuleFunc + f RuleFunc fc RuleWithContextFunc } diff --git a/validation_test.go b/validation_test.go index 7cd33e6..9c3dc78 100644 --- a/validation_test.go +++ b/validation_test.go @@ -24,9 +24,9 @@ func TestValidate(t *testing.T) { withCtx StringValidateContext = "xyz" ) tests := []struct { - tag string - value interface{} - err string + tag string + value interface{} + err string errWithContext string }{ {"t1", 123, "", ""}, @@ -102,7 +102,7 @@ func TestBy(t *testing.T) { assert.Nil(t, Validate("xyz", xyzRule)) assert.NotNil(t, Validate("abc", xyzRule)) assert.Nil(t, ValidateWithContext(context.Background(), "xyz", xyzRule)) - assert.NotNil(t, ValidateWithContext(context.Background(),"abc", xyzRule)) + assert.NotNil(t, ValidateWithContext(context.Background(), "abc", xyzRule)) } type key int