From f5edf564c8179d6139c4fc89947480a2cd2f3e87 Mon Sep 17 00:00:00 2001 From: Tao Wen Date: Mon, 19 Jun 2017 23:43:53 +0800 Subject: [PATCH] gofmt --- example_test.go | 2 +- feature_adapter.go | 1 - feature_any.go | 2 +- feature_any_array.go | 8 ++++---- feature_any_float.go | 1 - feature_any_number.go | 8 ++++---- feature_any_object.go | 10 +++++----- feature_any_string.go | 2 +- feature_config.go | 2 +- feature_iter.go | 14 +++++++------- feature_iter_skip.go | 2 +- feature_reflect_array.go | 4 ++-- jsoniter_any_array_test.go | 2 +- jsoniter_any_bool_test.go | 2 +- jsoniter_any_float_test.go | 2 +- jsoniter_any_int_test.go | 2 +- jsoniter_any_map_test.go | 2 +- jsoniter_any_null_test.go | 2 +- jsoniter_any_object_test.go | 2 +- jsoniter_any_string_test.go | 4 ++-- jsoniter_fixed_array_test.go | 4 ++-- jsoniter_map_test.go | 1 - jsoniter_object_test.go | 2 +- jsoniter_raw_message_test.go | 5 ++--- jsoniter_skip_test.go | 6 +++--- 25 files changed, 44 insertions(+), 48 deletions(-) diff --git a/example_test.go b/example_test.go index 1d38645..73dcf46 100644 --- a/example_test.go +++ b/example_test.go @@ -94,4 +94,4 @@ func ExampleOneLine() { fmt.Printf(jsoniter.Get(val, "Colors", 0).ToString()) // Output: // Crimson -} \ No newline at end of file +} diff --git a/feature_adapter.go b/feature_adapter.go index aaa8e2b..55aa023 100644 --- a/feature_adapter.go +++ b/feature_adapter.go @@ -43,7 +43,6 @@ func Get(data []byte, path ...interface{}) Any { return ConfigDefault.Get(data, path...) } - // Marshal adapts to json/encoding Marshal API // // Marshal returns the JSON encoding of v, adapts to json/encoding Marshal API diff --git a/feature_any.go b/feature_any.go index 060361e..e43bcd1 100644 --- a/feature_any.go +++ b/feature_any.go @@ -2,8 +2,8 @@ package jsoniter import ( "fmt" - "reflect" "io" + "reflect" ) type Any interface { diff --git a/feature_any_array.go b/feature_any_array.go index cd8674c..3609110 100644 --- a/feature_any_array.go +++ b/feature_any_array.go @@ -7,9 +7,9 @@ import ( type arrayLazyAny struct { baseAny - cfg *frozenConfig - buf []byte - err error + cfg *frozenConfig + buf []byte + err error } func (any *arrayLazyAny) ValueType() ValueType { @@ -175,7 +175,7 @@ func (any *arrayLazyAny) GetInterface() interface{} { type arrayAny struct { baseAny - val reflect.Value + val reflect.Value } func wrapArray(val interface{}) *arrayAny { diff --git a/feature_any_float.go b/feature_any_float.go index 1dde4a1..ad037b8 100644 --- a/feature_any_float.go +++ b/feature_any_float.go @@ -4,7 +4,6 @@ import ( "strconv" ) - type floatAny struct { baseAny val float64 diff --git a/feature_any_number.go b/feature_any_number.go index 8d4494f..1dc0244 100644 --- a/feature_any_number.go +++ b/feature_any_number.go @@ -6,9 +6,9 @@ import ( type numberLazyAny struct { baseAny - cfg *frozenConfig - buf []byte - err error + cfg *frozenConfig + buf []byte + err error } func (any *numberLazyAny) ValueType() ValueType { @@ -103,4 +103,4 @@ func (any *numberLazyAny) GetInterface() interface{} { iter := any.cfg.BorrowIterator(any.buf) defer any.cfg.ReturnIterator(iter) return iter.Read() -} \ No newline at end of file +} diff --git a/feature_any_object.go b/feature_any_object.go index 57848f1..7382233 100644 --- a/feature_any_object.go +++ b/feature_any_object.go @@ -158,7 +158,7 @@ func (any *objectLazyAny) Size() int { defer any.cfg.ReturnIterator(iter) iter.ReadObjectCB(func(iter *Iterator, field string) bool { iter.Skip() - size ++ + size++ return true }) return size @@ -187,8 +187,8 @@ func (any *objectLazyAny) GetInterface() interface{} { type objectAny struct { baseAny - err error - val reflect.Value + err error + val reflect.Value } func wrapStruct(val interface{}) *objectAny { @@ -342,8 +342,8 @@ func (any *objectAny) GetInterface() interface{} { type mapAny struct { baseAny - err error - val reflect.Value + err error + val reflect.Value } func wrapMap(val interface{}) *mapAny { diff --git a/feature_any_string.go b/feature_any_string.go index 85a5984..e3dcd6a 100644 --- a/feature_any_string.go +++ b/feature_any_string.go @@ -1,8 +1,8 @@ package jsoniter import ( - "strconv" "fmt" + "strconv" ) type stringAny struct { diff --git a/feature_config.go b/feature_config.go index 28fe117..2093dc1 100644 --- a/feature_config.go +++ b/feature_config.go @@ -1,12 +1,12 @@ package jsoniter import ( + "encoding/json" "errors" "io" "reflect" "sync/atomic" "unsafe" - "encoding/json" ) type Config struct { diff --git a/feature_iter.go b/feature_iter.go index 1f3fea0..cb1b18f 100644 --- a/feature_iter.go +++ b/feature_iter.go @@ -65,14 +65,14 @@ func init() { // Iterator is a fast and flexible JSON parser type Iterator struct { - cfg *frozenConfig - reader io.Reader - buf []byte - head int - tail int + cfg *frozenConfig + reader io.Reader + buf []byte + head int + tail int captureStartedAt int - captured []byte - Error error + captured []byte + Error error } // Create creates an empty Iterator instance diff --git a/feature_iter_skip.go b/feature_iter_skip.go index 538a1d7..5337b34 100644 --- a/feature_iter_skip.go +++ b/feature_iter_skip.go @@ -53,7 +53,7 @@ func (iter *Iterator) stopCapture() []byte { panic("not in capture mode") } captured := iter.captured - remaining := iter.buf[iter.captureStartedAt: iter.head] + remaining := iter.buf[iter.captureStartedAt:iter.head] iter.captureStartedAt = -1 iter.captured = nil if len(captured) == 0 { diff --git a/feature_reflect_array.go b/feature_reflect_array.go index dd38565..f67072d 100644 --- a/feature_reflect_array.go +++ b/feature_reflect_array.go @@ -1,10 +1,10 @@ package jsoniter import ( + "fmt" + "io" "reflect" "unsafe" - "io" - "fmt" ) func decoderOfArray(cfg *frozenConfig, typ reflect.Type) (Decoder, error) { diff --git a/jsoniter_any_array_test.go b/jsoniter_any_array_test.go index 0ce3f84..577745e 100644 --- a/jsoniter_any_array_test.go +++ b/jsoniter_any_array_test.go @@ -1,8 +1,8 @@ package jsoniter import ( - "testing" "github.com/json-iterator/go/require" + "testing" ) func Test_read_empty_array_as_any(t *testing.T) { diff --git a/jsoniter_any_bool_test.go b/jsoniter_any_bool_test.go index febce9f..7344f4d 100644 --- a/jsoniter_any_bool_test.go +++ b/jsoniter_any_bool_test.go @@ -1,8 +1,8 @@ package jsoniter import ( - "testing" "github.com/json-iterator/go/require" + "testing" ) func Test_read_bool_as_any(t *testing.T) { diff --git a/jsoniter_any_float_test.go b/jsoniter_any_float_test.go index 4406fd6..6606956 100644 --- a/jsoniter_any_float_test.go +++ b/jsoniter_any_float_test.go @@ -1,8 +1,8 @@ package jsoniter import ( - "testing" "github.com/json-iterator/go/require" + "testing" ) func Test_read_float_as_any(t *testing.T) { diff --git a/jsoniter_any_int_test.go b/jsoniter_any_int_test.go index f126da6..b19f4f9 100644 --- a/jsoniter_any_int_test.go +++ b/jsoniter_any_int_test.go @@ -1,9 +1,9 @@ package jsoniter import ( - "testing" "github.com/json-iterator/go/require" "io" + "testing" ) func Test_read_int64_as_any(t *testing.T) { diff --git a/jsoniter_any_map_test.go b/jsoniter_any_map_test.go index d6b3c42..53a4e9e 100644 --- a/jsoniter_any_map_test.go +++ b/jsoniter_any_map_test.go @@ -1,8 +1,8 @@ package jsoniter import ( - "testing" "github.com/json-iterator/go/require" + "testing" ) func Test_wrap_map(t *testing.T) { diff --git a/jsoniter_any_null_test.go b/jsoniter_any_null_test.go index 2cf9233..78f1551 100644 --- a/jsoniter_any_null_test.go +++ b/jsoniter_any_null_test.go @@ -1,8 +1,8 @@ package jsoniter import ( - "testing" "github.com/json-iterator/go/require" + "testing" ) func Test_read_null_as_any(t *testing.T) { diff --git a/jsoniter_any_object_test.go b/jsoniter_any_object_test.go index 03de5a6..4c85f4d 100644 --- a/jsoniter_any_object_test.go +++ b/jsoniter_any_object_test.go @@ -1,8 +1,8 @@ package jsoniter import ( - "testing" "github.com/json-iterator/go/require" + "testing" ) func Test_read_object_as_any(t *testing.T) { diff --git a/jsoniter_any_string_test.go b/jsoniter_any_string_test.go index 72e6d37..f17a111 100644 --- a/jsoniter_any_string_test.go +++ b/jsoniter_any_string_test.go @@ -1,8 +1,8 @@ package jsoniter import ( - "testing" "github.com/json-iterator/go/require" + "testing" ) func Test_read_string_as_any(t *testing.T) { @@ -22,4 +22,4 @@ func Test_wrap_string(t *testing.T) { should := require.New(t) any := WrapString("123") should.Equal(123, any.ToInt()) -} \ No newline at end of file +} diff --git a/jsoniter_fixed_array_test.go b/jsoniter_fixed_array_test.go index 586bbd7..17a77fd 100644 --- a/jsoniter_fixed_array_test.go +++ b/jsoniter_fixed_array_test.go @@ -1,9 +1,9 @@ package jsoniter import ( - "testing" - "github.com/json-iterator/go/require" "encoding/json" + "github.com/json-iterator/go/require" + "testing" ) func Test_encode_fixed_array(t *testing.T) { diff --git a/jsoniter_map_test.go b/jsoniter_map_test.go index a418963..794bcb1 100644 --- a/jsoniter_map_test.go +++ b/jsoniter_map_test.go @@ -120,4 +120,3 @@ func Test_encode_map_with_sorted_keys(t *testing.T) { should.Nil(err) should.Equal(string(bytes), output) } - diff --git a/jsoniter_object_test.go b/jsoniter_object_test.go index 26e7ff3..07436f3 100644 --- a/jsoniter_object_test.go +++ b/jsoniter_object_test.go @@ -2,9 +2,9 @@ package jsoniter import ( "bytes" + "fmt" "github.com/json-iterator/go/require" "testing" - "fmt" ) func Test_empty_object(t *testing.T) { diff --git a/jsoniter_raw_message_test.go b/jsoniter_raw_message_test.go index 17a9a02..fd967e9 100644 --- a/jsoniter_raw_message_test.go +++ b/jsoniter_raw_message_test.go @@ -1,9 +1,9 @@ package jsoniter import ( - "testing" "encoding/json" "github.com/json-iterator/go/require" + "testing" ) func Test_json_RawMessage(t *testing.T) { @@ -38,7 +38,6 @@ func Test_json_RawMessage_in_struct(t *testing.T) { should.Equal(`hello`, data.Field1) } - func Test_decode_map_of_raw_message(t *testing.T) { should := require.New(t) type RawMap map[string]*json.RawMessage @@ -72,4 +71,4 @@ func Test_encode_map_of_jsoniter_raw_message(t *testing.T) { output, err := MarshalToString(rawMap) should.Nil(err) should.Equal(`{"hello":[]}`, output) -} \ No newline at end of file +} diff --git a/jsoniter_skip_test.go b/jsoniter_skip_test.go index 7d32d97..c789a98 100644 --- a/jsoniter_skip_test.go +++ b/jsoniter_skip_test.go @@ -1,10 +1,10 @@ package jsoniter import ( - "encoding/json" - "testing" - "github.com/json-iterator/go/require" "bytes" + "encoding/json" + "github.com/json-iterator/go/require" + "testing" ) func Test_skip_number(t *testing.T) {