From eecb431c4188013367cb2a1270207f2f6799b9ab Mon Sep 17 00:00:00 2001 From: saad-ali Date: Fri, 2 Mar 2018 13:49:31 -0800 Subject: [PATCH] Move CSI to 0.2.0 tag and update other deps --- Gopkg.lock | 53 +- Gopkg.toml | 6 +- vendor/github.com/json-iterator/go/Gopkg.lock | 28 +- vendor/github.com/json-iterator/go/Gopkg.toml | 13 +- vendor/github.com/json-iterator/go/README.md | 2 + .../go/{feature_adapter.go => adapter.go} | 33 +- .../go/{feature_any.go => any.go} | 82 +- .../go/{feature_any_array.go => any_array.go} | 0 .../go/{feature_any_bool.go => any_bool.go} | 0 .../go/{feature_any_float.go => any_float.go} | 0 .../go/{feature_any_int32.go => any_int32.go} | 0 .../go/{feature_any_int64.go => any_int64.go} | 0 ...{feature_any_invalid.go => any_invalid.go} | 0 .../go/{feature_any_nil.go => any_nil.go} | 0 .../{feature_any_number.go => any_number.go} | 2 +- .../{feature_any_object.go => any_object.go} | 0 .../go/{feature_any_string.go => any_str.go} | 2 +- .../jsoniter_any_array_test.go | 41 +- .../{ => any_tests}/jsoniter_any_bool_test.go | 19 +- .../jsoniter_any_float_test.go | 13 +- .../{ => any_tests}/jsoniter_any_int_test.go | 45 +- .../go/any_tests/jsoniter_any_map_test.go | 28 + .../{ => any_tests}/jsoniter_any_null_test.go | 5 +- .../jsoniter_any_object_test.go | 46 +- .../jsoniter_any_string_test.go | 15 +- .../jsoniter_must_be_valid_test.go | 43 +- .../go/{ => any_tests}/jsoniter_wrap_test.go | 73 +- .../{feature_any_uint32.go => any_uint32.go} | 0 .../{feature_any_uint64.go => any_uint64.go} | 0 .../json-iterator/go/api_tests/config_test.go | 47 + .../go/api_tests/decoder_test.go | 58 + .../encoder_18_test.go} | 9 +- .../go/api_tests/encoder_test.go | 20 + .../go/api_tests/marshal_indent_test.go | 36 + .../go/benchmarks/encode_string_test.go | 25 + .../jsoniter_large_file_test.go | 7 +- .../json-iterator/go/compatible_test.go | 40 - .../go/{feature_config.go => config.go} | 185 +- .../json-iterator/go/example_test.go | 26 + .../go/extension_tests/decoder_test.go | 100 + .../go/extension_tests/extension_test.go | 120 + .../go/extra/binary_as_string_codec.go | 238 ++ .../go/extra/binary_as_string_codec_test.go | 32 + .../json-iterator/go/extra/fuzzy_decoder.go | 17 +- .../go/extra/fuzzy_decoder_test.go | 32 + .../json-iterator/go/extra/naming_strategy.go | 4 +- .../json-iterator/go/extra/privat_fields.go | 6 +- .../go/extra/time_as_int64_codec.go | 3 - .../go/feature_config_with_sync_map.go | 51 - .../go/feature_config_without_sync_map.go | 54 - .../json-iterator/go/feature_json_number.go | 31 - .../json-iterator/go/feature_reflect.go | 607 ---- .../json-iterator/go/feature_reflect_array.go | 110 - .../json-iterator/go/feature_reflect_map.go | 260 -- .../go/feature_reflect_native.go | 789 ----- .../json-iterator/go/feature_reflect_slice.go | 143 - .../json-iterator/go/feature_stream_int.go | 320 -- .../go/{feature_iter.go => iter.go} | 0 .../{feature_iter_array.go => iter_array.go} | 0 .../{feature_iter_float.go => iter_float.go} | 0 .../go/{feature_iter_int.go => iter_int.go} | 6 + ...{feature_iter_object.go => iter_object.go} | 135 +- .../go/{feature_iter_skip.go => iter_skip.go} | 0 ...ter_skip_sloppy.go => iter_skip_sloppy.go} | 0 ...loppy_test.go => iter_skip_sloppy_test.go} | 2 +- ...ter_skip_strict.go => iter_skip_strict.go} | 0 .../{feature_iter_string.go => iter_str.go} | 0 .../json-iterator/go/jsoniter_adapter_test.go | 84 - .../json-iterator/go/jsoniter_alias_test.go | 62 - .../json-iterator/go/jsoniter_any_map_test.go | 14 - .../json-iterator/go/jsoniter_bool_test.go | 113 - .../go/jsoniter_customize_test.go | 342 --- .../json-iterator/go/jsoniter_demo_test.go | 87 - .../go/jsoniter_encode_interface_test.go | 42 - .../go/jsoniter_enum_marshaler_test.go | 50 - .../go/jsoniter_fixed_array_test.go | 46 - .../go/jsoniter_interface_test.go | 576 ---- .../json-iterator/go/jsoniter_io_test.go | 65 - .../json-iterator/go/jsoniter_map_test.go | 160 - .../json-iterator/go/jsoniter_null_test.go | 168 -- .../json-iterator/go/jsoniter_object_test.go | 364 --- .../go/jsoniter_optional_test.go | 46 - .../go/jsoniter_raw_message_test.go | 114 - .../json-iterator/go/jsoniter_reader_test.go | 57 - .../go/jsoniter_reflect_native_test.go | 154 - .../json-iterator/go/jsoniter_string_test.go | 261 -- .../go/jsoniter_struct_decoder_test.go | 267 -- .../go/jsoniter_struct_encoder_test.go | 52 - .../{ => misc_tests}/jsoniter_array_test.go | 47 +- .../go/misc_tests/jsoniter_bool_test.go | 47 + .../go/misc_tests/jsoniter_float_test.go | 95 + .../go/misc_tests/jsoniter_int_test.go | 101 + .../go/misc_tests/jsoniter_interface_test.go | 178 ++ .../jsoniter_iterator_test.go | 9 +- .../go/misc_tests/jsoniter_map_test.go | 33 + .../{ => misc_tests}/jsoniter_nested_test.go | 9 +- .../go/misc_tests/jsoniter_null_test.go | 81 + .../go/misc_tests/jsoniter_object_test.go | 132 + .../misc_tests/jsoniter_raw_message_test.go | 68 + .../array/array/bool/json_test.go | 152 - .../go/output_tests/array/array/bool/types.go | 3 - .../array/array/byte/json_test.go | 152 - .../go/output_tests/array/array/byte/types.go | 3 - .../array/array/float64/json_test.go | 152 - .../output_tests/array/array/float64/types.go | 3 - .../array/array/int32/json_test.go | 152 - .../output_tests/array/array/int32/types.go | 3 - .../array/array/ptr_string/json_test.go | 152 - .../array/array/ptr_string/types.go | 3 - .../array/array/string/json_test.go | 152 - .../output_tests/array/array/string/types.go | 3 - .../array/array/uint8/json_test.go | 152 - .../output_tests/array/array/uint8/types.go | 3 - .../go/output_tests/array/bool/json_test.go | 152 - .../go/output_tests/array/bool/types.go | 3 - .../go/output_tests/array/byte/json_test.go | 152 - .../go/output_tests/array/byte/types.go | 3 - .../output_tests/array/float64/json_test.go | 152 - .../go/output_tests/array/float64/types.go | 3 - .../go/output_tests/array/int32/json_test.go | 152 - .../go/output_tests/array/int32/types.go | 3 - .../array/map/int32_string/json_test.go | 152 - .../array/map/int32_string/types.go | 3 - .../array/map/string_string/json_test.go | 152 - .../array/map/string_string/types.go | 3 - .../output_tests/array/ptr_bool/json_test.go | 152 - .../go/output_tests/array/ptr_bool/types.go | 3 - .../array/ptr_float64/json_test.go | 152 - .../output_tests/array/ptr_float64/types.go | 3 - .../output_tests/array/ptr_int32/json_test.go | 152 - .../go/output_tests/array/ptr_int32/types.go | 3 - .../array/ptr_map/int32_string/json_test.go | 152 - .../array/ptr_map/int32_string/types.go | 3 - .../array/ptr_map/string_string/json_test.go | 152 - .../array/ptr_map/string_string/types.go | 3 - .../array/ptr_slice/bool/json_test.go | 152 - .../array/ptr_slice/bool/types.go | 3 - .../array/ptr_slice/byte/json_test.go | 152 - .../array/ptr_slice/byte/types.go | 3 - .../array/ptr_slice/float64/json_test.go | 152 - .../array/ptr_slice/float64/types.go | 3 - .../array/ptr_slice/int32/json_test.go | 152 - .../array/ptr_slice/int32/types.go | 3 - .../array/ptr_slice/ptr_string/json_test.go | 152 - .../array/ptr_slice/ptr_string/types.go | 3 - .../array/ptr_slice/string/json_test.go | 152 - .../array/ptr_slice/string/types.go | 3 - .../array/ptr_slice/uint8/json_test.go | 152 - .../array/ptr_slice/uint8/types.go | 3 - .../array/ptr_string/json_test.go | 152 - .../go/output_tests/array/ptr_string/types.go | 3 - .../array/ptr_struct_various/json_test.go | 152 - .../array/ptr_struct_various/types.go | 12 - .../output_tests/array/ptr_uint8/json_test.go | 152 - .../go/output_tests/array/ptr_uint8/types.go | 3 - .../array/slice/bool/json_test.go | 152 - .../go/output_tests/array/slice/bool/types.go | 3 - .../array/slice/byte/json_test.go | 152 - .../go/output_tests/array/slice/byte/types.go | 3 - .../array/slice/float64/json_test.go | 152 - .../output_tests/array/slice/float64/types.go | 3 - .../array/slice/int32/json_test.go | 152 - .../output_tests/array/slice/int32/types.go | 3 - .../array/slice/ptr_string/json_test.go | 152 - .../array/slice/ptr_string/types.go | 3 - .../array/slice/string/json_test.go | 152 - .../output_tests/array/slice/string/types.go | 3 - .../array/slice/uint8/json_test.go | 152 - .../output_tests/array/slice/uint8/types.go | 3 - .../go/output_tests/array/string/json_test.go | 152 - .../go/output_tests/array/string/types.go | 3 - .../array/struct_empty/json_test.go | 152 - .../output_tests/array/struct_empty/types.go | 3 - .../array/struct_empty_alias/json_test.go | 152 - .../array/struct_empty_alias/types.go | 5 - .../array/struct_ptr_string/json_test.go | 152 - .../array/struct_ptr_string/types.go | 5 - .../array/struct_various/json_test.go | 152 - .../array/struct_various/types.go | 12 - .../go/output_tests/array/uint8/json_test.go | 152 - .../go/output_tests/array/uint8/types.go | 3 - .../output_tests/builtins/bool/json_test.go | 152 - .../go/output_tests/builtins/bool/types.go | 3 - .../builtins/bool_alias/json_test.go | 152 - .../output_tests/builtins/bool_alias/types.go | 3 - .../output_tests/builtins/byte/json_test.go | 152 - .../go/output_tests/builtins/byte/types.go | 3 - .../builtins/byte_alias/json_test.go | 152 - .../output_tests/builtins/byte_alias/types.go | 3 - .../builtins/float32/json_test.go | 152 - .../go/output_tests/builtins/float32/types.go | 3 - .../builtins/float32_alias/json_test.go | 152 - .../builtins/float32_alias/types.go | 3 - .../builtins/float64/json_test.go | 152 - .../go/output_tests/builtins/float64/types.go | 3 - .../builtins/float64_alias/json_test.go | 152 - .../builtins/float64_alias/types.go | 3 - .../output_tests/builtins/int16/json_test.go | 152 - .../go/output_tests/builtins/int16/types.go | 3 - .../builtins/int16_alias/json_test.go | 152 - .../builtins/int16_alias/types.go | 3 - .../output_tests/builtins/int32/json_test.go | 152 - .../go/output_tests/builtins/int32/types.go | 3 - .../builtins/int32_alias/json_test.go | 152 - .../builtins/int32_alias/types.go | 3 - .../output_tests/builtins/int64/json_test.go | 152 - .../go/output_tests/builtins/int64/types.go | 3 - .../output_tests/builtins/int8/json_test.go | 152 - .../go/output_tests/builtins/int8/types.go | 3 - .../builtins/int8_alias/json_test.go | 152 - .../output_tests/builtins/int8_alias/types.go | 3 - .../output_tests/builtins/string/json_test.go | 152 - .../go/output_tests/builtins/string/types.go | 3 - .../builtins/string_alias/json_test.go | 152 - .../builtins/string_alias/types.go | 3 - .../output_tests/builtins/uint16/json_test.go | 152 - .../go/output_tests/builtins/uint16/types.go | 3 - .../builtins/uint16_alias/json_test.go | 152 - .../builtins/uint16_alias/types.go | 3 - .../output_tests/builtins/uint32/json_test.go | 152 - .../go/output_tests/builtins/uint32/types.go | 3 - .../builtins/uint32_alias/json_test.go | 152 - .../builtins/uint32_alias/types.go | 3 - .../output_tests/builtins/uint8/json_test.go | 152 - .../go/output_tests/builtins/uint8/types.go | 3 - .../builtins/uint8_alias/json_test.go | 152 - .../builtins/uint8_alias/types.go | 3 - .../builtins/uintptr/json_test.go | 152 - .../go/output_tests/builtins/uintptr/types.go | 3 - .../caseless_unmarshal/caseless_test.go | 84 - .../output_tests/caseless_unmarshal/types.go | 9 - .../json_marshal/string_alias/json_test.go | 152 - .../json_marshal/string_alias/types.go | 50 - .../json_marshal/struct/json_test.go | 152 - .../output_tests/json_marshal/struct/types.go | 52 - .../json_marshal/struct_alias/json_test.go | 152 - .../json_marshal/struct_alias/types.go | 54 - .../json_marshal/struct_field/json_test.go | 152 - .../json_marshal/struct_field/types.go | 56 - .../struct_field_alias/json_test.go | 152 - .../json_marshal/struct_field_alias/types.go | 58 - .../map/int16/string/json_test.go | 152 - .../go/output_tests/map/int16/string/types.go | 3 - .../map/int32/string/json_test.go | 152 - .../go/output_tests/map/int32/string/types.go | 3 - .../map/int64/string/json_test.go | 152 - .../go/output_tests/map/int64/string/types.go | 3 - .../output_tests/map/int8/string/json_test.go | 152 - .../go/output_tests/map/int8/string/types.go | 3 - .../map/string/array_string/json_test.go | 152 - .../map/string/array_string/types.go | 3 - .../output_tests/map/string/bool/json_test.go | 152 - .../go/output_tests/map/string/bool/types.go | 3 - .../output_tests/map/string/byte/json_test.go | 152 - .../go/output_tests/map/string/byte/types.go | 3 - .../map/string/float64/json_test.go | 152 - .../output_tests/map/string/float64/types.go | 3 - .../map/string/int32/json_test.go | 152 - .../go/output_tests/map/string/int32/types.go | 3 - .../map/string/map_string_string/json_test.go | 152 - .../map/string/map_string_string/types.go | 3 - .../map/string/ptr_array_string/json_test.go | 152 - .../map/string/ptr_array_string/types.go | 3 - .../map/string/ptr_bool/json_test.go | 152 - .../output_tests/map/string/ptr_bool/types.go | 3 - .../map/string/ptr_float64/json_test.go | 152 - .../map/string/ptr_float64/types.go | 3 - .../map/string/ptr_int32/json_test.go | 152 - .../map/string/ptr_int32/types.go | 3 - .../string/ptr_map_string_string/json_test.go | 152 - .../map/string/ptr_map_string_string/types.go | 3 - .../map/string/ptr_slice_string/json_test.go | 152 - .../map/string/ptr_slice_string/types.go | 3 - .../map/string/ptr_string/json_test.go | 152 - .../map/string/ptr_string/types.go | 3 - .../string/ptr_struct_various/json_test.go | 152 - .../map/string/ptr_struct_various/types.go | 14 - .../map/string/ptr_uint8/json_test.go | 152 - .../map/string/ptr_uint8/types.go | 3 - .../map/string/slice_string/json_test.go | 152 - .../map/string/slice_string/types.go | 3 - .../map/string/string/json_test.go | 152 - .../output_tests/map/string/string/types.go | 3 - .../map/string/string_alias/json_test.go | 152 - .../map/string/string_alias/types.go | 5 - .../map/string/struct_empty/json_test.go | 152 - .../map/string/struct_empty/types.go | 3 - .../string/struct_empty_alias/json_test.go | 152 - .../map/string/struct_empty_alias/types.go | 5 - .../map/string/struct_ptr_string/json_test.go | 152 - .../map/string/struct_ptr_string/types.go | 5 - .../map/string/struct_various/json_test.go | 152 - .../map/string/struct_various/types.go | 12 - .../map/string/uint8/json_test.go | 152 - .../go/output_tests/map/string/uint8/types.go | 3 - .../map/string_alias/string/json_test.go | 152 - .../map/string_alias/string/types.go | 5 - .../string_alias/string_alias/json_test.go | 152 - .../map/string_alias/string_alias/types.go | 5 - .../map/uint16/string/json_test.go | 152 - .../output_tests/map/uint16/string/types.go | 3 - .../map/uint32/string/json_test.go | 152 - .../output_tests/map/uint32/string/types.go | 3 - .../map/uint8/string/json_test.go | 152 - .../go/output_tests/map/uint8/string/types.go | 3 - .../string_alias/json_test.go | 152 - .../string_alias/types.go | 22 - .../map_key_text_marshal/struct/json_test.go | 152 - .../map_key_text_marshal/struct/types.go | 24 - .../go/output_tests/marshal_fail_case.go | 23 - .../partial_unmarshal/partial_test.go | 84 - .../output_tests/partial_unmarshal/types.go | 11 - .../slice/array/bool/json_test.go | 152 - .../go/output_tests/slice/array/bool/types.go | 3 - .../slice/array/byte/json_test.go | 152 - .../go/output_tests/slice/array/byte/types.go | 3 - .../slice/array/float64/json_test.go | 152 - .../output_tests/slice/array/float64/types.go | 3 - .../slice/array/int32/json_test.go | 152 - .../output_tests/slice/array/int32/types.go | 3 - .../slice/array/ptr_string/json_test.go | 152 - .../slice/array/ptr_string/types.go | 3 - .../slice/array/string/json_test.go | 152 - .../output_tests/slice/array/string/types.go | 3 - .../slice/array/uint8/json_test.go | 152 - .../output_tests/slice/array/uint8/types.go | 3 - .../go/output_tests/slice/bool/json_test.go | 152 - .../go/output_tests/slice/bool/types.go | 3 - .../go/output_tests/slice/byte/json_test.go | 152 - .../go/output_tests/slice/byte/types.go | 3 - .../output_tests/slice/float64/json_test.go | 152 - .../go/output_tests/slice/float64/types.go | 3 - .../go/output_tests/slice/int32/json_test.go | 152 - .../go/output_tests/slice/int32/types.go | 3 - .../go/output_tests/slice/int64/json_test.go | 152 - .../go/output_tests/slice/int64/types.go | 3 - .../slice/map/int32_string/json_test.go | 152 - .../slice/map/int32_string/types.go | 3 - .../slice/map/string_string/json_test.go | 152 - .../slice/map/string_string/types.go | 3 - .../slice/ptr_array/bool/json_test.go | 152 - .../slice/ptr_array/bool/types.go | 3 - .../slice/ptr_array/byte/json_test.go | 152 - .../slice/ptr_array/byte/types.go | 3 - .../slice/ptr_array/float64/json_test.go | 152 - .../slice/ptr_array/float64/types.go | 3 - .../slice/ptr_array/int32/json_test.go | 152 - .../slice/ptr_array/int32/types.go | 3 - .../slice/ptr_array/ptr_string/json_test.go | 152 - .../slice/ptr_array/ptr_string/types.go | 3 - .../slice/ptr_array/string/json_test.go | 152 - .../slice/ptr_array/string/types.go | 3 - .../slice/ptr_array/uint8/json_test.go | 152 - .../slice/ptr_array/uint8/types.go | 3 - .../output_tests/slice/ptr_bool/json_test.go | 152 - .../go/output_tests/slice/ptr_bool/types.go | 3 - .../slice/ptr_float64/json_test.go | 152 - .../output_tests/slice/ptr_float64/types.go | 3 - .../output_tests/slice/ptr_int32/json_test.go | 152 - .../go/output_tests/slice/ptr_int32/types.go | 3 - .../slice/ptr_map/int32_string/json_test.go | 152 - .../slice/ptr_map/int32_string/types.go | 3 - .../slice/ptr_map/string_string/json_test.go | 152 - .../slice/ptr_map/string_string/types.go | 3 - .../slice/ptr_slice/bool/json_test.go | 152 - .../slice/ptr_slice/bool/types.go | 3 - .../slice/ptr_slice/byte/json_test.go | 152 - .../slice/ptr_slice/byte/types.go | 3 - .../slice/ptr_slice/float64/json_test.go | 152 - .../slice/ptr_slice/float64/types.go | 3 - .../slice/ptr_slice/int32/json_test.go | 152 - .../slice/ptr_slice/int32/types.go | 3 - .../slice/ptr_slice/ptr_string/json_test.go | 152 - .../slice/ptr_slice/ptr_string/types.go | 3 - .../slice/ptr_slice/string/json_test.go | 152 - .../slice/ptr_slice/string/types.go | 3 - .../slice/ptr_slice/uint8/json_test.go | 152 - .../slice/ptr_slice/uint8/types.go | 3 - .../slice/ptr_string/json_test.go | 152 - .../go/output_tests/slice/ptr_string/types.go | 3 - .../slice/ptr_struct_various/json_test.go | 152 - .../slice/ptr_struct_various/types.go | 12 - .../output_tests/slice/ptr_uint8/json_test.go | 152 - .../go/output_tests/slice/ptr_uint8/types.go | 3 - .../slice/slice/bool/json_test.go | 152 - .../go/output_tests/slice/slice/bool/types.go | 3 - .../slice/slice/byte/json_test.go | 152 - .../go/output_tests/slice/slice/byte/types.go | 3 - .../slice/slice/float64/json_test.go | 152 - .../output_tests/slice/slice/float64/types.go | 3 - .../slice/slice/int32/json_test.go | 152 - .../output_tests/slice/slice/int32/types.go | 3 - .../slice/slice/ptr_string/json_test.go | 152 - .../slice/slice/ptr_string/types.go | 3 - .../slice/slice/string/json_test.go | 152 - .../output_tests/slice/slice/string/types.go | 3 - .../slice/slice/uint8/json_test.go | 152 - .../output_tests/slice/slice/uint8/types.go | 3 - .../go/output_tests/slice/string/json_test.go | 152 - .../go/output_tests/slice/string/types.go | 3 - .../slice/struct_empty/json_test.go | 152 - .../output_tests/slice/struct_empty/types.go | 3 - .../slice/struct_empty_alias/json_test.go | 152 - .../slice/struct_empty_alias/types.go | 5 - .../slice/struct_ptr_string/json_test.go | 152 - .../slice/struct_ptr_string/types.go | 5 - .../slice/struct_various/json_test.go | 152 - .../slice/struct_various/types.go | 12 - .../go/output_tests/slice/uint8/json_test.go | 152 - .../go/output_tests/slice/uint8/types.go | 3 - .../go/output_tests/struct/alias/json_test.go | 152 - .../go/output_tests/struct/alias/types.go | 20 - .../anonymous/no_overlap/float64/json_test.go | 152 - .../anonymous/no_overlap/float64/types.go | 8 - .../anonymous/no_overlap/int32/json_test.go | 152 - .../anonymous/no_overlap/int32/types.go | 8 - .../no_overlap/json_marshal/json_test.go | 152 - .../no_overlap/json_marshal/types.go | 57 - .../no_overlap/map_string_string/json_test.go | 152 - .../no_overlap/map_string_string/types.go | 8 - .../no_overlap/ptr_float64/json_test.go | 152 - .../anonymous/no_overlap/ptr_float64/types.go | 8 - .../no_overlap/ptr_int32/json_test.go | 152 - .../anonymous/no_overlap/ptr_int32/types.go | 8 - .../ptr_map_string_string/json_test.go | 152 - .../no_overlap/ptr_map_string_string/types.go | 8 - .../no_overlap/ptr_slice_string/json_test.go | 152 - .../no_overlap/ptr_slice_string/types.go | 8 - .../no_overlap/ptr_string/json_test.go | 152 - .../anonymous/no_overlap/ptr_string/types.go | 8 - .../ptr_struct_various/json_test.go | 152 - .../no_overlap/ptr_struct_various/types.go | 17 - .../no_overlap/slice_string/json_test.go | 152 - .../no_overlap/slice_string/types.go | 8 - .../anonymous/no_overlap/string/json_test.go | 152 - .../anonymous/no_overlap/string/types.go | 8 - .../no_overlap/string_with_tag/json_test.go | 152 - .../no_overlap/string_with_tag/types.go | 8 - .../no_overlap/struct_various/json_test.go | 152 - .../no_overlap/struct_various/types.go | 17 - .../no_overlap/text_marshal/json_test.go | 152 - .../no_overlap/text_marshal/types.go | 57 - .../overlap/different_levels/json_test.go | 152 - .../overlap/different_levels/types.go | 17 - .../overlap/ignore_deeper_level/json_test.go | 152 - .../overlap/ignore_deeper_level/types.go | 23 - .../same_level_1_both_tagged/json_test.go | 152 - .../overlap/same_level_1_both_tagged/types.go | 16 - .../overlap/same_level_1_no_tags/json_test.go | 152 - .../overlap/same_level_1_no_tags/types.go | 16 - .../overlap/same_level_1_tagged/json_test.go | 152 - .../overlap/same_level_1_tagged/types.go | 16 - .../same_level_2_both_tagged/json_test.go | 152 - .../overlap/same_level_2_both_tagged/types.go | 26 - .../overlap/same_level_2_no_tags/json_test.go | 152 - .../overlap/same_level_2_no_tags/types.go | 26 - .../overlap/same_level_2_tagged/json_test.go | 152 - .../overlap/same_level_2_tagged/types.go | 26 - .../struct/array/ptr_string/json_test.go | 152 - .../struct/array/ptr_string/types.go | 5 - .../struct/array/string/json_test.go | 152 - .../output_tests/struct/array/string/types.go | 5 - .../struct/array/string_alias/json_test.go | 152 - .../struct/array/string_alias/types.go | 9 - .../struct/array/strings/json_test.go | 152 - .../struct/array/strings/types.go | 7 - .../struct/array/struct_strings/json_test.go | 152 - .../struct/array/struct_strings/types.go | 9 - .../go/output_tests/struct/empty/json_test.go | 152 - .../go/output_tests/struct/empty/types.go | 3 - .../struct/empty_alias/json_test.go | 152 - .../output_tests/struct/empty_alias/types.go | 5 - .../struct/everything/json_test.go | 152 - .../output_tests/struct/everything/types.go | 20 - .../output_tests/struct/float64/json_test.go | 152 - .../go/output_tests/struct/float64/types.go | 5 - .../struct/float64_alias/json_test.go | 152 - .../struct/float64_alias/types.go | 7 - .../output_tests/struct/float64s/json_test.go | 152 - .../go/output_tests/struct/float64s/types.go | 7 - .../struct/float64s_alias/json_test.go | 152 - .../struct/float64s_alias/types.go | 9 - .../go/output_tests/struct/int32/json_test.go | 152 - .../go/output_tests/struct/int32/types.go | 5 - .../struct/int32_alias/json_test.go | 152 - .../output_tests/struct/int32_alias/types.go | 7 - .../output_tests/struct/int32s/json_test.go | 152 - .../go/output_tests/struct/int32s/types.go | 7 - .../struct/int32s_alias/json_test.go | 152 - .../output_tests/struct/int32s_alias/types.go | 9 - .../go/output_tests/struct/int64/json_test.go | 152 - .../go/output_tests/struct/int64/types.go | 5 - .../struct/map/int32_ptr_string/json_test.go | 152 - .../struct/map/int32_ptr_string/types.go | 5 - .../struct/map/int32_string/json_test.go | 152 - .../struct/map/int32_string/types.go | 5 - .../map/int32_struct_strings/json_test.go | 152 - .../struct/map/int32_struct_strings/types.go | 9 - .../struct/map/string_ptr_string/json_test.go | 152 - .../struct/map/string_ptr_string/types.go | 5 - .../struct/map/string_string/json_test.go | 152 - .../struct/map/string_string/types.go | 5 - .../map/string_struct_strings/json_test.go | 152 - .../struct/map/string_struct_strings/types.go | 9 - .../struct/ptr_float64/json_test.go | 152 - .../output_tests/struct/ptr_float64/types.go | 5 - .../struct/ptr_float64_alias/json_test.go | 152 - .../struct/ptr_float64_alias/types.go | 10 - .../struct/ptr_int32/json_test.go | 152 - .../go/output_tests/struct/ptr_int32/types.go | 5 - .../struct/ptr_int32_alias/json_test.go | 152 - .../struct/ptr_int32_alias/types.go | 11 - .../struct/ptr_ptr_struct_empty/json_test.go | 152 - .../struct/ptr_ptr_struct_empty/types.go | 5 - .../ptr_ptr_struct_strings/json_test.go | 152 - .../struct/ptr_ptr_struct_strings/types.go | 9 - .../struct/ptr_string/json_test.go | 152 - .../output_tests/struct/ptr_string/types.go | 5 - .../struct/ptr_string_alias/json_test.go | 152 - .../struct/ptr_string_alias/types.go | 10 - .../struct/ptr_struct_empty/json_test.go | 152 - .../struct/ptr_struct_empty/types.go | 5 - .../struct/ptr_struct_strings/json_test.go | 152 - .../struct/ptr_struct_strings/types.go | 9 - .../struct/ptrs_float64/json_test.go | 152 - .../output_tests/struct/ptrs_float64/types.go | 7 - .../struct/ptrs_int32/json_test.go | 152 - .../output_tests/struct/ptrs_int32/types.go | 7 - .../struct/ptrs_string/json_test.go | 152 - .../output_tests/struct/ptrs_string/types.go | 7 - .../struct/slice/ptr_string/json_test.go | 152 - .../struct/slice/ptr_string/types.go | 5 - .../struct/slice/string/json_test.go | 152 - .../output_tests/struct/slice/string/types.go | 5 - .../struct/slice/string_alias/json_test.go | 152 - .../struct/slice/string_alias/types.go | 9 - .../struct/slice/strings/json_test.go | 152 - .../struct/slice/strings/types.go | 7 - .../struct/slice/struct_strings/json_test.go | 152 - .../struct/slice/struct_strings/types.go | 9 - .../output_tests/struct/string/json_test.go | 152 - .../go/output_tests/struct/string/types.go | 5 - .../struct/string_alias/json_test.go | 152 - .../output_tests/struct/string_alias/types.go | 7 - .../output_tests/struct/strings/json_test.go | 152 - .../go/output_tests/struct/strings/types.go | 7 - .../struct/strings_alias/json_test.go | 152 - .../struct/strings_alias/types.go | 9 - .../struct/struct/empties/json_test.go | 152 - .../struct/struct/empties/types.go | 7 - .../struct/struct/empty/json_test.go | 152 - .../output_tests/struct/struct/empty/types.go | 5 - .../struct/struct/empty_alias/json_test.go | 152 - .../struct/struct/empty_alias/types.go | 7 - .../struct/struct/float32s/json_test.go | 152 - .../struct/struct/float32s/types.go | 9 - .../struct/struct/float64/json_test.go | 152 - .../struct/struct/float64/types.go | 7 - .../struct/struct/float64_alias/json_test.go | 152 - .../struct/struct/float64_alias/types.go | 9 - .../struct/struct/int32s/json_test.go | 152 - .../struct/struct/int32s/types.go | 9 - .../struct/struct/strings/json_test.go | 152 - .../struct/struct/strings/types.go | 9 - .../struct/struct/strings_alias/json_test.go | 152 - .../struct/struct/strings_alias/types.go | 13 - .../fieldname/embedded/json_test.go | 152 - .../struct_tags/fieldname/embedded/types.go | 40 - .../struct_tags/fieldname/string/json_test.go | 152 - .../struct_tags/fieldname/string/types.go | 16 - .../struct_tags/fieldname/struct/json_test.go | 152 - .../struct_tags/fieldname/struct/types.go | 40 - .../struct_tags/omitempty/bool/json_test.go | 152 - .../struct_tags/omitempty/bool/types.go | 6 - .../omitempty/embedded/json_test.go | 152 - .../struct_tags/omitempty/embedded/types.go | 10 - .../omitempty/float32/json_test.go | 152 - .../struct_tags/omitempty/float32/types.go | 6 - .../struct_tags/omitempty/int32/json_test.go | 152 - .../struct_tags/omitempty/int32/types.go | 6 - .../omitempty/map_string_string/json_test.go | 152 - .../omitempty/map_string_string/types.go | 6 - .../omitempty/ptr_bool/json_test.go | 152 - .../struct_tags/omitempty/ptr_bool/types.go | 6 - .../omitempty/ptr_float32/json_test.go | 152 - .../omitempty/ptr_float32/types.go | 6 - .../omitempty/ptr_int32/json_test.go | 152 - .../struct_tags/omitempty/ptr_int32/types.go | 6 - .../ptr_map_string_string/json_test.go | 152 - .../omitempty/ptr_map_string_string/types.go | 6 - .../omitempty/ptr_slice_string/json_test.go | 152 - .../omitempty/ptr_slice_string/types.go | 6 - .../omitempty/ptr_string/json_test.go | 152 - .../omitempty/ptr_string/string/json_test.go | 152 - .../omitempty/ptr_string/string/types.go | 6 - .../struct_tags/omitempty/ptr_string/types.go | 6 - .../ptr_string_json_marshal/json_test.go | 152 - .../ptr_string_json_marshal/types.go | 15 - .../ptr_string_text_marshal/json_test.go | 152 - .../ptr_string_text_marshal/types.go | 15 - .../ptr_struct_json_marshal/json_test.go | 152 - .../ptr_struct_json_marshal/types.go | 15 - .../ptr_struct_text_marshal/json_test.go | 152 - .../ptr_struct_text_marshal/types.go | 15 - .../omitempty/ptr_uint32/json_test.go | 152 - .../struct_tags/omitempty/ptr_uint32/types.go | 6 - .../omitempty/slice_string/json_test.go | 152 - .../omitempty/slice_string/types.go | 6 - .../struct_tags/omitempty/string/json_test.go | 152 - .../struct_tags/omitempty/string/types.go | 6 - .../string_json_marshal/json_test.go | 152 - .../omitempty/string_json_marshal/types.go | 15 - .../string_text_marshal/json_test.go | 152 - .../omitempty/string_text_marshal/types.go | 15 - .../struct_tags/omitempty/struct/json_test.go | 152 - .../struct_tags/omitempty/struct/types.go | 5 - .../struct_json_marshal/json_test.go | 152 - .../omitempty/struct_json_marshal/types.go | 15 - .../struct_text_marshal/json_test.go | 152 - .../omitempty/struct_text_marshal/types.go | 15 - .../struct_tags/omitempty/uint32/json_test.go | 152 - .../struct_tags/omitempty/uint32/types.go | 6 - .../struct_tags/string/bool/json_test.go | 152 - .../struct_tags/string/bool/types.go | 6 - .../struct_tags/string/byte/json_test.go | 152 - .../struct_tags/string/byte/types.go | 6 - .../struct_tags/string/float32/json_test.go | 152 - .../struct_tags/string/float32/types.go | 6 - .../struct_tags/string/float64/json_test.go | 152 - .../struct_tags/string/float64/types.go | 6 - .../struct_tags/string/int16/json_test.go | 152 - .../struct_tags/string/int16/types.go | 6 - .../struct_tags/string/int32/json_test.go | 152 - .../struct_tags/string/int32/types.go | 6 - .../struct_tags/string/int8/json_test.go | 152 - .../struct_tags/string/int8/types.go | 6 - .../struct_tags/string/string/json_test.go | 152 - .../struct_tags/string/string/types.go | 6 - .../struct_tags/string/uint16/json_test.go | 152 - .../struct_tags/string/uint16/types.go | 6 - .../struct_tags/string/uint32/json_test.go | 152 - .../struct_tags/string/uint32/types.go | 6 - .../struct_tags/string/uint8/json_test.go | 152 - .../struct_tags/string/uint8/types.go | 6 - .../text_marshal/string_alias/json_test.go | 152 - .../text_marshal/string_alias/types.go | 50 - .../text_marshal/struct/json_test.go | 152 - .../output_tests/text_marshal/struct/types.go | 52 - .../text_marshal/struct_alias/json_test.go | 152 - .../text_marshal/struct_alias/types.go | 54 - .../text_marshal/struct_field/json_test.go | 152 - .../text_marshal/struct_field/types.go | 56 - .../struct_field_alias/json_test.go | 152 - .../text_marshal/struct_field_alias/types.go | 58 - .../go/{feature_pool.go => pool.go} | 34 +- vendor/github.com/json-iterator/go/reflect.go | 321 ++ .../json-iterator/go/reflect_array.go | 104 + .../json-iterator/go/reflect_dynamic.go | 70 + ...lect_extension.go => reflect_extension.go} | 255 +- .../json-iterator/go/reflect_json_number.go | 112 + .../go/reflect_json_raw_message.go | 60 + .../json-iterator/go/reflect_map.go | 296 ++ .../json-iterator/go/reflect_marshaler.go | 218 ++ .../json-iterator/go/reflect_native.go | 455 +++ ...eflect_optional.go => reflect_optional.go} | 85 +- .../json-iterator/go/reflect_slice.go | 99 + ...t_decoder.go => reflect_struct_decoder.go} | 400 +-- ...ct_object.go => reflect_struct_encoder.go} | 151 +- .../go/skip_tests/array/inputs.go | 12 - .../go/skip_tests/array/skip_test.go | 34 - .../json-iterator/go/skip_tests/array_test.go | 15 + .../go/skip_tests/float64_test.go | 20 + .../go/{ => skip_tests}/jsoniter_skip_test.go | 27 +- .../go/skip_tests/number/inputs.go | 17 - .../go/skip_tests/number/skip_test.go | 34 - .../go/skip_tests/object/inputs.go | 16 - .../go/skip_tests/object/skip_test.go | 34 - .../json-iterator/go/skip_tests/skip_test.go | 45 + .../go/skip_tests/string/inputs.go | 14 - .../go/skip_tests/string/skip_test.go | 34 - .../go/skip_tests/string_test.go | 17 + .../go/skip_tests/struct_test.go | 19 + .../go/{feature_stream.go => stream.go} | 155 +- ...eature_stream_float.go => stream_float.go} | 14 +- .../github.com/json-iterator/go/stream_int.go | 190 ++ ...feature_stream_string.go => stream_str.go} | 40 +- ...jsoniter_stream_test.go => stream_test.go} | 6 +- vendor/github.com/json-iterator/go/test.sh | 2 +- .../json-iterator/go/type_tests/array_test.go | 63 + .../go/type_tests/builtin_test.go | 69 + .../go/type_tests/map_key_test.go | 43 + .../json-iterator/go/type_tests/map_test.go | 60 + .../go/type_tests/marshaler_string_test.go | 52 + .../go/type_tests/marshaler_struct_test.go | 69 + .../json-iterator/go/type_tests/slice_test.go | 125 + .../go/type_tests/struct_embedded_test.go | 233 ++ .../go/type_tests/struct_field_case_test.go | 30 + .../go/type_tests/struct_tags_test.go | 282 ++ .../go/type_tests/struct_test.go | 404 +++ .../type_tests/text_marshaler_string_test.go | 57 + .../type_tests/text_marshaler_struct_test.go | 69 + .../json-iterator/go/type_tests/type_test.go | 162 ++ .../json-iterator/go/unmarshal_input_test.go | 72 - .../go/value_tests/array_test.go | 20 + .../json-iterator/go/value_tests/bool_test.go | 10 + .../go/value_tests/eface_test.go | 78 + .../float_test.go} | 122 +- .../go/value_tests/iface_test.go | 45 + .../int_test.go} | 304 +- .../invalid_test.go} | 74 +- .../json-iterator/go/value_tests/map_test.go | 51 + .../go/value_tests/marshaler_test.go | 84 + .../go/value_tests/number_test.go | 17 + .../json-iterator/go/value_tests/ptr_test.go | 39 + .../go/value_tests/raw_message_test.go | 13 + .../go/value_tests/slice_test.go | 25 + .../go/value_tests/string_test.go | 88 + .../go/value_tests/struct_test.go | 200 ++ .../go/value_tests/value_test.go | 80 + .../kubernetes-csi/csi-test/Gopkg.lock | 27 +- .../kubernetes-csi/csi-test/Gopkg.toml | 2 +- .../kubernetes-csi/csi-test/hack/e2e.sh | 14 +- .../kubernetes-csi/csi-test/mock/.gitignore | 1 + .../kubernetes-csi/csi-test/mock/AUTHORS | 1 + .../kubernetes-csi/csi-test/mock/Makefile | 17 + .../kubernetes-csi/csi-test/mock/README.md | 46 + .../csi-test/mock/context/context.go | 128 + .../csi-test/mock/gocsi/envvars.go | 325 +++ .../csi-test/mock/gocsi/gocsi.go | 545 ++++ .../csi-test/mock/gocsi/usage.go | 269 ++ .../kubernetes-csi/csi-test/mock/main.go | 19 + .../kubernetes-csi/csi-test/mock/plugin.go | 23 + .../csi-test/mock/provider/provider.go | 53 + .../csi-test/mock/service/controller.go | 287 ++ .../csi-test/mock/service/identity.go | 45 + .../csi-test/mock/service/node.go | 128 + .../csi-test/mock/service/service.go | 98 + .../csi-test/mock/utils/utils.go | 586 ++++ .../csi-test/mock/utils/utils_middleware.go | 143 + .../csi-test/mock/utils/utils_rpcs.go | 89 + .../csi-test/mock/utils/utils_suite_test.go | 118 + .../csi-test/mock/utils/utils_test.go | 415 +++ .../csi-test/pkg/sanity/controller.go | 20 +- .../csi-test/pkg/sanity/node.go | 4 +- .../modern-go/concurrent/.gitignore | 1 + .../modern-go/concurrent/.travis.yml | 14 + .../github.com/modern-go/concurrent/LICENSE | 201 ++ .../github.com/modern-go/concurrent/README.md | 11 + .../modern-go/concurrent/executor.go | 14 + .../modern-go/concurrent/go_above_19.go | 15 + .../modern-go/concurrent/go_below_19.go | 33 + vendor/github.com/modern-go/concurrent/log.go | 13 + .../modern-go/concurrent/map_test.go | 18 + .../github.com/modern-go/concurrent/test.sh | 12 + .../concurrent/unbounded_executor.go | 120 + .../concurrent/unbounded_executor_test.go | 54 + .../github.com/modern-go/reflect2/.gitignore | 1 + .../github.com/modern-go/reflect2/Gopkg.lock | 15 + .../github.com/modern-go/reflect2/Gopkg.toml | 35 + vendor/github.com/modern-go/reflect2/LICENSE | 201 ++ .../github.com/modern-go/reflect2/README.md | 2 + .../modern-go/reflect2/go_above_17.go | 8 + .../modern-go/reflect2/go_above_19.go | 14 + .../modern-go/reflect2/go_below_17.go | 9 + .../modern-go/reflect2/go_below_19.go | 14 + .../github.com/modern-go/reflect2/reflect2.go | 282 ++ .../modern-go/reflect2/reflect2_amd64.s} | 0 .../modern-go/reflect2/reflect2_kind.go | 30 + .../modern-go/reflect2/relfect2_386.s | 0 .../modern-go/reflect2/relfect2_amd64p32.s | 0 .../modern-go/reflect2/relfect2_arm.s | 0 .../modern-go/reflect2/relfect2_arm64.s | 0 .../modern-go/reflect2/relfect2_mips64x.s | 0 .../modern-go/reflect2/relfect2_mipsx.s | 0 .../modern-go/reflect2/relfect2_ppc64x.s | 0 .../modern-go/reflect2/relfect2_s390x.s | 0 .../modern-go/reflect2/safe_field.go | 58 + .../github.com/modern-go/reflect2/safe_map.go | 101 + .../modern-go/reflect2/safe_slice.go | 92 + .../modern-go/reflect2/safe_struct.go | 13 + .../modern-go/reflect2/safe_type.go | 78 + .../modern-go/reflect2/test15/map_test.go | 18 + .../modern-go/reflect2/tests/array_test.go | 38 + .../modern-go/reflect2/tests/int_test.go | 41 + .../reflect2/tests/map_elem_array_test.go | 44 + .../reflect2/tests/map_elem_bytes_test.go | 34 + .../reflect2/tests/map_elem_eface_test.go | 51 + .../reflect2/tests/map_elem_map_test.go | 23 + .../reflect2/tests/map_elem_struct_test.go | 57 + .../reflect2/tests/map_key_eface_test.go | 43 + .../reflect2/tests/map_key_iface_test.go | 47 + .../reflect2/tests/map_key_ptr_test.go | 51 + .../modern-go/reflect2/tests/map_test.go | 121 + .../modern-go/reflect2/tests/op_test.go | 18 + .../reflect2/tests/slice_array_test.go | 37 + .../reflect2/tests/slice_bytes_test.go | 16 + .../reflect2/tests/slice_eface_test.go | 78 + .../reflect2/tests/slice_iface_test.go | 81 + .../reflect2/tests/slice_map_test.go | 43 + .../reflect2/tests/slice_ptr_test.go | 58 + .../reflect2/tests/slice_string_test.go | 16 + .../reflect2/tests/slice_struct_test.go | 53 + .../modern-go/reflect2/tests/slice_test.go | 115 + .../reflect2/tests/struct_eface_test.go | 28 + .../reflect2/tests/struct_ptr_test.go | 25 + .../modern-go/reflect2/tests/struct_test.go | 64 + .../github.com/modern-go/reflect2/type_map.go | 72 + .../modern-go/reflect2/unsafe_array.go | 65 + .../modern-go/reflect2/unsafe_eface.go | 59 + .../modern-go/reflect2/unsafe_field.go | 74 + .../modern-go/reflect2/unsafe_iface.go | 64 + .../modern-go/reflect2/unsafe_link.go | 70 + .../modern-go/reflect2/unsafe_map.go | 138 + .../modern-go/reflect2/unsafe_ptr.go | 46 + .../modern-go/reflect2/unsafe_slice.go | 177 ++ .../modern-go/reflect2/unsafe_struct.go | 59 + .../modern-go/reflect2/unsafe_type.go | 85 + vendor/golang.org/x/crypto/acme/acme.go | 9 +- vendor/golang.org/x/crypto/acme/acme_test.go | 28 + .../x/crypto/acme/autocert/autocert.go | 11 - vendor/golang.org/x/crypto/openpgp/keys.go | 7 +- .../golang.org/x/crypto/openpgp/keys_test.go | 50 + .../x/crypto/ssh/client_auth_test.go | 4 +- vendor/golang.org/x/crypto/ssh/keys.go | 3 +- vendor/golang.org/x/crypto/ssh/server.go | 21 +- vendor/golang.org/x/net/bpf/instructions.go | 32 +- .../x/net/dns/dnsmessage/message.go | 177 +- .../x/net/dns/dnsmessage/message_test.go | 265 +- vendor/golang.org/x/net/html/const.go | 2 +- vendor/golang.org/x/net/html/foreign.go | 6 +- vendor/golang.org/x/net/html/node.go | 7 +- vendor/golang.org/x/net/html/parse.go | 76 +- vendor/golang.org/x/net/http2/hpack/encode.go | 2 +- vendor/golang.org/x/net/http2/http2.go | 2 +- vendor/golang.org/x/net/http2/server.go | 8 +- vendor/golang.org/x/net/http2/server_test.go | 14 +- .../golang.org/x/net/http2/transport_test.go | 2 +- vendor/golang.org/x/sys/unix/linux/Dockerfile | 21 +- vendor/golang.org/x/sys/unix/linux/types.go | 208 +- vendor/golang.org/x/sys/unix/mkerrors.sh | 1 + .../x/sys/unix/syscall_linux_arm64.go | 7 +- .../x/sys/unix/syscall_linux_mips64x.go | 7 +- .../x/sys/unix/zerrors_linux_386.go | 34 +- .../x/sys/unix/zerrors_linux_amd64.go | 34 +- .../x/sys/unix/zerrors_linux_arm.go | 37 +- .../x/sys/unix/zerrors_linux_arm64.go | 34 +- .../x/sys/unix/zerrors_linux_mips.go | 34 +- .../x/sys/unix/zerrors_linux_mips64.go | 34 +- .../x/sys/unix/zerrors_linux_mips64le.go | 34 +- .../x/sys/unix/zerrors_linux_mipsle.go | 34 +- .../x/sys/unix/zerrors_linux_ppc64.go | 34 +- .../x/sys/unix/zerrors_linux_ppc64le.go | 34 +- .../x/sys/unix/zerrors_linux_s390x.go | 34 +- .../x/sys/unix/zsysnum_linux_s390x.go | 1 + .../golang.org/x/sys/unix/ztypes_linux_386.go | 208 +- .../x/sys/unix/ztypes_linux_amd64.go | 208 +- .../golang.org/x/sys/unix/ztypes_linux_arm.go | 208 +- .../x/sys/unix/ztypes_linux_arm64.go | 208 +- .../x/sys/unix/ztypes_linux_mips.go | 208 +- .../x/sys/unix/ztypes_linux_mips64.go | 208 +- .../x/sys/unix/ztypes_linux_mips64le.go | 208 +- .../x/sys/unix/ztypes_linux_mipsle.go | 208 +- .../x/sys/unix/ztypes_linux_ppc64.go | 208 +- .../x/sys/unix/ztypes_linux_ppc64le.go | 208 +- .../x/sys/unix/ztypes_linux_s390x.go | 208 +- .../golang.org/x/sys/windows/registry/key.go | 10 +- .../x/sys/windows/registry/registry_test.go | 2 +- vendor/golang.org/x/text/cmd/gotext/common.go | 3 - .../cmd/gotext/examples/extract/catalog.go | 60 +- .../extract/locales/de/messages.gotext.json | 34 +- .../extract/locales/de/out.gotext.json | 113 +- .../locales/en-US/messages.gotext.json | 32 +- .../extract/locales/en-US/out.gotext.json | 134 +- .../extract/locales}/extracted.gotext.json | 68 +- .../extract/locales/zh/messages.gotext.json | 20 +- .../extract/locales/zh/out.gotext.json | 107 +- .../text/cmd/gotext/examples/extract/main.go | 3 +- .../examples/extract_http/catalog_gen.go | 57 - .../extract_http/locales/de/out.gotext.json | 8 +- .../locales/en-US/out.gotext.json | 8 +- .../out.gotext.json => extracted.gotext.json} | 22 +- .../extract_http/locales/zh/out.gotext.json | 16 +- .../cmd/gotext/examples/extract_http/main.go | 2 +- .../golang.org/x/text/cmd/gotext/extract.go | 59 +- .../golang.org/x/text/cmd/gotext/generate.go | 87 +- vendor/golang.org/x/text/cmd/gotext/main.go | 29 +- .../golang.org/x/text/cmd/gotext/rewrite.go | 2 +- vendor/golang.org/x/text/cmd/gotext/update.go | 52 - .../x/text/currency/example_test.go | 4 +- vendor/golang.org/x/text/doc.go | 3 - .../x/text/internal/catmsg/catmsg.go | 43 +- .../x/text/internal/catmsg/catmsg_test.go | 13 +- .../x/text/message/pipeline/extract.go | 25 +- .../x/text/message/pipeline/generate.go | 97 +- .../x/text/message/pipeline/go19_test.go | 13 - .../x/text/message/pipeline/message.go | 46 +- .../x/text/message/pipeline/pipeline.go | 371 +-- .../x/text/message/pipeline/pipeline_test.go | 126 - .../x/text/message/pipeline/rewrite.go | 4 +- .../pipeline/testdata/test1/catalog_gen.go | 85 - .../testdata/test1/catalog_gen.go.want | 85 - .../pipeline/testdata/test1/catalog_test.go | 49 - .../testdata/test1/extracted.gotext.json.want | 188 -- .../test1/locales/de/messages.gotext.json | 123 - .../testdata/test1/locales/de/out.gotext.json | 137 - .../test1/locales/de/out.gotext.json.want | 137 - .../test1/locales/en-US/messages.gotext.json | 91 - .../test1/locales/en-US/out.gotext.json | 154 - .../test1/locales/en-US/out.gotext.json.want | 154 - .../test1/locales/zh/messages.gotext.json | 135 - .../testdata/test1/locales/zh/out.gotext.json | 137 - .../test1/locales/zh/out.gotext.json.want | 137 - .../message/pipeline/testdata/test1/test1.go | 75 - .../admin/v2/bigtable_instance_admin.pb.go | 214 +- .../cloud/dialogflow/v2beta1/agent.pb.go | 33 +- .../cloud/dialogflow/v2beta1/context.pb.go | 57 +- .../dialogflow/v2beta1/entity_type.pb.go | 42 +- .../cloud/dialogflow/v2beta1/intent.pb.go | 33 +- .../cloud/dialogflow/v2beta1/session.pb.go | 13 +- .../v2beta1/session_entity_type.pb.go | 49 +- .../cloud/ml/v1beta1/job_service.pb.go | 1823 ------------ .../cloud/ml/v1beta1/model_service.pb.go | 1050 ------- .../cloud/ml/v1beta1/operation_metadata.pb.go | 161 - .../cloud/ml/v1beta1/prediction_service.pb.go | 343 --- .../cloud/ml/v1beta1/project_service.pb.go | 178 -- .../cloud/speech/v1p1beta1/cloud_speech.pb.go | 645 +--- .../devtools/cloudbuild/v1/cloudbuild.pb.go | 395 +-- .../googleapis/privacy/dlp/v2beta2/dlp.pb.go | 2590 +++++++++++++---- .../privacy/dlp/v2beta2/storage.pb.go | 681 ++++- .../genproto/googleapis/spanner/v1/keys.pb.go | 5 + .../googleapis/spanner/v1/mutation.pb.go | 2 + .../googleapis/spanner/v1/spanner.pb.go | 598 +++- .../googleapis/tracing/v1/trace.pb.go | 888 ------ .../protobuf/field_mask/field_mask.pb.go | 6 - .../grpc/Documentation/encoding.md | 146 + .../grpc/Documentation/grpc-metadata.md | 33 +- .../benchmark/primitives/primitives_test.go | 113 +- .../grpc/benchmark/worker/benchmark_client.go | 2 +- vendor/google.golang.org/grpc/call.go | 306 +- vendor/google.golang.org/grpc/clientconn.go | 47 +- .../google.golang.org/grpc/clientconn_test.go | 35 + vendor/google.golang.org/grpc/codec.go | 98 +- vendor/google.golang.org/grpc/codec_test.go | 106 +- vendor/google.golang.org/grpc/codes/codes.go | 23 +- .../grpc/credentials/credentials.go | 5 +- .../grpc/encoding/encoding.go | 99 +- .../grpc/encoding/gzip/gzip.go | 5 +- .../grpc/encoding/proto/proto.go | 110 + .../proto/proto_benchmark_test.go} | 17 +- .../grpc/encoding/proto/proto_test.go | 129 + .../examples/route_guide/client/client.go | 12 +- vendor/google.golang.org/grpc/go16.go | 5 +- vendor/google.golang.org/grpc/go17.go | 5 +- .../grpc/interop/test_utils.go | 6 +- .../grpc/metadata/metadata.go | 55 +- .../grpc/metadata/metadata_test.go | 54 + .../grpc/resolver/resolver.go | 3 - .../grpc/resolver_conn_wrapper.go | 4 +- .../google.golang.org/grpc/resolver_test.go | 99 - vendor/google.golang.org/grpc/rpc_util.go | 98 +- .../google.golang.org/grpc/rpc_util_test.go | 9 +- vendor/google.golang.org/grpc/server.go | 33 +- .../grpc/stats/stats_test.go | 35 +- .../google.golang.org/grpc/status/status.go | 12 +- .../grpc/status/status_test.go | 27 + vendor/google.golang.org/grpc/stream.go | 284 +- .../grpc/test/end2end_test.go | 268 +- .../grpc/transport/handler_server.go | 67 +- .../grpc/transport/handler_server_test.go | 13 +- .../grpc/transport/http2_client.go | 52 +- .../grpc/transport/http2_server.go | 29 +- .../grpc/transport/http_util.go | 67 +- .../grpc/transport/http_util_test.go | 29 +- .../grpc/transport/transport.go | 31 +- vendor/gopkg.in/yaml.v2/.travis.yml | 3 + vendor/gopkg.in/yaml.v2/NOTICE | 13 + vendor/gopkg.in/yaml.v2/apic.go | 53 +- vendor/gopkg.in/yaml.v2/decode.go | 225 +- vendor/gopkg.in/yaml.v2/decode_test.go | 316 +- vendor/gopkg.in/yaml.v2/emitterc.go | 3 +- vendor/gopkg.in/yaml.v2/encode.go | 130 +- vendor/gopkg.in/yaml.v2/encode_test.go | 86 +- vendor/gopkg.in/yaml.v2/go.mod | 5 + vendor/gopkg.in/yaml.v2/resolve.go | 59 +- vendor/gopkg.in/yaml.v2/scannerc.go | 11 +- vendor/gopkg.in/yaml.v2/writerc.go | 65 +- vendor/gopkg.in/yaml.v2/yaml.go | 119 +- vendor/gopkg.in/yaml.v2/yamlh.go | 30 +- vendor/k8s.io/api/Godeps/Godeps.json | 316 +- vendor/k8s.io/apimachinery/Godeps/Godeps.json | 352 +-- vendor/k8s.io/apimachinery/Godeps/OWNERS | 2 + .../k8s.io/apimachinery/pkg/api/errors/BUILD | 1 - .../k8s.io/apimachinery/pkg/api/errors/OWNERS | 1 - vendor/k8s.io/apimachinery/pkg/api/meta/BUILD | 6 +- .../pkg/api/meta/restmapper_test.go | 2 +- .../apimachinery/pkg/api/meta/table/BUILD | 29 + .../apimachinery/pkg/api/meta/table/table.go | 71 + .../apimachinery/pkg/api/resource/BUILD | 2 - .../apimachinery/pkg/api/resource/OWNERS | 1 - .../pkg/api/resource/scale_int_test.go | 2 +- .../pkg/api/resource/zz_generated.deepcopy.go | 2 +- .../apimachinery/pkg/api/testing/fuzzer/BUILD | 1 - .../apimachinery/pkg/api/validation/BUILD | 1 - .../pkg/api/validation/path/BUILD | 1 - .../apimachinery/pkg/apimachinery/BUILD | 1 - .../pkg/apimachinery/announced/BUILD | 1 - .../pkg/apimachinery/announced/announced.go | 2 +- .../pkg/apimachinery/registered/BUILD | 1 - .../pkg/apis/meta/fuzzer/fuzzer.go | 2 +- .../pkg/apis/meta/internalversion/BUILD | 1 - .../zz_generated.conversion.go | 2 +- .../internalversion/zz_generated.deepcopy.go | 8 +- .../apimachinery/pkg/apis/meta/v1/BUILD | 2 - .../apimachinery/pkg/apis/meta/v1/OWNERS | 1 - .../pkg/apis/meta/v1/unstructured/BUILD | 1 - .../v1/unstructured/zz_generated.deepcopy.go | 8 +- .../pkg/apis/meta/v1/validation/BUILD | 1 - .../pkg/apis/meta/v1/zz_generated.deepcopy.go | 58 +- .../pkg/apis/meta/v1/zz_generated.defaults.go | 2 +- .../meta/v1beta1/zz_generated.deepcopy.go | 14 +- .../meta/v1beta1/zz_generated.defaults.go | 2 +- .../pkg/apis/testapigroup/install/BUILD | 1 - .../v1/zz_generated.conversion.go | 2 +- .../testapigroup/v1/zz_generated.deepcopy.go | 12 +- .../testapigroup/v1/zz_generated.defaults.go | 2 +- .../testapigroup/zz_generated.deepcopy.go | 12 +- .../k8s.io/apimachinery/pkg/conversion/BUILD | 1 - .../pkg/conversion/converter_test.go | 8 +- .../pkg/conversion/queryparams/BUILD | 1 - vendor/k8s.io/apimachinery/pkg/fields/BUILD | 1 - .../apimachinery/pkg/fields/selector.go | 2 +- vendor/k8s.io/apimachinery/pkg/labels/BUILD | 1 - .../pkg/labels/zz_generated.deepcopy.go | 2 +- vendor/k8s.io/apimachinery/pkg/runtime/BUILD | 2 - .../k8s.io/apimachinery/pkg/runtime/codec.go | 2 +- .../apimachinery/pkg/runtime/schema/BUILD | 1 - .../pkg/runtime/schema/group_version.go | 24 + .../k8s.io/apimachinery/pkg/runtime/scheme.go | 1 + .../apimachinery/pkg/runtime/scheme_test.go | 334 ++- .../apimachinery/pkg/runtime/serializer/BUILD | 1 - .../pkg/runtime/serializer/json/BUILD | 2 - .../serializer/recognizer/testing/BUILD | 1 - .../pkg/runtime/serializer/streaming/BUILD | 1 - .../testing/zz_generated.deepcopy.go | 17 +- .../pkg/runtime/serializer/versioning/BUILD | 1 - .../apimachinery/pkg/runtime/testing/types.go | 3 + .../runtime/testing/zz_generated.deepcopy.go | 65 +- .../pkg/runtime/zz_generated.deepcopy.go | 8 +- vendor/k8s.io/apimachinery/pkg/test/BUILD | 1 - .../pkg/test/zz_generated.deepcopy.go | 8 +- .../k8s.io/apimachinery/pkg/util/cache/BUILD | 1 - .../k8s.io/apimachinery/pkg/util/clock/BUILD | 1 - .../k8s.io/apimachinery/pkg/util/diff/BUILD | 1 - .../apimachinery/pkg/util/duration/BUILD | 22 + .../pkg/util/duration/duration.go | 43 + .../k8s.io/apimachinery/pkg/util/errors/BUILD | 1 - .../apimachinery/pkg/util/errors/errors.go | 2 +- .../k8s.io/apimachinery/pkg/util/framer/BUILD | 1 - .../apimachinery/pkg/util/httpstream/BUILD | 1 - .../pkg/util/httpstream/spdy/BUILD | 1 - .../k8s.io/apimachinery/pkg/util/intstr/BUILD | 1 - .../k8s.io/apimachinery/pkg/util/json/BUILD | 1 - .../pkg/util/jsonmergepatch/BUILD | 1 - .../apimachinery/pkg/util/mergepatch/BUILD | 1 - vendor/k8s.io/apimachinery/pkg/util/net/BUILD | 1 - .../pkg/util/net/interface_test.go | 6 +- .../k8s.io/apimachinery/pkg/util/proxy/BUILD | 1 - .../k8s.io/apimachinery/pkg/util/rand/BUILD | 1 - .../apimachinery/pkg/util/rand/rand_test.go | 2 +- .../apimachinery/pkg/util/runtime/BUILD | 1 - .../apimachinery/pkg/util/runtime/runtime.go | 2 +- .../k8s.io/apimachinery/pkg/util/sets/BUILD | 1 - .../pkg/util/strategicpatch/BUILD | 1 - .../pkg/util/strategicpatch/patch.go | 4 +- .../apimachinery/pkg/util/validation/BUILD | 1 - .../pkg/util/validation/field/BUILD | 1 - .../pkg/util/validation/field/errors_test.go | 2 +- .../k8s.io/apimachinery/pkg/util/wait/BUILD | 1 - .../apimachinery/pkg/util/waitgroup/BUILD | 1 - .../pkg/util/waitgroup/waitgroup.go | 2 +- .../k8s.io/apimachinery/pkg/util/yaml/BUILD | 1 - vendor/k8s.io/apimachinery/pkg/watch/BUILD | 2 - .../pkg/watch/zz_generated.deepcopy.go | 2 +- .../third_party/forked/golang/json/BUILD | 1 - .../third_party/forked/golang/reflect/BUILD | 1 - vendor/k8s.io/kube-openapi/Godeps/Godeps.json | 5 + .../kube-openapi/pkg/handler/handler.go | 56 +- .../kube-openapi/pkg/handler/handler_test.go | 89 + 1088 files changed, 24201 insertions(+), 63682 deletions(-) rename vendor/github.com/json-iterator/go/{feature_adapter.go => adapter.go} (81%) rename vendor/github.com/json-iterator/go/{feature_any.go => any.go} (75%) rename vendor/github.com/json-iterator/go/{feature_any_array.go => any_array.go} (100%) rename vendor/github.com/json-iterator/go/{feature_any_bool.go => any_bool.go} (100%) rename vendor/github.com/json-iterator/go/{feature_any_float.go => any_float.go} (100%) rename vendor/github.com/json-iterator/go/{feature_any_int32.go => any_int32.go} (100%) rename vendor/github.com/json-iterator/go/{feature_any_int64.go => any_int64.go} (100%) rename vendor/github.com/json-iterator/go/{feature_any_invalid.go => any_invalid.go} (100%) rename vendor/github.com/json-iterator/go/{feature_any_nil.go => any_nil.go} (100%) rename vendor/github.com/json-iterator/go/{feature_any_number.go => any_number.go} (100%) rename vendor/github.com/json-iterator/go/{feature_any_object.go => any_object.go} (100%) rename vendor/github.com/json-iterator/go/{feature_any_string.go => any_str.go} (97%) rename vendor/github.com/json-iterator/go/{ => any_tests}/jsoniter_any_array_test.go (74%) rename vendor/github.com/json-iterator/go/{ => any_tests}/jsoniter_any_bool_test.go (70%) rename vendor/github.com/json-iterator/go/{ => any_tests}/jsoniter_any_float_test.go (88%) rename vendor/github.com/json-iterator/go/{ => any_tests}/jsoniter_any_int_test.go (81%) create mode 100644 vendor/github.com/json-iterator/go/any_tests/jsoniter_any_map_test.go rename vendor/github.com/json-iterator/go/{ => any_tests}/jsoniter_any_null_test.go (75%) rename vendor/github.com/json-iterator/go/{ => any_tests}/jsoniter_any_object_test.go (66%) rename vendor/github.com/json-iterator/go/{ => any_tests}/jsoniter_any_string_test.go (79%) rename vendor/github.com/json-iterator/go/{ => any_tests}/jsoniter_must_be_valid_test.go (63%) rename vendor/github.com/json-iterator/go/{ => any_tests}/jsoniter_wrap_test.go (55%) rename vendor/github.com/json-iterator/go/{feature_any_uint32.go => any_uint32.go} (100%) rename vendor/github.com/json-iterator/go/{feature_any_uint64.go => any_uint64.go} (100%) create mode 100644 vendor/github.com/json-iterator/go/api_tests/config_test.go create mode 100644 vendor/github.com/json-iterator/go/api_tests/decoder_test.go rename vendor/github.com/json-iterator/go/{jsoniter_1dot8_only_test.go => api_tests/encoder_18_test.go} (86%) create mode 100644 vendor/github.com/json-iterator/go/api_tests/encoder_test.go create mode 100644 vendor/github.com/json-iterator/go/api_tests/marshal_indent_test.go create mode 100644 vendor/github.com/json-iterator/go/benchmarks/encode_string_test.go rename vendor/github.com/json-iterator/go/{ => benchmarks}/jsoniter_large_file_test.go (95%) delete mode 100644 vendor/github.com/json-iterator/go/compatible_test.go rename vendor/github.com/json-iterator/go/{feature_config.go => config.go} (61%) create mode 100644 vendor/github.com/json-iterator/go/extension_tests/decoder_test.go create mode 100644 vendor/github.com/json-iterator/go/extension_tests/extension_test.go create mode 100644 vendor/github.com/json-iterator/go/extra/binary_as_string_codec.go create mode 100644 vendor/github.com/json-iterator/go/extra/binary_as_string_codec_test.go delete mode 100644 vendor/github.com/json-iterator/go/feature_config_with_sync_map.go delete mode 100644 vendor/github.com/json-iterator/go/feature_config_without_sync_map.go delete mode 100644 vendor/github.com/json-iterator/go/feature_json_number.go delete mode 100644 vendor/github.com/json-iterator/go/feature_reflect.go delete mode 100644 vendor/github.com/json-iterator/go/feature_reflect_array.go delete mode 100644 vendor/github.com/json-iterator/go/feature_reflect_map.go delete mode 100644 vendor/github.com/json-iterator/go/feature_reflect_native.go delete mode 100644 vendor/github.com/json-iterator/go/feature_reflect_slice.go delete mode 100644 vendor/github.com/json-iterator/go/feature_stream_int.go rename vendor/github.com/json-iterator/go/{feature_iter.go => iter.go} (100%) rename vendor/github.com/json-iterator/go/{feature_iter_array.go => iter_array.go} (100%) rename vendor/github.com/json-iterator/go/{feature_iter_float.go => iter_float.go} (100%) rename vendor/github.com/json-iterator/go/{feature_iter_int.go => iter_int.go} (98%) rename vendor/github.com/json-iterator/go/{feature_iter_object.go => iter_object.go} (68%) rename vendor/github.com/json-iterator/go/{feature_iter_skip.go => iter_skip.go} (100%) rename vendor/github.com/json-iterator/go/{feature_iter_skip_sloppy.go => iter_skip_sloppy.go} (100%) rename vendor/github.com/json-iterator/go/{jsoniter_sloppy_test.go => iter_skip_sloppy_test.go} (99%) rename vendor/github.com/json-iterator/go/{feature_iter_skip_strict.go => iter_skip_strict.go} (100%) rename vendor/github.com/json-iterator/go/{feature_iter_string.go => iter_str.go} (100%) delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_adapter_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_alias_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_any_map_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_bool_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_customize_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_demo_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_encode_interface_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_enum_marshaler_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_fixed_array_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_interface_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_io_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_map_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_null_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_object_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_optional_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_raw_message_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_reader_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_reflect_native_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_string_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_struct_decoder_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_struct_encoder_test.go rename vendor/github.com/json-iterator/go/{ => misc_tests}/jsoniter_array_test.go (74%) create mode 100644 vendor/github.com/json-iterator/go/misc_tests/jsoniter_bool_test.go create mode 100644 vendor/github.com/json-iterator/go/misc_tests/jsoniter_float_test.go create mode 100644 vendor/github.com/json-iterator/go/misc_tests/jsoniter_int_test.go create mode 100644 vendor/github.com/json-iterator/go/misc_tests/jsoniter_interface_test.go rename vendor/github.com/json-iterator/go/{ => misc_tests}/jsoniter_iterator_test.go (81%) create mode 100644 vendor/github.com/json-iterator/go/misc_tests/jsoniter_map_test.go rename vendor/github.com/json-iterator/go/{ => misc_tests}/jsoniter_nested_test.go (83%) create mode 100644 vendor/github.com/json-iterator/go/misc_tests/jsoniter_null_test.go create mode 100644 vendor/github.com/json-iterator/go/misc_tests/jsoniter_object_test.go create mode 100644 vendor/github.com/json-iterator/go/misc_tests/jsoniter_raw_message_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/array/bool/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/array/bool/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/array/byte/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/array/byte/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/array/float64/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/array/float64/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/array/int32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/array/int32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/array/ptr_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/array/ptr_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/array/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/array/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/array/uint8/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/array/uint8/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/bool/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/bool/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/byte/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/byte/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/float64/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/float64/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/int32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/int32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/map/int32_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/map/int32_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/map/string_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/map/string_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_bool/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_bool/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_float64/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_float64/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_int32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_int32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_map/int32_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_map/int32_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_map/string_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_map/string_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/bool/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/bool/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/byte/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/byte/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/float64/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/float64/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/int32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/int32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/ptr_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/ptr_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/uint8/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/uint8/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_struct_various/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_struct_various/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_uint8/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/ptr_uint8/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/slice/bool/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/slice/bool/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/slice/byte/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/slice/byte/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/slice/float64/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/slice/float64/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/slice/int32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/slice/int32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/slice/ptr_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/slice/ptr_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/slice/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/slice/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/slice/uint8/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/slice/uint8/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/struct_empty/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/struct_empty/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/struct_empty_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/struct_empty_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/struct_ptr_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/struct_ptr_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/struct_various/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/struct_various/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/uint8/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/array/uint8/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/bool/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/bool/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/bool_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/bool_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/byte/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/byte/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/byte_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/byte_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/float32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/float32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/float32_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/float32_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/float64/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/float64/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/float64_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/float64_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/int16/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/int16/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/int16_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/int16_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/int32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/int32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/int32_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/int32_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/int64/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/int64/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/int8/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/int8/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/int8_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/int8_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/string_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/string_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/uint16/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/uint16/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/uint16_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/uint16_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/uint32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/uint32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/uint32_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/uint32_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/uint8/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/uint8/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/uint8_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/uint8_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/uintptr/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/builtins/uintptr/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/caseless_unmarshal/caseless_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/caseless_unmarshal/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/json_marshal/string_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/json_marshal/string_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/json_marshal/struct/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/json_marshal/struct/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/json_marshal/struct_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/json_marshal/struct_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/json_marshal/struct_field/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/json_marshal/struct_field/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/json_marshal/struct_field_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/json_marshal/struct_field_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/int16/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/int16/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/int32/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/int32/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/int64/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/int64/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/int8/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/int8/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/array_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/array_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/bool/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/bool/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/byte/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/byte/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/float64/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/float64/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/int32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/int32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/map_string_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/map_string_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/ptr_array_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/ptr_array_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/ptr_bool/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/ptr_bool/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/ptr_float64/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/ptr_float64/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/ptr_int32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/ptr_int32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/ptr_map_string_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/ptr_map_string_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/ptr_slice_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/ptr_slice_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/ptr_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/ptr_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/ptr_struct_various/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/ptr_struct_various/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/ptr_uint8/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/ptr_uint8/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/slice_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/slice_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/string_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/string_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/struct_empty/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/struct_empty/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/struct_empty_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/struct_empty_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/struct_ptr_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/struct_ptr_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/struct_various/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/struct_various/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/uint8/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string/uint8/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string_alias/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string_alias/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string_alias/string_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/string_alias/string_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/uint16/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/uint16/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/uint32/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/uint32/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/uint8/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map/uint8/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map_key_text_marshal/string_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map_key_text_marshal/string_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map_key_text_marshal/struct/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/map_key_text_marshal/struct/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/marshal_fail_case.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/partial_unmarshal/partial_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/partial_unmarshal/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/array/bool/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/array/bool/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/array/byte/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/array/byte/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/array/float64/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/array/float64/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/array/int32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/array/int32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/array/ptr_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/array/ptr_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/array/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/array/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/array/uint8/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/array/uint8/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/bool/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/bool/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/byte/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/byte/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/float64/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/float64/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/int32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/int32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/int64/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/int64/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/map/int32_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/map/int32_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/map/string_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/map/string_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/bool/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/bool/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/byte/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/byte/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/float64/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/float64/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/int32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/int32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/ptr_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/ptr_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/uint8/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/uint8/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_bool/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_bool/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_float64/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_float64/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_int32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_int32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_map/int32_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_map/int32_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_map/string_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_map/string_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/bool/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/bool/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/byte/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/byte/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/float64/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/float64/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/int32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/int32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/ptr_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/ptr_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/uint8/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/uint8/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_struct_various/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_struct_various/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_uint8/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/ptr_uint8/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/slice/bool/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/slice/bool/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/slice/byte/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/slice/byte/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/slice/float64/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/slice/float64/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/slice/int32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/slice/int32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/slice/ptr_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/slice/ptr_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/slice/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/slice/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/slice/uint8/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/slice/uint8/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/struct_empty/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/struct_empty/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/struct_empty_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/struct_empty_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/struct_ptr_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/struct_ptr_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/struct_various/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/struct_various/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/uint8/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/slice/uint8/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/float64/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/float64/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/int32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/int32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/json_marshal/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/json_marshal/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/map_string_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/map_string_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_float64/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_float64/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_int32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_int32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_map_string_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_map_string_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_slice_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_slice_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_struct_various/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_struct_various/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/slice_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/slice_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/string_with_tag/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/string_with_tag/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/struct_various/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/struct_various/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/text_marshal/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/text_marshal/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/different_levels/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/different_levels/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/ignore_deeper_level/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/ignore_deeper_level/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_1_both_tagged/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_1_both_tagged/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_1_no_tags/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_1_no_tags/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_1_tagged/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_1_tagged/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_2_both_tagged/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_2_both_tagged/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_2_no_tags/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_2_no_tags/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_2_tagged/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_2_tagged/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/array/ptr_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/array/ptr_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/array/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/array/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/array/string_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/array/string_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/array/strings/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/array/strings/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/array/struct_strings/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/array/struct_strings/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/empty/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/empty/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/empty_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/empty_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/everything/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/everything/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/float64/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/float64/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/float64_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/float64_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/float64s/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/float64s/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/float64s_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/float64s_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/int32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/int32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/int32_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/int32_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/int32s/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/int32s/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/int32s_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/int32s_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/int64/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/int64/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/map/int32_ptr_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/map/int32_ptr_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/map/int32_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/map/int32_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/map/int32_struct_strings/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/map/int32_struct_strings/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/map/string_ptr_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/map/string_ptr_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/map/string_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/map/string_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/map/string_struct_strings/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/map/string_struct_strings/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptr_float64/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptr_float64/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptr_float64_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptr_float64_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptr_int32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptr_int32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptr_int32_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptr_int32_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptr_ptr_struct_empty/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptr_ptr_struct_empty/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptr_ptr_struct_strings/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptr_ptr_struct_strings/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptr_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptr_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptr_string_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptr_string_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptr_struct_empty/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptr_struct_empty/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptr_struct_strings/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptr_struct_strings/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptrs_float64/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptrs_float64/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptrs_int32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptrs_int32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptrs_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/ptrs_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/slice/ptr_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/slice/ptr_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/slice/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/slice/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/slice/string_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/slice/string_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/slice/strings/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/slice/strings/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/slice/struct_strings/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/slice/struct_strings/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/string_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/string_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/strings/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/strings/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/strings_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/strings_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/struct/empties/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/struct/empties/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/struct/empty/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/struct/empty/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/struct/empty_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/struct/empty_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/struct/float32s/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/struct/float32s/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/struct/float64/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/struct/float64/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/struct/float64_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/struct/float64_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/struct/int32s/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/struct/int32s/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/struct/strings/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/struct/strings/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/struct/strings_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct/struct/strings_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/fieldname/embedded/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/fieldname/embedded/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/fieldname/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/fieldname/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/fieldname/struct/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/fieldname/struct/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/bool/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/bool/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/embedded/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/embedded/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/float32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/float32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/int32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/int32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/map_string_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/map_string_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_bool/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_bool/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_float32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_float32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_int32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_int32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_map_string_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_map_string_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_slice_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_slice_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string_json_marshal/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string_json_marshal/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string_text_marshal/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string_text_marshal/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_struct_json_marshal/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_struct_json_marshal/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_struct_text_marshal/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_struct_text_marshal/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_uint32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_uint32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/slice_string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/slice_string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/string_json_marshal/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/string_json_marshal/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/string_text_marshal/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/string_text_marshal/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/struct/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/struct/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/struct_json_marshal/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/struct_json_marshal/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/struct_text_marshal/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/struct_text_marshal/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/uint32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/uint32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/string/bool/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/string/bool/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/string/byte/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/string/byte/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/string/float32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/string/float32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/string/float64/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/string/float64/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/string/int16/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/string/int16/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/string/int32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/string/int32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/string/int8/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/string/int8/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/string/string/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/string/string/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/string/uint16/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/string/uint16/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/string/uint32/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/string/uint32/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/string/uint8/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/struct_tags/string/uint8/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/text_marshal/string_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/text_marshal/string_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/text_marshal/struct/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/text_marshal/struct/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/text_marshal/struct_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/text_marshal/struct_alias/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/text_marshal/struct_field/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/text_marshal/struct_field/types.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/text_marshal/struct_field_alias/json_test.go delete mode 100644 vendor/github.com/json-iterator/go/output_tests/text_marshal/struct_field_alias/types.go rename vendor/github.com/json-iterator/go/{feature_pool.go => pool.go} (64%) create mode 100644 vendor/github.com/json-iterator/go/reflect.go create mode 100644 vendor/github.com/json-iterator/go/reflect_array.go create mode 100644 vendor/github.com/json-iterator/go/reflect_dynamic.go rename vendor/github.com/json-iterator/go/{feature_reflect_extension.go => reflect_extension.go} (57%) create mode 100644 vendor/github.com/json-iterator/go/reflect_json_number.go create mode 100644 vendor/github.com/json-iterator/go/reflect_json_raw_message.go create mode 100644 vendor/github.com/json-iterator/go/reflect_map.go create mode 100644 vendor/github.com/json-iterator/go/reflect_marshaler.go create mode 100644 vendor/github.com/json-iterator/go/reflect_native.go rename vendor/github.com/json-iterator/go/{feature_reflect_optional.go => reflect_optional.go} (52%) create mode 100644 vendor/github.com/json-iterator/go/reflect_slice.go rename vendor/github.com/json-iterator/go/{feature_reflect_struct_decoder.go => reflect_struct_decoder.go} (77%) rename vendor/github.com/json-iterator/go/{feature_reflect_object.go => reflect_struct_encoder.go} (53%) delete mode 100644 vendor/github.com/json-iterator/go/skip_tests/array/inputs.go delete mode 100644 vendor/github.com/json-iterator/go/skip_tests/array/skip_test.go create mode 100644 vendor/github.com/json-iterator/go/skip_tests/array_test.go create mode 100644 vendor/github.com/json-iterator/go/skip_tests/float64_test.go rename vendor/github.com/json-iterator/go/{ => skip_tests}/jsoniter_skip_test.go (76%) delete mode 100644 vendor/github.com/json-iterator/go/skip_tests/number/inputs.go delete mode 100644 vendor/github.com/json-iterator/go/skip_tests/number/skip_test.go delete mode 100644 vendor/github.com/json-iterator/go/skip_tests/object/inputs.go delete mode 100644 vendor/github.com/json-iterator/go/skip_tests/object/skip_test.go create mode 100644 vendor/github.com/json-iterator/go/skip_tests/skip_test.go delete mode 100644 vendor/github.com/json-iterator/go/skip_tests/string/inputs.go delete mode 100644 vendor/github.com/json-iterator/go/skip_tests/string/skip_test.go create mode 100644 vendor/github.com/json-iterator/go/skip_tests/string_test.go create mode 100644 vendor/github.com/json-iterator/go/skip_tests/struct_test.go rename vendor/github.com/json-iterator/go/{feature_stream.go => stream.go} (62%) rename vendor/github.com/json-iterator/go/{feature_stream_float.go => stream_float.go} (85%) create mode 100644 vendor/github.com/json-iterator/go/stream_int.go rename vendor/github.com/json-iterator/go/{feature_stream_string.go => stream_str.go} (91%) rename vendor/github.com/json-iterator/go/{jsoniter_stream_test.go => stream_test.go} (94%) create mode 100644 vendor/github.com/json-iterator/go/type_tests/array_test.go create mode 100644 vendor/github.com/json-iterator/go/type_tests/builtin_test.go create mode 100644 vendor/github.com/json-iterator/go/type_tests/map_key_test.go create mode 100644 vendor/github.com/json-iterator/go/type_tests/map_test.go create mode 100644 vendor/github.com/json-iterator/go/type_tests/marshaler_string_test.go create mode 100644 vendor/github.com/json-iterator/go/type_tests/marshaler_struct_test.go create mode 100644 vendor/github.com/json-iterator/go/type_tests/slice_test.go create mode 100644 vendor/github.com/json-iterator/go/type_tests/struct_embedded_test.go create mode 100644 vendor/github.com/json-iterator/go/type_tests/struct_field_case_test.go create mode 100644 vendor/github.com/json-iterator/go/type_tests/struct_tags_test.go create mode 100644 vendor/github.com/json-iterator/go/type_tests/struct_test.go create mode 100644 vendor/github.com/json-iterator/go/type_tests/text_marshaler_string_test.go create mode 100644 vendor/github.com/json-iterator/go/type_tests/text_marshaler_struct_test.go create mode 100644 vendor/github.com/json-iterator/go/type_tests/type_test.go delete mode 100644 vendor/github.com/json-iterator/go/unmarshal_input_test.go create mode 100644 vendor/github.com/json-iterator/go/value_tests/array_test.go create mode 100644 vendor/github.com/json-iterator/go/value_tests/bool_test.go create mode 100644 vendor/github.com/json-iterator/go/value_tests/eface_test.go rename vendor/github.com/json-iterator/go/{jsoniter_float_test.go => value_tests/float_test.go} (51%) create mode 100644 vendor/github.com/json-iterator/go/value_tests/iface_test.go rename vendor/github.com/json-iterator/go/{jsoniter_int_test.go => value_tests/int_test.go} (63%) rename vendor/github.com/json-iterator/go/{jsoniter_invalid_test.go => value_tests/invalid_test.go} (66%) create mode 100644 vendor/github.com/json-iterator/go/value_tests/map_test.go create mode 100644 vendor/github.com/json-iterator/go/value_tests/marshaler_test.go create mode 100644 vendor/github.com/json-iterator/go/value_tests/number_test.go create mode 100644 vendor/github.com/json-iterator/go/value_tests/ptr_test.go create mode 100644 vendor/github.com/json-iterator/go/value_tests/raw_message_test.go create mode 100644 vendor/github.com/json-iterator/go/value_tests/slice_test.go create mode 100644 vendor/github.com/json-iterator/go/value_tests/string_test.go create mode 100644 vendor/github.com/json-iterator/go/value_tests/struct_test.go create mode 100644 vendor/github.com/json-iterator/go/value_tests/value_test.go create mode 100644 vendor/github.com/kubernetes-csi/csi-test/mock/.gitignore create mode 100644 vendor/github.com/kubernetes-csi/csi-test/mock/AUTHORS create mode 100644 vendor/github.com/kubernetes-csi/csi-test/mock/Makefile create mode 100644 vendor/github.com/kubernetes-csi/csi-test/mock/README.md create mode 100644 vendor/github.com/kubernetes-csi/csi-test/mock/context/context.go create mode 100644 vendor/github.com/kubernetes-csi/csi-test/mock/gocsi/envvars.go create mode 100644 vendor/github.com/kubernetes-csi/csi-test/mock/gocsi/gocsi.go create mode 100644 vendor/github.com/kubernetes-csi/csi-test/mock/gocsi/usage.go create mode 100644 vendor/github.com/kubernetes-csi/csi-test/mock/main.go create mode 100644 vendor/github.com/kubernetes-csi/csi-test/mock/plugin.go create mode 100644 vendor/github.com/kubernetes-csi/csi-test/mock/provider/provider.go create mode 100644 vendor/github.com/kubernetes-csi/csi-test/mock/service/controller.go create mode 100644 vendor/github.com/kubernetes-csi/csi-test/mock/service/identity.go create mode 100644 vendor/github.com/kubernetes-csi/csi-test/mock/service/node.go create mode 100644 vendor/github.com/kubernetes-csi/csi-test/mock/service/service.go create mode 100644 vendor/github.com/kubernetes-csi/csi-test/mock/utils/utils.go create mode 100644 vendor/github.com/kubernetes-csi/csi-test/mock/utils/utils_middleware.go create mode 100644 vendor/github.com/kubernetes-csi/csi-test/mock/utils/utils_rpcs.go create mode 100644 vendor/github.com/kubernetes-csi/csi-test/mock/utils/utils_suite_test.go create mode 100644 vendor/github.com/kubernetes-csi/csi-test/mock/utils/utils_test.go create mode 100644 vendor/github.com/modern-go/concurrent/.gitignore create mode 100644 vendor/github.com/modern-go/concurrent/.travis.yml create mode 100644 vendor/github.com/modern-go/concurrent/LICENSE create mode 100644 vendor/github.com/modern-go/concurrent/README.md create mode 100644 vendor/github.com/modern-go/concurrent/executor.go create mode 100644 vendor/github.com/modern-go/concurrent/go_above_19.go create mode 100644 vendor/github.com/modern-go/concurrent/go_below_19.go create mode 100644 vendor/github.com/modern-go/concurrent/log.go create mode 100644 vendor/github.com/modern-go/concurrent/map_test.go create mode 100755 vendor/github.com/modern-go/concurrent/test.sh create mode 100644 vendor/github.com/modern-go/concurrent/unbounded_executor.go create mode 100644 vendor/github.com/modern-go/concurrent/unbounded_executor_test.go create mode 100644 vendor/github.com/modern-go/reflect2/.gitignore create mode 100644 vendor/github.com/modern-go/reflect2/Gopkg.lock create mode 100644 vendor/github.com/modern-go/reflect2/Gopkg.toml create mode 100644 vendor/github.com/modern-go/reflect2/LICENSE create mode 100644 vendor/github.com/modern-go/reflect2/README.md create mode 100644 vendor/github.com/modern-go/reflect2/go_above_17.go create mode 100644 vendor/github.com/modern-go/reflect2/go_above_19.go create mode 100644 vendor/github.com/modern-go/reflect2/go_below_17.go create mode 100644 vendor/github.com/modern-go/reflect2/go_below_19.go create mode 100644 vendor/github.com/modern-go/reflect2/reflect2.go rename vendor/{google.golang.org/grpc/.please-update => github.com/modern-go/reflect2/reflect2_amd64.s} (100%) create mode 100644 vendor/github.com/modern-go/reflect2/reflect2_kind.go create mode 100644 vendor/github.com/modern-go/reflect2/relfect2_386.s create mode 100644 vendor/github.com/modern-go/reflect2/relfect2_amd64p32.s create mode 100644 vendor/github.com/modern-go/reflect2/relfect2_arm.s create mode 100644 vendor/github.com/modern-go/reflect2/relfect2_arm64.s create mode 100644 vendor/github.com/modern-go/reflect2/relfect2_mips64x.s create mode 100644 vendor/github.com/modern-go/reflect2/relfect2_mipsx.s create mode 100644 vendor/github.com/modern-go/reflect2/relfect2_ppc64x.s create mode 100644 vendor/github.com/modern-go/reflect2/relfect2_s390x.s create mode 100644 vendor/github.com/modern-go/reflect2/safe_field.go create mode 100644 vendor/github.com/modern-go/reflect2/safe_map.go create mode 100644 vendor/github.com/modern-go/reflect2/safe_slice.go create mode 100644 vendor/github.com/modern-go/reflect2/safe_struct.go create mode 100644 vendor/github.com/modern-go/reflect2/safe_type.go create mode 100644 vendor/github.com/modern-go/reflect2/test15/map_test.go create mode 100644 vendor/github.com/modern-go/reflect2/tests/array_test.go create mode 100644 vendor/github.com/modern-go/reflect2/tests/int_test.go create mode 100644 vendor/github.com/modern-go/reflect2/tests/map_elem_array_test.go create mode 100644 vendor/github.com/modern-go/reflect2/tests/map_elem_bytes_test.go create mode 100644 vendor/github.com/modern-go/reflect2/tests/map_elem_eface_test.go create mode 100644 vendor/github.com/modern-go/reflect2/tests/map_elem_map_test.go create mode 100644 vendor/github.com/modern-go/reflect2/tests/map_elem_struct_test.go create mode 100644 vendor/github.com/modern-go/reflect2/tests/map_key_eface_test.go create mode 100644 vendor/github.com/modern-go/reflect2/tests/map_key_iface_test.go create mode 100644 vendor/github.com/modern-go/reflect2/tests/map_key_ptr_test.go create mode 100644 vendor/github.com/modern-go/reflect2/tests/map_test.go create mode 100644 vendor/github.com/modern-go/reflect2/tests/op_test.go create mode 100644 vendor/github.com/modern-go/reflect2/tests/slice_array_test.go create mode 100644 vendor/github.com/modern-go/reflect2/tests/slice_bytes_test.go create mode 100644 vendor/github.com/modern-go/reflect2/tests/slice_eface_test.go create mode 100644 vendor/github.com/modern-go/reflect2/tests/slice_iface_test.go create mode 100644 vendor/github.com/modern-go/reflect2/tests/slice_map_test.go create mode 100644 vendor/github.com/modern-go/reflect2/tests/slice_ptr_test.go create mode 100644 vendor/github.com/modern-go/reflect2/tests/slice_string_test.go create mode 100644 vendor/github.com/modern-go/reflect2/tests/slice_struct_test.go create mode 100644 vendor/github.com/modern-go/reflect2/tests/slice_test.go create mode 100644 vendor/github.com/modern-go/reflect2/tests/struct_eface_test.go create mode 100644 vendor/github.com/modern-go/reflect2/tests/struct_ptr_test.go create mode 100644 vendor/github.com/modern-go/reflect2/tests/struct_test.go create mode 100644 vendor/github.com/modern-go/reflect2/type_map.go create mode 100644 vendor/github.com/modern-go/reflect2/unsafe_array.go create mode 100644 vendor/github.com/modern-go/reflect2/unsafe_eface.go create mode 100644 vendor/github.com/modern-go/reflect2/unsafe_field.go create mode 100644 vendor/github.com/modern-go/reflect2/unsafe_iface.go create mode 100644 vendor/github.com/modern-go/reflect2/unsafe_link.go create mode 100644 vendor/github.com/modern-go/reflect2/unsafe_map.go create mode 100644 vendor/github.com/modern-go/reflect2/unsafe_ptr.go create mode 100644 vendor/github.com/modern-go/reflect2/unsafe_slice.go create mode 100644 vendor/github.com/modern-go/reflect2/unsafe_struct.go create mode 100644 vendor/github.com/modern-go/reflect2/unsafe_type.go rename vendor/golang.org/x/text/{message/pipeline/testdata/test1 => cmd/gotext/examples/extract/locales}/extracted.gotext.json (71%) mode change 100644 => 100755 delete mode 100644 vendor/golang.org/x/text/cmd/gotext/examples/extract_http/catalog_gen.go rename vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/{en/out.gotext.json => extracted.gotext.json} (60%) mode change 100644 => 100755 delete mode 100644 vendor/golang.org/x/text/cmd/gotext/update.go delete mode 100644 vendor/golang.org/x/text/message/pipeline/go19_test.go delete mode 100644 vendor/golang.org/x/text/message/pipeline/pipeline_test.go delete mode 100644 vendor/golang.org/x/text/message/pipeline/testdata/test1/catalog_gen.go delete mode 100644 vendor/golang.org/x/text/message/pipeline/testdata/test1/catalog_gen.go.want delete mode 100644 vendor/golang.org/x/text/message/pipeline/testdata/test1/catalog_test.go delete mode 100644 vendor/golang.org/x/text/message/pipeline/testdata/test1/extracted.gotext.json.want delete mode 100755 vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/de/messages.gotext.json delete mode 100755 vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/de/out.gotext.json delete mode 100755 vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/de/out.gotext.json.want delete mode 100755 vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/en-US/messages.gotext.json delete mode 100755 vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/en-US/out.gotext.json delete mode 100755 vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/en-US/out.gotext.json.want delete mode 100755 vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/zh/messages.gotext.json delete mode 100755 vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/zh/out.gotext.json delete mode 100755 vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/zh/out.gotext.json.want delete mode 100644 vendor/golang.org/x/text/message/pipeline/testdata/test1/test1.go delete mode 100644 vendor/google.golang.org/genproto/googleapis/cloud/ml/v1beta1/job_service.pb.go delete mode 100644 vendor/google.golang.org/genproto/googleapis/cloud/ml/v1beta1/model_service.pb.go delete mode 100644 vendor/google.golang.org/genproto/googleapis/cloud/ml/v1beta1/operation_metadata.pb.go delete mode 100644 vendor/google.golang.org/genproto/googleapis/cloud/ml/v1beta1/prediction_service.pb.go delete mode 100644 vendor/google.golang.org/genproto/googleapis/cloud/ml/v1beta1/project_service.pb.go delete mode 100644 vendor/google.golang.org/genproto/googleapis/tracing/v1/trace.pb.go create mode 100644 vendor/google.golang.org/grpc/Documentation/encoding.md create mode 100644 vendor/google.golang.org/grpc/encoding/proto/proto.go rename vendor/google.golang.org/grpc/{codec_benchmark_test.go => encoding/proto/proto_benchmark_test.go} (83%) create mode 100644 vendor/google.golang.org/grpc/encoding/proto/proto_test.go delete mode 100644 vendor/google.golang.org/grpc/resolver_test.go create mode 100644 vendor/gopkg.in/yaml.v2/NOTICE create mode 100644 vendor/gopkg.in/yaml.v2/go.mod create mode 100644 vendor/k8s.io/apimachinery/Godeps/OWNERS create mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/table/BUILD create mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/table/table.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/duration/BUILD create mode 100644 vendor/k8s.io/apimachinery/pkg/util/duration/duration.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/handler/handler_test.go diff --git a/Gopkg.lock b/Gopkg.lock index 50662c1d4..7d5f6f5d4 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -5,7 +5,7 @@ name = "github.com/container-storage-interface/spec" packages = ["lib/go/csi/v0"] revision = "35d9f9d77954980e449e52c3f3e43c21bd8171f5" - version = "v0.2.0-rc1" + version = "v0.2.0" [[projects]] name = "github.com/davecgh/go-spew" @@ -114,8 +114,8 @@ [[projects]] name = "github.com/json-iterator/go" packages = ["."] - revision = "28452fcdec4e44348d2af0d91d1e9e38da3a9e0a" - version = "1.0.5" + revision = "3353055b2a1a5ae1b6a8dfde887a524e7088f3a2" + version = "1.1.2" [[projects]] name = "github.com/juju/ratelimit" @@ -130,7 +130,19 @@ "driver", "utils" ] - revision = "9aed34bd6fe031caae3d055b19d041c2c64420cc" + revision = "30d30c959f5689ca2a7c3d6b301c6a95fbdbe030" + +[[projects]] + name = "github.com/modern-go/concurrent" + packages = ["."] + revision = "938152ca6a933f501bb238954eebd3cbcbf489ff" + version = "1.0.2" + +[[projects]] + name = "github.com/modern-go/reflect2" + packages = ["."] + revision = "1df9eeb2bb81f327b96228865c5687bc2194af3f" + version = "1.0.0" [[projects]] branch = "master" @@ -154,7 +166,7 @@ branch = "master" name = "golang.org/x/crypto" packages = ["ssh/terminal"] - revision = "5119cf507ed5294cc409c092980c7497ee5d6fd2" + revision = "91a49db82a88618983a78a06c1cbd4e00ab749ab" [[projects]] branch = "master" @@ -168,7 +180,7 @@ "lex/httplex", "trace" ] - revision = "f5dfe339be1d06f81b22525fe34671ee7d2c8904" + revision = "22ae77b79946ea320088417e4d50825671d82d57" [[projects]] branch = "master" @@ -177,10 +189,9 @@ "unix", "windows" ] - revision = "37707fdb30a5b38865cfb95e5aab41707daec7fd" + revision = "dd2ff4accc098aceecb86b36eaa7829b2a17b1c9" [[projects]] - branch = "master" name = "golang.org/x/text" packages = [ "collate", @@ -198,13 +209,14 @@ "unicode/norm", "unicode/rangetable" ] - revision = "4e4a3210bb54bb31f6ab2cdca2edcc0b50c420c1" + revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" + version = "v0.3.0" [[projects]] branch = "master" name = "google.golang.org/genproto" packages = ["googleapis/rpc/status"] - revision = "2b5a72b8730b0b16380010cfe5286c42108d88e7" + revision = "2c5e7ac708aaa719366570dd82bda44541ca2a63" [[projects]] name = "google.golang.org/grpc" @@ -217,6 +229,7 @@ "connectivity", "credentials", "encoding", + "encoding/proto", "grpclb/grpc_lb_v1/messages", "grpclog", "internal", @@ -234,8 +247,8 @@ "tap", "transport" ] - revision = "6b51017f791ae1cfbec89c52efdf444b13b550ef" - version = "v1.9.2" + revision = "8e4536a86ab602859c20df5ebfd0bd4228d08655" + version = "v1.10.0" [[projects]] name = "gopkg.in/inf.v0" @@ -244,13 +257,12 @@ version = "v0.9.0" [[projects]] - branch = "v2" name = "gopkg.in/yaml.v2" packages = ["."] - revision = "d670f9405373e636a5a2765eea47fac0c9bc91a4" + revision = "7f97868eec74b32b0982dd158a51a446d1da7eb5" + version = "v2.1.1" [[projects]] - branch = "master" name = "k8s.io/api" packages = [ "admissionregistration/v1alpha1", @@ -282,10 +294,10 @@ "storage/v1alpha1", "storage/v1beta1" ] - revision = "860727955743743199a0f053f2292f41d7196604" + revision = "7aac3e00a1b32fa476b83078cebaaca606b2fb48" + version = "kubernetes-1.10.0-beta.1" [[projects]] - branch = "master" name = "k8s.io/apimachinery" packages = [ "pkg/api/errors", @@ -330,7 +342,8 @@ "third_party/forked/golang/json", "third_party/forked/golang/reflect" ] - revision = "8259d997cf059cd83dc47e5f8074b7a7d7967c09" + revision = "302974c03f7e50f16561ba237db776ab93594ef6" + version = "kubernetes-1.10.0-beta.1" [[projects]] name = "k8s.io/client-go" @@ -489,11 +502,11 @@ branch = "master" name = "k8s.io/kube-openapi" packages = ["pkg/util/proto"] - revision = "275e2ce91dec4c05a4094a7b1daee5560b555ac9" + revision = "50ae88d24ede7b8bad68e23c805b5d3da5c8abaf" [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "00961fce4012503c6a4d232ef6d0655c7d375776d7a459a2be340235b717103d" + inputs-digest = "493ef71fb266e20d2db189e3d35c80a0a4e5a3d4015fcc6b895208495cdba042" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index fa0183885..ecaa9cf90 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -1,8 +1,8 @@ # List of dependecies for CSI attacher [[constraint]] - branch = "master" name = "github.com/container-storage-interface/spec" + version = "~0.2.0" [[constraint]] branch = "master" @@ -21,12 +21,12 @@ version = "1.9.2" [[constraint]] - branch = "master" name = "k8s.io/api" + version = "kubernetes-1.10.0-beta.1" [[constraint]] - branch = "master" name = "k8s.io/apimachinery" + version = "kubernetes-1.10.0-beta.1" [[constraint]] name = "k8s.io/client-go" diff --git a/vendor/github.com/json-iterator/go/Gopkg.lock b/vendor/github.com/json-iterator/go/Gopkg.lock index f34f5b4ad..338f1c68a 100644 --- a/vendor/github.com/json-iterator/go/Gopkg.lock +++ b/vendor/github.com/json-iterator/go/Gopkg.lock @@ -2,32 +2,20 @@ [[projects]] - name = "github.com/davecgh/go-spew" - packages = ["spew"] - revision = "346938d642f2ec3594ed81d874461961cd0faa76" - version = "v1.1.0" - -[[projects]] - branch = "master" - name = "github.com/google/gofuzz" + name = "github.com/modern-go/concurrent" packages = ["."] - revision = "24818f796faf91cd76ec7bddd72458fbced7a6c1" + revision = "e0a39a4cb4216ea8db28e22a69f4ec25610d513a" + version = "1.0.0" [[projects]] - name = "github.com/pmezard/go-difflib" - packages = ["difflib"] - revision = "792786c7400a136282c1664665ae0a8db921c6c2" - version = "v1.0.0" - -[[projects]] - name = "github.com/stretchr/testify" - packages = ["assert","require"] - revision = "69483b4bd14f5845b5a1e55bca19e954e827f1d0" - version = "v1.1.4" + name = "github.com/modern-go/reflect2" + packages = ["."] + revision = "1df9eeb2bb81f327b96228865c5687bc2194af3f" + version = "1.0.0" [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "f8b7cf3941d3792cbbd570bb53c093adaf774334d1162c651565c97a58dc9d09" + inputs-digest = "ac7003b5a981716353a43055ab7d4c5357403cb30a60de2dbdeb446c1544beaa" solver-name = "gps-cdcl" solver-version = 1 diff --git a/vendor/github.com/json-iterator/go/Gopkg.toml b/vendor/github.com/json-iterator/go/Gopkg.toml index 0ac55ef87..5801ffa1e 100644 --- a/vendor/github.com/json-iterator/go/Gopkg.toml +++ b/vendor/github.com/json-iterator/go/Gopkg.toml @@ -19,15 +19,8 @@ # name = "github.com/x/y" # version = "2.4.0" +ignored = ["github.com/davecgh/go-spew*","github.com/google/gofuzz*","github.com/stretchr/testify*"] [[constraint]] - name = "github.com/davecgh/go-spew" - version = "1.1.0" - -[[constraint]] - branch = "master" - name = "github.com/google/gofuzz" - -[[constraint]] - name = "github.com/stretchr/testify" - version = "1.1.4" + name = "github.com/modern-go/reflect2" + version = "1.0.0" diff --git a/vendor/github.com/json-iterator/go/README.md b/vendor/github.com/json-iterator/go/README.md index 3a0d68098..9f404aaa3 100644 --- a/vendor/github.com/json-iterator/go/README.md +++ b/vendor/github.com/json-iterator/go/README.md @@ -8,6 +8,8 @@ A high-performance 100% compatible drop-in replacement of "encoding/json" +You can also use thrift like JSON using [thrift-iterator](https://github.com/thrift-iterator/go) + ``` Go开发者们请加入我们,滴滴出行平台技术部 taowen@didichuxing.com ``` diff --git a/vendor/github.com/json-iterator/go/feature_adapter.go b/vendor/github.com/json-iterator/go/adapter.go similarity index 81% rename from vendor/github.com/json-iterator/go/feature_adapter.go rename to vendor/github.com/json-iterator/go/adapter.go index e0ab94807..3a494eeb4 100644 --- a/vendor/github.com/json-iterator/go/feature_adapter.go +++ b/vendor/github.com/json-iterator/go/adapter.go @@ -16,15 +16,6 @@ func Unmarshal(data []byte, v interface{}) error { return ConfigDefault.Unmarshal(data, v) } -func lastNotSpacePos(data []byte) int { - for i := len(data) - 1; i >= 0; i-- { - if data[i] != ' ' && data[i] != '\t' && data[i] != '\r' && data[i] != '\n' { - return i + 1 - } - } - return 0 -} - // UnmarshalFromString convenient method to read from string instead of []byte func UnmarshalFromString(str string, v interface{}) error { return ConfigDefault.UnmarshalFromString(str, v) @@ -95,11 +86,21 @@ func (adapter *Decoder) Buffered() io.Reader { return bytes.NewReader(remaining) } -// UseNumber for number JSON element, use float64 or json.NumberValue (alias of string) +// UseNumber causes the Decoder to unmarshal a number into an interface{} as a +// Number instead of as a float64. func (adapter *Decoder) UseNumber() { - origCfg := adapter.iter.cfg.configBeforeFrozen - origCfg.UseNumber = true - adapter.iter.cfg = origCfg.Froze().(*frozenConfig) + cfg := adapter.iter.cfg.configBeforeFrozen + cfg.UseNumber = true + adapter.iter.cfg = cfg.frozeWithCacheReuse() +} + +// DisallowUnknownFields causes the Decoder to return an error when the destination +// is a struct and the input contains object keys which do not match any +// non-ignored, exported fields in the destination. +func (adapter *Decoder) DisallowUnknownFields() { + cfg := adapter.iter.cfg.configBeforeFrozen + cfg.DisallowUnknownFields = true + adapter.iter.cfg = cfg.frozeWithCacheReuse() } // NewEncoder same as json.NewEncoder @@ -122,14 +123,16 @@ func (adapter *Encoder) Encode(val interface{}) error { // SetIndent set the indention. Prefix is not supported func (adapter *Encoder) SetIndent(prefix, indent string) { - adapter.stream.cfg.indentionStep = len(indent) + config := adapter.stream.cfg.configBeforeFrozen + config.IndentionStep = len(indent) + adapter.stream.cfg = config.frozeWithCacheReuse() } // SetEscapeHTML escape html by default, set to false to disable func (adapter *Encoder) SetEscapeHTML(escapeHTML bool) { config := adapter.stream.cfg.configBeforeFrozen config.EscapeHTML = escapeHTML - adapter.stream.cfg = config.Froze().(*frozenConfig) + adapter.stream.cfg = config.frozeWithCacheReuse() } // Valid reports whether data is a valid JSON encoding. diff --git a/vendor/github.com/json-iterator/go/feature_any.go b/vendor/github.com/json-iterator/go/any.go similarity index 75% rename from vendor/github.com/json-iterator/go/feature_any.go rename to vendor/github.com/json-iterator/go/any.go index 87716d1fc..daecfed61 100644 --- a/vendor/github.com/json-iterator/go/feature_any.go +++ b/vendor/github.com/json-iterator/go/any.go @@ -3,8 +3,11 @@ package jsoniter import ( "errors" "fmt" + "github.com/modern-go/reflect2" "io" "reflect" + "strconv" + "unsafe" ) // Any generic object representation. @@ -25,7 +28,6 @@ type Any interface { ToString() string ToVal(val interface{}) Get(path ...interface{}) Any - // TODO: add Set Size() int Keys() []string GetInterface() interface{} @@ -35,7 +37,7 @@ type Any interface { type baseAny struct{} func (any *baseAny) Get(path ...interface{}) Any { - return &invalidAny{baseAny{}, fmt.Errorf("Get %v from simple value", path)} + return &invalidAny{baseAny{}, fmt.Errorf("GetIndex %v from simple value", path)} } func (any *baseAny) Size() int { @@ -89,7 +91,7 @@ func Wrap(val interface{}) Any { if isAny { return asAny } - typ := reflect.TypeOf(val) + typ := reflect2.TypeOf(val) switch typ.Kind() { case reflect.Slice: return wrapArray(val) @@ -100,6 +102,9 @@ func Wrap(val interface{}) Any { case reflect.String: return WrapString(val.(string)) case reflect.Int: + if strconv.IntSize == 32 { + return WrapInt32(int32(val.(int))) + } return WrapInt64(int64(val.(int))) case reflect.Int8: return WrapInt32(int32(val.(int8))) @@ -110,7 +115,15 @@ func Wrap(val interface{}) Any { case reflect.Int64: return WrapInt64(val.(int64)) case reflect.Uint: + if strconv.IntSize == 32 { + return WrapUint32(uint32(val.(uint))) + } return WrapUint64(uint64(val.(uint))) + case reflect.Uintptr: + if ptrSize == 32 { + return WrapUint32(uint32(val.(uintptr))) + } + return WrapUint64(uint64(val.(uintptr))) case reflect.Uint8: return WrapUint32(uint32(val.(uint8))) case reflect.Uint16: @@ -243,3 +256,66 @@ func locatePath(iter *Iterator, path []interface{}) Any { } return iter.readAny() } + +var anyType = reflect2.TypeOfPtr((*Any)(nil)).Elem() + +func createDecoderOfAny(ctx *ctx, typ reflect2.Type) ValDecoder { + if typ == anyType { + return &directAnyCodec{} + } + if typ.Implements(anyType) { + return &anyCodec{ + valType: typ, + } + } + return nil +} + +func createEncoderOfAny(ctx *ctx, typ reflect2.Type) ValEncoder { + if typ == anyType { + return &directAnyCodec{} + } + if typ.Implements(anyType) { + return &anyCodec{ + valType: typ, + } + } + return nil +} + +type anyCodec struct { + valType reflect2.Type +} + +func (codec *anyCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { + panic("not implemented") +} + +func (codec *anyCodec) Encode(ptr unsafe.Pointer, stream *Stream) { + obj := codec.valType.UnsafeIndirect(ptr) + any := obj.(Any) + any.WriteTo(stream) +} + +func (codec *anyCodec) IsEmpty(ptr unsafe.Pointer) bool { + obj := codec.valType.UnsafeIndirect(ptr) + any := obj.(Any) + return any.Size() == 0 +} + +type directAnyCodec struct { +} + +func (codec *directAnyCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { + *(*Any)(ptr) = iter.readAny() +} + +func (codec *directAnyCodec) Encode(ptr unsafe.Pointer, stream *Stream) { + any := *(*Any)(ptr) + any.WriteTo(stream) +} + +func (codec *directAnyCodec) IsEmpty(ptr unsafe.Pointer) bool { + any := *(*Any)(ptr) + return any.Size() == 0 +} diff --git a/vendor/github.com/json-iterator/go/feature_any_array.go b/vendor/github.com/json-iterator/go/any_array.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_any_array.go rename to vendor/github.com/json-iterator/go/any_array.go diff --git a/vendor/github.com/json-iterator/go/feature_any_bool.go b/vendor/github.com/json-iterator/go/any_bool.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_any_bool.go rename to vendor/github.com/json-iterator/go/any_bool.go diff --git a/vendor/github.com/json-iterator/go/feature_any_float.go b/vendor/github.com/json-iterator/go/any_float.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_any_float.go rename to vendor/github.com/json-iterator/go/any_float.go diff --git a/vendor/github.com/json-iterator/go/feature_any_int32.go b/vendor/github.com/json-iterator/go/any_int32.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_any_int32.go rename to vendor/github.com/json-iterator/go/any_int32.go diff --git a/vendor/github.com/json-iterator/go/feature_any_int64.go b/vendor/github.com/json-iterator/go/any_int64.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_any_int64.go rename to vendor/github.com/json-iterator/go/any_int64.go diff --git a/vendor/github.com/json-iterator/go/feature_any_invalid.go b/vendor/github.com/json-iterator/go/any_invalid.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_any_invalid.go rename to vendor/github.com/json-iterator/go/any_invalid.go diff --git a/vendor/github.com/json-iterator/go/feature_any_nil.go b/vendor/github.com/json-iterator/go/any_nil.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_any_nil.go rename to vendor/github.com/json-iterator/go/any_nil.go diff --git a/vendor/github.com/json-iterator/go/feature_any_number.go b/vendor/github.com/json-iterator/go/any_number.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_any_number.go rename to vendor/github.com/json-iterator/go/any_number.go index bf8d02462..9d1e901a6 100644 --- a/vendor/github.com/json-iterator/go/feature_any_number.go +++ b/vendor/github.com/json-iterator/go/any_number.go @@ -1,8 +1,8 @@ package jsoniter import ( - "unsafe" "io" + "unsafe" ) type numberLazyAny struct { diff --git a/vendor/github.com/json-iterator/go/feature_any_object.go b/vendor/github.com/json-iterator/go/any_object.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_any_object.go rename to vendor/github.com/json-iterator/go/any_object.go diff --git a/vendor/github.com/json-iterator/go/feature_any_string.go b/vendor/github.com/json-iterator/go/any_str.go similarity index 97% rename from vendor/github.com/json-iterator/go/feature_any_string.go rename to vendor/github.com/json-iterator/go/any_str.go index abf060bd5..a4b93c78c 100644 --- a/vendor/github.com/json-iterator/go/feature_any_string.go +++ b/vendor/github.com/json-iterator/go/any_str.go @@ -14,7 +14,7 @@ func (any *stringAny) Get(path ...interface{}) Any { if len(path) == 0 { return any } - return &invalidAny{baseAny{}, fmt.Errorf("Get %v from simple value", path)} + return &invalidAny{baseAny{}, fmt.Errorf("GetIndex %v from simple value", path)} } func (any *stringAny) Parse() *Iterator { diff --git a/vendor/github.com/json-iterator/go/jsoniter_any_array_test.go b/vendor/github.com/json-iterator/go/any_tests/jsoniter_any_array_test.go similarity index 74% rename from vendor/github.com/json-iterator/go/jsoniter_any_array_test.go rename to vendor/github.com/json-iterator/go/any_tests/jsoniter_any_array_test.go index dbffd822d..a28bd8d38 100644 --- a/vendor/github.com/json-iterator/go/jsoniter_any_array_test.go +++ b/vendor/github.com/json-iterator/go/any_tests/jsoniter_any_array_test.go @@ -1,18 +1,19 @@ -package jsoniter +package any_tests import ( "testing" + "github.com/json-iterator/go" "github.com/stretchr/testify/require" ) func Test_read_empty_array_as_any(t *testing.T) { should := require.New(t) - any := Get([]byte("[]")) - should.Equal(ArrayValue, any.Get().ValueType()) - should.Equal(InvalidValue, any.Get(0.3).ValueType()) + any := jsoniter.Get([]byte("[]")) + should.Equal(jsoniter.ArrayValue, any.Get().ValueType()) + should.Equal(jsoniter.InvalidValue, any.Get(0.3).ValueType()) should.Equal(0, any.Size()) - should.Equal(ArrayValue, any.ValueType()) + should.Equal(jsoniter.ArrayValue, any.ValueType()) should.Nil(any.LastError()) should.Equal(0, any.ToInt()) should.Equal(int32(0), any.ToInt32()) @@ -26,19 +27,19 @@ func Test_read_empty_array_as_any(t *testing.T) { func Test_read_one_element_array_as_any(t *testing.T) { should := require.New(t) - any := Get([]byte("[1]")) + any := jsoniter.Get([]byte("[1]")) should.Equal(1, any.Size()) } func Test_read_two_element_array_as_any(t *testing.T) { should := require.New(t) - any := Get([]byte("[1,2]")) + any := jsoniter.Get([]byte("[1,2]")) should.Equal(1, any.Get(0).ToInt()) should.Equal(2, any.Size()) should.True(any.ToBool()) should.Equal(1, any.ToInt()) should.Equal([]interface{}{float64(1), float64(2)}, any.GetInterface()) - stream := NewStream(ConfigDefault, nil, 32) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, nil, 32) any.WriteTo(stream) should.Equal("[1,2]", string(stream.Buffer())) arr := []int{} @@ -48,8 +49,8 @@ func Test_read_two_element_array_as_any(t *testing.T) { func Test_wrap_array_and_convert_to_any(t *testing.T) { should := require.New(t) - any := Wrap([]int{1, 2, 3}) - any2 := Wrap([]int{}) + any := jsoniter.Wrap([]int{1, 2, 3}) + any2 := jsoniter.Wrap([]int{}) should.Equal("[1,2,3]", any.ToString()) should.True(any.ToBool()) @@ -80,43 +81,43 @@ func Test_wrap_array_and_convert_to_any(t *testing.T) { func Test_array_lazy_any_get(t *testing.T) { should := require.New(t) - any := Get([]byte("[1,[2,3],4]")) + any := jsoniter.Get([]byte("[1,[2,3],4]")) should.Equal(3, any.Get(1, 1).ToInt()) should.Equal("[1,[2,3],4]", any.ToString()) } func Test_array_lazy_any_get_all(t *testing.T) { should := require.New(t) - any := Get([]byte("[[1],[2],[3,4]]")) + any := jsoniter.Get([]byte("[[1],[2],[3,4]]")) should.Equal("[1,2,3]", any.Get('*', 0).ToString()) - any = Get([]byte("[[[1],[2],[3,4]]]"), 0, '*', 0) + any = jsoniter.Get([]byte("[[[1],[2],[3,4]]]"), 0, '*', 0) should.Equal("[1,2,3]", any.ToString()) } func Test_array_wrapper_any_get_all(t *testing.T) { should := require.New(t) - any := wrapArray([][]int{ + any := jsoniter.Wrap([][]int{ {1, 2}, {3, 4}, {5, 6}, }) should.Equal("[1,3,5]", any.Get('*', 0).ToString()) - should.Equal(ArrayValue, any.ValueType()) + should.Equal(jsoniter.ArrayValue, any.ValueType()) should.True(any.ToBool()) should.Equal(1, any.Get(0, 0).ToInt()) } func Test_array_lazy_any_get_invalid(t *testing.T) { should := require.New(t) - any := Get([]byte("[]")) - should.Equal(InvalidValue, any.Get(1, 1).ValueType()) + any := jsoniter.Get([]byte("[]")) + should.Equal(jsoniter.InvalidValue, any.Get(1, 1).ValueType()) should.NotNil(any.Get(1, 1).LastError()) - should.Equal(InvalidValue, any.Get("1").ValueType()) + should.Equal(jsoniter.InvalidValue, any.Get("1").ValueType()) should.NotNil(any.Get("1").LastError()) } func Test_invalid_array(t *testing.T) { should := require.New(t) - any := Get([]byte("["), 0) - should.Equal(InvalidValue, any.ValueType()) + any := jsoniter.Get([]byte("["), 0) + should.Equal(jsoniter.InvalidValue, any.ValueType()) } diff --git a/vendor/github.com/json-iterator/go/jsoniter_any_bool_test.go b/vendor/github.com/json-iterator/go/any_tests/jsoniter_any_bool_test.go similarity index 70% rename from vendor/github.com/json-iterator/go/jsoniter_any_bool_test.go rename to vendor/github.com/json-iterator/go/any_tests/jsoniter_any_bool_test.go index a71743a64..045671f28 100644 --- a/vendor/github.com/json-iterator/go/jsoniter_any_bool_test.go +++ b/vendor/github.com/json-iterator/go/any_tests/jsoniter_any_bool_test.go @@ -1,9 +1,10 @@ -package jsoniter +package any_tests import ( "fmt" "testing" + "github.com/json-iterator/go" "github.com/stretchr/testify/require" ) @@ -35,9 +36,9 @@ var boolConvertMap = map[string]bool{ func Test_read_bool_as_any(t *testing.T) { should := require.New(t) - var any Any + var any jsoniter.Any for k, v := range boolConvertMap { - any = Get([]byte(k)) + any = jsoniter.Get([]byte(k)) if v { should.True(any.ToBool(), fmt.Sprintf("origin val is %v", k)) } else { @@ -49,16 +50,16 @@ func Test_read_bool_as_any(t *testing.T) { func Test_write_bool_to_stream(t *testing.T) { should := require.New(t) - any := Get([]byte("true")) - stream := NewStream(ConfigDefault, nil, 32) + any := jsoniter.Get([]byte("true")) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, nil, 32) any.WriteTo(stream) should.Equal("true", string(stream.Buffer())) - should.Equal(any.ValueType(), BoolValue) + should.Equal(any.ValueType(), jsoniter.BoolValue) - any = Get([]byte("false")) - stream = NewStream(ConfigDefault, nil, 32) + any = jsoniter.Get([]byte("false")) + stream = jsoniter.NewStream(jsoniter.ConfigDefault, nil, 32) any.WriteTo(stream) should.Equal("false", string(stream.Buffer())) - should.Equal(any.ValueType(), BoolValue) + should.Equal(any.ValueType(), jsoniter.BoolValue) } diff --git a/vendor/github.com/json-iterator/go/jsoniter_any_float_test.go b/vendor/github.com/json-iterator/go/any_tests/jsoniter_any_float_test.go similarity index 88% rename from vendor/github.com/json-iterator/go/jsoniter_any_float_test.go rename to vendor/github.com/json-iterator/go/any_tests/jsoniter_any_float_test.go index 391ac32a8..4426e35af 100644 --- a/vendor/github.com/json-iterator/go/jsoniter_any_float_test.go +++ b/vendor/github.com/json-iterator/go/any_tests/jsoniter_any_float_test.go @@ -1,8 +1,9 @@ -package jsoniter +package any_tests import ( "testing" + "github.com/json-iterator/go" "github.com/stretchr/testify/require" ) @@ -67,22 +68,22 @@ var floatConvertMap = map[string]float64{ func Test_read_any_to_float(t *testing.T) { should := require.New(t) for k, v := range floatConvertMap { - any := Get([]byte(k)) + any := jsoniter.Get([]byte(k)) should.Equal(float64(v), any.ToFloat64(), "the original val is "+k) } for k, v := range floatConvertMap { - any := Get([]byte(k)) + any := jsoniter.Get([]byte(k)) should.Equal(float32(v), any.ToFloat32(), "the original val is "+k) } } func Test_read_float_to_any(t *testing.T) { should := require.New(t) - any := WrapFloat64(12.3) + any := jsoniter.WrapFloat64(12.3) anyFloat64 := float64(12.3) //negaAnyFloat64 := float64(-1.1) - any2 := WrapFloat64(-1.1) + any2 := jsoniter.WrapFloat64(-1.1) should.Equal(float64(12.3), any.ToFloat64()) //should.Equal("12.3", any.ToString()) should.True(any.ToBool()) @@ -96,7 +97,7 @@ func Test_read_float_to_any(t *testing.T) { should.Equal(uint(0), any2.ToUint()) should.Equal(uint32(0), any2.ToUint32()) should.Equal(uint64(0), any2.ToUint64()) - should.Equal(any.ValueType(), NumberValue) + should.Equal(any.ValueType(), jsoniter.NumberValue) should.Equal("1.23E+01", any.ToString()) } diff --git a/vendor/github.com/json-iterator/go/jsoniter_any_int_test.go b/vendor/github.com/json-iterator/go/any_tests/jsoniter_any_int_test.go similarity index 81% rename from vendor/github.com/json-iterator/go/jsoniter_any_int_test.go rename to vendor/github.com/json-iterator/go/any_tests/jsoniter_any_int_test.go index 232808528..c5a3d4260 100644 --- a/vendor/github.com/json-iterator/go/jsoniter_any_int_test.go +++ b/vendor/github.com/json-iterator/go/any_tests/jsoniter_any_int_test.go @@ -1,9 +1,10 @@ -package jsoniter +package any_tests import ( "fmt" "testing" + "github.com/json-iterator/go" "github.com/stretchr/testify/require" ) @@ -41,19 +42,19 @@ func Test_read_any_to_int(t *testing.T) { // int for k, v := range intConvertMap { - any := Get([]byte(k)) + any := jsoniter.Get([]byte(k)) should.Equal(v, any.ToInt(), fmt.Sprintf("origin val %v", k)) } // int32 for k, v := range intConvertMap { - any := Get([]byte(k)) + any := jsoniter.Get([]byte(k)) should.Equal(int32(v), any.ToInt32(), fmt.Sprintf("original val is %v", k)) } // int64 for k, v := range intConvertMap { - any := Get([]byte(k)) + any := jsoniter.Get([]byte(k)) should.Equal(int64(v), any.ToInt64(), fmt.Sprintf("original val is %v", k)) } @@ -94,17 +95,17 @@ func Test_read_any_to_uint(t *testing.T) { should := require.New(t) for k, v := range uintConvertMap { - any := Get([]byte(k)) + any := jsoniter.Get([]byte(k)) should.Equal(uint64(v), any.ToUint64(), fmt.Sprintf("origin val %v", k)) } for k, v := range uintConvertMap { - any := Get([]byte(k)) + any := jsoniter.Get([]byte(k)) should.Equal(uint32(v), any.ToUint32(), fmt.Sprintf("origin val %v", k)) } for k, v := range uintConvertMap { - any := Get([]byte(k)) + any := jsoniter.Get([]byte(k)) should.Equal(uint(v), any.ToUint(), fmt.Sprintf("origin val %v", k)) } @@ -112,7 +113,7 @@ func Test_read_any_to_uint(t *testing.T) { func Test_read_int64_to_any(t *testing.T) { should := require.New(t) - any := WrapInt64(12345) + any := jsoniter.WrapInt64(12345) should.Equal(12345, any.ToInt()) should.Equal(int32(12345), any.ToInt32()) should.Equal(int64(12345), any.ToInt64()) @@ -123,14 +124,14 @@ func Test_read_int64_to_any(t *testing.T) { should.Equal(float64(12345), any.ToFloat64()) should.Equal("12345", any.ToString()) should.Equal(true, any.ToBool()) - should.Equal(any.ValueType(), NumberValue) - stream := NewStream(ConfigDefault, nil, 32) + should.Equal(any.ValueType(), jsoniter.NumberValue) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, nil, 32) any.WriteTo(stream) should.Equal("12345", string(stream.Buffer())) } func Test_read_int32_to_any(t *testing.T) { should := require.New(t) - any := WrapInt32(12345) + any := jsoniter.WrapInt32(12345) should.Equal(12345, any.ToInt()) should.Equal(int32(12345), any.ToInt32()) should.Equal(int64(12345), any.ToInt64()) @@ -141,15 +142,15 @@ func Test_read_int32_to_any(t *testing.T) { should.Equal(float64(12345), any.ToFloat64()) should.Equal("12345", any.ToString()) should.Equal(true, any.ToBool()) - should.Equal(any.ValueType(), NumberValue) - stream := NewStream(ConfigDefault, nil, 32) + should.Equal(any.ValueType(), jsoniter.NumberValue) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, nil, 32) any.WriteTo(stream) should.Equal("12345", string(stream.Buffer())) } func Test_read_uint32_to_any(t *testing.T) { should := require.New(t) - any := WrapUint32(12345) + any := jsoniter.WrapUint32(12345) should.Equal(12345, any.ToInt()) should.Equal(int32(12345), any.ToInt32()) should.Equal(int64(12345), any.ToInt64()) @@ -160,15 +161,15 @@ func Test_read_uint32_to_any(t *testing.T) { should.Equal(float64(12345), any.ToFloat64()) should.Equal("12345", any.ToString()) should.Equal(true, any.ToBool()) - should.Equal(any.ValueType(), NumberValue) - stream := NewStream(ConfigDefault, nil, 32) + should.Equal(any.ValueType(), jsoniter.NumberValue) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, nil, 32) any.WriteTo(stream) should.Equal("12345", string(stream.Buffer())) } func Test_read_uint64_to_any(t *testing.T) { should := require.New(t) - any := WrapUint64(12345) + any := jsoniter.WrapUint64(12345) should.Equal(12345, any.ToInt()) should.Equal(int32(12345), any.ToInt32()) should.Equal(int64(12345), any.ToInt64()) @@ -179,19 +180,19 @@ func Test_read_uint64_to_any(t *testing.T) { should.Equal(float64(12345), any.ToFloat64()) should.Equal("12345", any.ToString()) should.Equal(true, any.ToBool()) - should.Equal(any.ValueType(), NumberValue) - stream := NewStream(ConfigDefault, nil, 32) + should.Equal(any.ValueType(), jsoniter.NumberValue) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, nil, 32) any.WriteTo(stream) should.Equal("12345", string(stream.Buffer())) - stream = NewStream(ConfigDefault, nil, 32) + stream = jsoniter.NewStream(jsoniter.ConfigDefault, nil, 32) stream.WriteUint(uint(123)) should.Equal("123", string(stream.Buffer())) } func Test_int_lazy_any_get(t *testing.T) { should := require.New(t) - any := Get([]byte("1234")) + any := jsoniter.Get([]byte("1234")) // panic!! //should.Equal(any.LastError(), io.EOF) - should.Equal(InvalidValue, any.Get(1, "2").ValueType()) + should.Equal(jsoniter.InvalidValue, any.Get(1, "2").ValueType()) } diff --git a/vendor/github.com/json-iterator/go/any_tests/jsoniter_any_map_test.go b/vendor/github.com/json-iterator/go/any_tests/jsoniter_any_map_test.go new file mode 100644 index 000000000..c5f2e6fea --- /dev/null +++ b/vendor/github.com/json-iterator/go/any_tests/jsoniter_any_map_test.go @@ -0,0 +1,28 @@ +package any_tests + +import ( + "github.com/json-iterator/go" + "github.com/stretchr/testify/require" + "testing" +) + +func Test_wrap_map(t *testing.T) { + should := require.New(t) + any := jsoniter.Wrap(map[string]string{"Field1": "hello"}) + should.Equal("hello", any.Get("Field1").ToString()) + any = jsoniter.Wrap(map[string]string{"Field1": "hello"}) + should.Equal(1, any.Size()) +} + +func Test_map_wrapper_any_get_all(t *testing.T) { + should := require.New(t) + any := jsoniter.Wrap(map[string][]int{"Field1": {1, 2}}) + should.Equal(`{"Field1":1}`, any.Get('*', 0).ToString()) + should.Contains(any.Keys(), "Field1") + + // map write to + stream := jsoniter.NewStream(jsoniter.ConfigDefault, nil, 0) + any.WriteTo(stream) + // TODO cannot pass + //should.Equal(string(stream.buf), "") +} diff --git a/vendor/github.com/json-iterator/go/jsoniter_any_null_test.go b/vendor/github.com/json-iterator/go/any_tests/jsoniter_any_null_test.go similarity index 75% rename from vendor/github.com/json-iterator/go/jsoniter_any_null_test.go rename to vendor/github.com/json-iterator/go/any_tests/jsoniter_any_null_test.go index eb09497b9..a86625e9a 100644 --- a/vendor/github.com/json-iterator/go/jsoniter_any_null_test.go +++ b/vendor/github.com/json-iterator/go/any_tests/jsoniter_any_null_test.go @@ -1,13 +1,14 @@ -package jsoniter +package any_tests import ( + "github.com/json-iterator/go" "github.com/stretchr/testify/require" "testing" ) func Test_read_null_as_any(t *testing.T) { should := require.New(t) - any := Get([]byte(`null`)) + any := jsoniter.Get([]byte(`null`)) should.Equal(0, any.ToInt()) should.Equal(float64(0), any.ToFloat64()) should.Equal("", any.ToString()) diff --git a/vendor/github.com/json-iterator/go/jsoniter_any_object_test.go b/vendor/github.com/json-iterator/go/any_tests/jsoniter_any_object_test.go similarity index 66% rename from vendor/github.com/json-iterator/go/jsoniter_any_object_test.go rename to vendor/github.com/json-iterator/go/any_tests/jsoniter_any_object_test.go index 9b215f95e..a36f6cae1 100644 --- a/vendor/github.com/json-iterator/go/jsoniter_any_object_test.go +++ b/vendor/github.com/json-iterator/go/any_tests/jsoniter_any_object_test.go @@ -1,26 +1,27 @@ -package jsoniter +package any_tests import ( "testing" + "github.com/json-iterator/go" "github.com/stretchr/testify/require" ) func Test_read_object_as_any(t *testing.T) { should := require.New(t) - any := Get([]byte(`{"a":"stream","c":"d"}`)) + any := jsoniter.Get([]byte(`{"a":"stream","c":"d"}`)) should.Equal(`{"a":"stream","c":"d"}`, any.ToString()) // partial parse should.Equal("stream", any.Get("a").ToString()) should.Equal("d", any.Get("c").ToString()) should.Equal(2, len(any.Keys())) - any = Get([]byte(`{"a":"stream","c":"d"}`)) + any = jsoniter.Get([]byte(`{"a":"stream","c":"d"}`)) // full parse should.Equal(2, len(any.Keys())) should.Equal(2, any.Size()) should.True(any.ToBool()) should.Equal(0, any.ToInt()) - should.Equal(ObjectValue, any.ValueType()) + should.Equal(jsoniter.ObjectValue, any.ValueType()) should.Nil(any.LastError()) obj := struct { A string @@ -31,26 +32,26 @@ func Test_read_object_as_any(t *testing.T) { func Test_object_lazy_any_get(t *testing.T) { should := require.New(t) - any := Get([]byte(`{"a":{"stream":{"c":"d"}}}`)) + any := jsoniter.Get([]byte(`{"a":{"stream":{"c":"d"}}}`)) should.Equal("d", any.Get("a", "stream", "c").ToString()) } func Test_object_lazy_any_get_all(t *testing.T) { should := require.New(t) - any := Get([]byte(`{"a":[0],"stream":[1]}`)) + any := jsoniter.Get([]byte(`{"a":[0],"stream":[1]}`)) should.Contains(any.Get('*', 0).ToString(), `"a":0`) } func Test_object_lazy_any_get_invalid(t *testing.T) { should := require.New(t) - any := Get([]byte(`{}`)) - should.Equal(InvalidValue, any.Get("a", "stream", "c").ValueType()) - should.Equal(InvalidValue, any.Get(1).ValueType()) + any := jsoniter.Get([]byte(`{}`)) + should.Equal(jsoniter.InvalidValue, any.Get("a", "stream", "c").ValueType()) + should.Equal(jsoniter.InvalidValue, any.Get(1).ValueType()) } func Test_wrap_map_and_convert_to_any(t *testing.T) { should := require.New(t) - any := Wrap(map[string]interface{}{"a": 1}) + any := jsoniter.Wrap(map[string]interface{}{"a": 1}) should.True(any.ToBool()) should.Equal(0, any.ToInt()) should.Equal(int32(0), any.ToInt32()) @@ -68,9 +69,9 @@ func Test_wrap_object_and_convert_to_any(t *testing.T) { Field1 string field2 string } - any := Wrap(TestObject{"hello", "world"}) + any := jsoniter.Wrap(TestObject{"hello", "world"}) should.Equal("hello", any.Get("Field1").ToString()) - any = Wrap(TestObject{"hello", "world"}) + any = jsoniter.Wrap(TestObject{"hello", "world"}) should.Equal(2, any.Size()) should.Equal(`{"Field1":"hello"}`, any.Get('*').ToString()) @@ -96,12 +97,27 @@ func Test_wrap_object_and_convert_to_any(t *testing.T) { func Test_any_within_struct(t *testing.T) { should := require.New(t) type TestObject struct { - Field1 Any - Field2 Any + Field1 jsoniter.Any + Field2 jsoniter.Any } obj := TestObject{} - err := UnmarshalFromString(`{"Field1": "hello", "Field2": [1,2,3]}`, &obj) + err := jsoniter.UnmarshalFromString(`{"Field1": "hello", "Field2": [1,2,3]}`, &obj) should.Nil(err) should.Equal("hello", obj.Field1.ToString()) should.Equal("[1,2,3]", obj.Field2.ToString()) } + +func Test_object_wrapper_any_get_all(t *testing.T) { + should := require.New(t) + type TestObject struct { + Field1 []int + Field2 []int + } + any := jsoniter.Wrap(TestObject{[]int{1, 2}, []int{3, 4}}) + should.Contains(any.Get('*', 0).ToString(), `"Field2":3`) + should.Contains(any.Keys(), "Field1") + should.Contains(any.Keys(), "Field2") + should.NotContains(any.Keys(), "Field3") + + //should.Contains(any.GetObject()["Field1"].GetArray()[0], 1) +} diff --git a/vendor/github.com/json-iterator/go/jsoniter_any_string_test.go b/vendor/github.com/json-iterator/go/any_tests/jsoniter_any_string_test.go similarity index 79% rename from vendor/github.com/json-iterator/go/jsoniter_any_string_test.go rename to vendor/github.com/json-iterator/go/any_tests/jsoniter_any_string_test.go index 7c66b8b94..3cd324689 100644 --- a/vendor/github.com/json-iterator/go/jsoniter_any_string_test.go +++ b/vendor/github.com/json-iterator/go/any_tests/jsoniter_any_string_test.go @@ -1,8 +1,9 @@ -package jsoniter +package any_tests import ( "testing" + "github.com/json-iterator/go" "github.com/stretchr/testify/require" ) @@ -31,27 +32,27 @@ var stringConvertMap = map[string]string{ func Test_read_any_to_string(t *testing.T) { should := require.New(t) for k, v := range stringConvertMap { - any := Get([]byte(k)) + any := jsoniter.Get([]byte(k)) should.Equal(v, any.ToString(), "original val "+k) } } func Test_read_string_as_any(t *testing.T) { should := require.New(t) - any := Get([]byte(`"hello"`)) + any := jsoniter.Get([]byte(`"hello"`)) should.Equal("hello", any.ToString()) should.True(any.ToBool()) - any = Get([]byte(`" "`)) + any = jsoniter.Get([]byte(`" "`)) should.False(any.ToBool()) - any = Get([]byte(`"false"`)) + any = jsoniter.Get([]byte(`"false"`)) should.True(any.ToBool()) - any = Get([]byte(`"123"`)) + any = jsoniter.Get([]byte(`"123"`)) should.Equal(123, any.ToInt()) } func Test_wrap_string(t *testing.T) { should := require.New(t) - any := Get([]byte("-32000")).MustBeValid() + any := jsoniter.Get([]byte("-32000")).MustBeValid() should.Equal(-32000, any.ToInt()) should.NoError(any.LastError()) } diff --git a/vendor/github.com/json-iterator/go/jsoniter_must_be_valid_test.go b/vendor/github.com/json-iterator/go/any_tests/jsoniter_must_be_valid_test.go similarity index 63% rename from vendor/github.com/json-iterator/go/jsoniter_must_be_valid_test.go rename to vendor/github.com/json-iterator/go/any_tests/jsoniter_must_be_valid_test.go index 01a91c90f..8974eb7f7 100644 --- a/vendor/github.com/json-iterator/go/jsoniter_must_be_valid_test.go +++ b/vendor/github.com/json-iterator/go/any_tests/jsoniter_must_be_valid_test.go @@ -1,71 +1,72 @@ -package jsoniter +package any_tests import ( "testing" + "github.com/json-iterator/go" "github.com/stretchr/testify/require" ) // if must be valid is useless, just drop this test func Test_must_be_valid(t *testing.T) { should := require.New(t) - any := Get([]byte("123")) + any := jsoniter.Get([]byte("123")) should.Equal(any.MustBeValid().ToInt(), 123) - any = Wrap(int8(10)) + any = jsoniter.Wrap(int8(10)) should.Equal(any.MustBeValid().ToInt(), 10) - any = Wrap(int16(10)) + any = jsoniter.Wrap(int16(10)) should.Equal(any.MustBeValid().ToInt(), 10) - any = Wrap(int32(10)) + any = jsoniter.Wrap(int32(10)) should.Equal(any.MustBeValid().ToInt(), 10) - any = Wrap(int64(10)) + any = jsoniter.Wrap(int64(10)) should.Equal(any.MustBeValid().ToInt(), 10) - any = Wrap(uint(10)) + any = jsoniter.Wrap(uint(10)) should.Equal(any.MustBeValid().ToInt(), 10) - any = Wrap(uint8(10)) + any = jsoniter.Wrap(uint8(10)) should.Equal(any.MustBeValid().ToInt(), 10) - any = Wrap(uint16(10)) + any = jsoniter.Wrap(uint16(10)) should.Equal(any.MustBeValid().ToInt(), 10) - any = Wrap(uint32(10)) + any = jsoniter.Wrap(uint32(10)) should.Equal(any.MustBeValid().ToInt(), 10) - any = Wrap(uint64(10)) + any = jsoniter.Wrap(uint64(10)) should.Equal(any.MustBeValid().ToInt(), 10) - any = Wrap(float32(10)) + any = jsoniter.Wrap(float32(10)) should.Equal(any.MustBeValid().ToFloat64(), float64(10)) - any = Wrap(float64(10)) + any = jsoniter.Wrap(float64(10)) should.Equal(any.MustBeValid().ToFloat64(), float64(10)) - any = Wrap(true) + any = jsoniter.Wrap(true) should.Equal(any.MustBeValid().ToFloat64(), float64(1)) - any = Wrap(false) + any = jsoniter.Wrap(false) should.Equal(any.MustBeValid().ToFloat64(), float64(0)) - any = Wrap(nil) + any = jsoniter.Wrap(nil) should.Equal(any.MustBeValid().ToFloat64(), float64(0)) - any = Wrap(struct{ age int }{age: 1}) + any = jsoniter.Wrap(struct{ age int }{age: 1}) should.Equal(any.MustBeValid().ToFloat64(), float64(0)) - any = Wrap(map[string]interface{}{"abc": 1}) + any = jsoniter.Wrap(map[string]interface{}{"abc": 1}) should.Equal(any.MustBeValid().ToFloat64(), float64(0)) - any = Wrap("abc") + any = jsoniter.Wrap("abc") should.Equal(any.MustBeValid().ToFloat64(), float64(0)) - any = Wrap([]int{}) + any = jsoniter.Wrap([]int{}) should.Equal(any.MustBeValid().ToFloat64(), float64(0)) - any = Wrap([]int{1, 2}) + any = jsoniter.Wrap([]int{1, 2}) should.Equal(any.MustBeValid().ToFloat64(), float64(1)) } diff --git a/vendor/github.com/json-iterator/go/jsoniter_wrap_test.go b/vendor/github.com/json-iterator/go/any_tests/jsoniter_wrap_test.go similarity index 55% rename from vendor/github.com/json-iterator/go/jsoniter_wrap_test.go rename to vendor/github.com/json-iterator/go/any_tests/jsoniter_wrap_test.go index b300fb591..480985ffa 100644 --- a/vendor/github.com/json-iterator/go/jsoniter_wrap_test.go +++ b/vendor/github.com/json-iterator/go/any_tests/jsoniter_wrap_test.go @@ -1,116 +1,117 @@ -package jsoniter +package any_tests import ( "testing" + "github.com/json-iterator/go" "github.com/stretchr/testify/require" ) func Test_wrap_and_valuetype_everything(t *testing.T) { should := require.New(t) var i interface{} - any := Get([]byte("123")) + any := jsoniter.Get([]byte("123")) // default of number type is float64 i = float64(123) should.Equal(i, any.GetInterface()) - any = Wrap(int8(10)) - should.Equal(any.ValueType(), NumberValue) + any = jsoniter.Wrap(int8(10)) + should.Equal(any.ValueType(), jsoniter.NumberValue) should.Equal(any.LastError(), nil) // get interface is not int8 interface // i = int8(10) // should.Equal(i, any.GetInterface()) - any = Wrap(int16(10)) - should.Equal(any.ValueType(), NumberValue) + any = jsoniter.Wrap(int16(10)) + should.Equal(any.ValueType(), jsoniter.NumberValue) should.Equal(any.LastError(), nil) //i = int16(10) //should.Equal(i, any.GetInterface()) - any = Wrap(int32(10)) - should.Equal(any.ValueType(), NumberValue) + any = jsoniter.Wrap(int32(10)) + should.Equal(any.ValueType(), jsoniter.NumberValue) should.Equal(any.LastError(), nil) i = int32(10) should.Equal(i, any.GetInterface()) - any = Wrap(int64(10)) - should.Equal(any.ValueType(), NumberValue) + any = jsoniter.Wrap(int64(10)) + should.Equal(any.ValueType(), jsoniter.NumberValue) should.Equal(any.LastError(), nil) i = int64(10) should.Equal(i, any.GetInterface()) - any = Wrap(uint(10)) - should.Equal(any.ValueType(), NumberValue) + any = jsoniter.Wrap(uint(10)) + should.Equal(any.ValueType(), jsoniter.NumberValue) should.Equal(any.LastError(), nil) // not equal //i = uint(10) //should.Equal(i, any.GetInterface()) - any = Wrap(uint8(10)) - should.Equal(any.ValueType(), NumberValue) + any = jsoniter.Wrap(uint8(10)) + should.Equal(any.ValueType(), jsoniter.NumberValue) should.Equal(any.LastError(), nil) // not equal // i = uint8(10) // should.Equal(i, any.GetInterface()) - any = Wrap(uint16(10)) - should.Equal(any.ValueType(), NumberValue) + any = jsoniter.Wrap(uint16(10)) + should.Equal(any.ValueType(), jsoniter.NumberValue) should.Equal(any.LastError(), nil) - any = Wrap(uint32(10)) - should.Equal(any.ValueType(), NumberValue) + any = jsoniter.Wrap(uint32(10)) + should.Equal(any.ValueType(), jsoniter.NumberValue) should.Equal(any.LastError(), nil) i = uint32(10) should.Equal(i, any.GetInterface()) - any = Wrap(uint64(10)) - should.Equal(any.ValueType(), NumberValue) + any = jsoniter.Wrap(uint64(10)) + should.Equal(any.ValueType(), jsoniter.NumberValue) should.Equal(any.LastError(), nil) i = uint64(10) should.Equal(i, any.GetInterface()) - any = Wrap(float32(10)) - should.Equal(any.ValueType(), NumberValue) + any = jsoniter.Wrap(float32(10)) + should.Equal(any.ValueType(), jsoniter.NumberValue) should.Equal(any.LastError(), nil) // not equal //i = float32(10) //should.Equal(i, any.GetInterface()) - any = Wrap(float64(10)) - should.Equal(any.ValueType(), NumberValue) + any = jsoniter.Wrap(float64(10)) + should.Equal(any.ValueType(), jsoniter.NumberValue) should.Equal(any.LastError(), nil) i = float64(10) should.Equal(i, any.GetInterface()) - any = Wrap(true) - should.Equal(any.ValueType(), BoolValue) + any = jsoniter.Wrap(true) + should.Equal(any.ValueType(), jsoniter.BoolValue) should.Equal(any.LastError(), nil) i = true should.Equal(i, any.GetInterface()) - any = Wrap(false) - should.Equal(any.ValueType(), BoolValue) + any = jsoniter.Wrap(false) + should.Equal(any.ValueType(), jsoniter.BoolValue) should.Equal(any.LastError(), nil) i = false should.Equal(i, any.GetInterface()) - any = Wrap(nil) - should.Equal(any.ValueType(), NilValue) + any = jsoniter.Wrap(nil) + should.Equal(any.ValueType(), jsoniter.NilValue) should.Equal(any.LastError(), nil) i = nil should.Equal(i, any.GetInterface()) - stream := NewStream(ConfigDefault, nil, 32) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, nil, 32) any.WriteTo(stream) should.Equal("null", string(stream.Buffer())) should.Equal(any.LastError(), nil) - any = Wrap(struct{ age int }{age: 1}) - should.Equal(any.ValueType(), ObjectValue) + any = jsoniter.Wrap(struct{ age int }{age: 1}) + should.Equal(any.ValueType(), jsoniter.ObjectValue) should.Equal(any.LastError(), nil) i = struct{ age int }{age: 1} should.Equal(i, any.GetInterface()) - any = Wrap(map[string]interface{}{"abc": 1}) - should.Equal(any.ValueType(), ObjectValue) + any = jsoniter.Wrap(map[string]interface{}{"abc": 1}) + should.Equal(any.ValueType(), jsoniter.ObjectValue) should.Equal(any.LastError(), nil) i = map[string]interface{}{"abc": 1} should.Equal(i, any.GetInterface()) - any = Wrap("abc") + any = jsoniter.Wrap("abc") i = "abc" should.Equal(i, any.GetInterface()) should.Equal(nil, any.LastError()) diff --git a/vendor/github.com/json-iterator/go/feature_any_uint32.go b/vendor/github.com/json-iterator/go/any_uint32.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_any_uint32.go rename to vendor/github.com/json-iterator/go/any_uint32.go diff --git a/vendor/github.com/json-iterator/go/feature_any_uint64.go b/vendor/github.com/json-iterator/go/any_uint64.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_any_uint64.go rename to vendor/github.com/json-iterator/go/any_uint64.go diff --git a/vendor/github.com/json-iterator/go/api_tests/config_test.go b/vendor/github.com/json-iterator/go/api_tests/config_test.go new file mode 100644 index 000000000..d3e93e5c6 --- /dev/null +++ b/vendor/github.com/json-iterator/go/api_tests/config_test.go @@ -0,0 +1,47 @@ +package test + +import ( + "encoding/json" + "github.com/json-iterator/go" + "github.com/stretchr/testify/require" + "testing" +) + +func Test_use_number_for_unmarshal(t *testing.T) { + should := require.New(t) + api := jsoniter.Config{UseNumber: true}.Froze() + var obj interface{} + should.Nil(api.UnmarshalFromString("123", &obj)) + should.Equal(json.Number("123"), obj) +} + +func Test_customize_float_marshal(t *testing.T) { + should := require.New(t) + json := jsoniter.Config{MarshalFloatWith6Digits: true}.Froze() + str, err := json.MarshalToString(float32(1.23456789)) + should.Nil(err) + should.Equal("1.234568", str) +} + +func Test_customize_tag_key(t *testing.T) { + + type TestObject struct { + Field string `orm:"field"` + } + + should := require.New(t) + json := jsoniter.Config{TagKey: "orm"}.Froze() + str, err := json.MarshalToString(TestObject{"hello"}) + should.Nil(err) + should.Equal(`{"field":"hello"}`, str) +} + +func Test_read_large_number_as_interface(t *testing.T) { + should := require.New(t) + var val interface{} + err := jsoniter.Config{UseNumber: true}.Froze().UnmarshalFromString(`123456789123456789123456789`, &val) + should.Nil(err) + output, err := jsoniter.MarshalToString(val) + should.Nil(err) + should.Equal(`123456789123456789123456789`, output) +} diff --git a/vendor/github.com/json-iterator/go/api_tests/decoder_test.go b/vendor/github.com/json-iterator/go/api_tests/decoder_test.go new file mode 100644 index 000000000..eecfddbc8 --- /dev/null +++ b/vendor/github.com/json-iterator/go/api_tests/decoder_test.go @@ -0,0 +1,58 @@ +package test + +import ( + "bytes" + "encoding/json" + "github.com/json-iterator/go" + "github.com/stretchr/testify/require" + "io/ioutil" + "testing" +) + +func Test_disallowUnknownFields(t *testing.T) { + should := require.New(t) + type TestObject struct{} + var obj TestObject + decoder := jsoniter.NewDecoder(bytes.NewBufferString(`{"field1":100}`)) + decoder.DisallowUnknownFields() + should.Error(decoder.Decode(&obj)) +} + +func Test_new_decoder(t *testing.T) { + should := require.New(t) + decoder1 := json.NewDecoder(bytes.NewBufferString(`[1][2]`)) + decoder2 := jsoniter.NewDecoder(bytes.NewBufferString(`[1][2]`)) + arr1 := []int{} + should.Nil(decoder1.Decode(&arr1)) + should.Equal([]int{1}, arr1) + arr2 := []int{} + should.True(decoder1.More()) + buffered, _ := ioutil.ReadAll(decoder1.Buffered()) + should.Equal("[2]", string(buffered)) + should.Nil(decoder2.Decode(&arr2)) + should.Equal([]int{1}, arr2) + should.True(decoder2.More()) + buffered, _ = ioutil.ReadAll(decoder2.Buffered()) + should.Equal("[2]", string(buffered)) + + should.Nil(decoder1.Decode(&arr1)) + should.Equal([]int{2}, arr1) + should.False(decoder1.More()) + should.Nil(decoder2.Decode(&arr2)) + should.Equal([]int{2}, arr2) + should.False(decoder2.More()) +} + +func Test_use_number(t *testing.T) { + should := require.New(t) + decoder1 := json.NewDecoder(bytes.NewBufferString(`123`)) + decoder1.UseNumber() + decoder2 := jsoniter.NewDecoder(bytes.NewBufferString(`123`)) + decoder2.UseNumber() + var obj1 interface{} + should.Nil(decoder1.Decode(&obj1)) + should.Equal(json.Number("123"), obj1) + var obj2 interface{} + should.Nil(decoder2.Decode(&obj2)) + should.Equal(json.Number("123"), obj2) +} diff --git a/vendor/github.com/json-iterator/go/jsoniter_1dot8_only_test.go b/vendor/github.com/json-iterator/go/api_tests/encoder_18_test.go similarity index 86% rename from vendor/github.com/json-iterator/go/jsoniter_1dot8_only_test.go rename to vendor/github.com/json-iterator/go/api_tests/encoder_18_test.go index 1ac618653..3c159b58d 100644 --- a/vendor/github.com/json-iterator/go/jsoniter_1dot8_only_test.go +++ b/vendor/github.com/json-iterator/go/api_tests/encoder_18_test.go @@ -1,6 +1,6 @@ -// +build go1.8 +//+build go1.8 -package jsoniter +package test import ( "bytes" @@ -8,6 +8,7 @@ import ( "testing" "unicode/utf8" + "github.com/json-iterator/go" "github.com/stretchr/testify/require" ) @@ -19,14 +20,14 @@ func Test_new_encoder(t *testing.T) { encoder1.Encode([]int{1}) should.Equal("[1]\n", buf1.String()) buf2 := &bytes.Buffer{} - encoder2 := NewEncoder(buf2) + encoder2 := jsoniter.NewEncoder(buf2) encoder2.SetEscapeHTML(false) encoder2.Encode([]int{1}) should.Equal("[1]\n", buf2.String()) } func Test_string_encode_with_std_without_html_escape(t *testing.T) { - api := Config{EscapeHTML: false}.Froze() + api := jsoniter.Config{EscapeHTML: false}.Froze() should := require.New(t) for i := 0; i < utf8.RuneSelf; i++ { input := string([]byte{byte(i)}) diff --git a/vendor/github.com/json-iterator/go/api_tests/encoder_test.go b/vendor/github.com/json-iterator/go/api_tests/encoder_test.go new file mode 100644 index 000000000..7b9202cf0 --- /dev/null +++ b/vendor/github.com/json-iterator/go/api_tests/encoder_test.go @@ -0,0 +1,20 @@ +package test + +import ( + "bytes" + "encoding/json" + "github.com/json-iterator/go" + "github.com/stretchr/testify/require" + "testing" +) + +// Standard Encoder has trailing newline. +func TestEncoderHasTrailingNewline(t *testing.T) { + should := require.New(t) + var buf, stdbuf bytes.Buffer + enc := jsoniter.ConfigCompatibleWithStandardLibrary.NewEncoder(&buf) + enc.Encode(1) + stdenc := json.NewEncoder(&stdbuf) + stdenc.Encode(1) + should.Equal(stdbuf.Bytes(), buf.Bytes()) +} diff --git a/vendor/github.com/json-iterator/go/api_tests/marshal_indent_test.go b/vendor/github.com/json-iterator/go/api_tests/marshal_indent_test.go new file mode 100644 index 000000000..926931a80 --- /dev/null +++ b/vendor/github.com/json-iterator/go/api_tests/marshal_indent_test.go @@ -0,0 +1,36 @@ +package test + +import ( + "encoding/json" + "github.com/json-iterator/go" + "github.com/stretchr/testify/require" + "testing" +) + +func Test_marshal_indent(t *testing.T) { + should := require.New(t) + obj := struct { + F1 int + F2 []int + }{1, []int{2, 3, 4}} + output, err := json.MarshalIndent(obj, "", " ") + should.Nil(err) + should.Equal("{\n \"F1\": 1,\n \"F2\": [\n 2,\n 3,\n 4\n ]\n}", string(output)) + output, err = jsoniter.MarshalIndent(obj, "", " ") + should.Nil(err) + should.Equal("{\n \"F1\": 1,\n \"F2\": [\n 2,\n 3,\n 4\n ]\n}", string(output)) +} + +func Test_marshal_indent_map(t *testing.T) { + should := require.New(t) + obj := map[int]int{1: 2} + output, err := json.MarshalIndent(obj, "", " ") + should.Nil(err) + should.Equal("{\n \"1\": 2\n}", string(output)) + output, err = jsoniter.MarshalIndent(obj, "", " ") + should.Nil(err) + should.Equal("{\n \"1\": 2\n}", string(output)) + output, err = jsoniter.ConfigCompatibleWithStandardLibrary.MarshalIndent(obj, "", " ") + should.Nil(err) + should.Equal("{\n \"1\": 2\n}", string(output)) +} diff --git a/vendor/github.com/json-iterator/go/benchmarks/encode_string_test.go b/vendor/github.com/json-iterator/go/benchmarks/encode_string_test.go new file mode 100644 index 000000000..c1cb1afb0 --- /dev/null +++ b/vendor/github.com/json-iterator/go/benchmarks/encode_string_test.go @@ -0,0 +1,25 @@ +package test + +import ( + "bytes" + "github.com/json-iterator/go" + "testing" +) + +func Benchmark_encode_string_with_SetEscapeHTML(b *testing.B) { + type V struct { + S string + B bool + I int + } + var json = jsoniter.ConfigCompatibleWithStandardLibrary + b.ReportAllocs() + for i := 0; i < b.N; i++ { + buf := &bytes.Buffer{} + enc := json.NewEncoder(buf) + enc.SetEscapeHTML(true) + if err := enc.Encode(V{S: "s", B: true, I: 233}); err != nil { + b.Fatal(err) + } + } +} diff --git a/vendor/github.com/json-iterator/go/jsoniter_large_file_test.go b/vendor/github.com/json-iterator/go/benchmarks/jsoniter_large_file_test.go similarity index 95% rename from vendor/github.com/json-iterator/go/jsoniter_large_file_test.go rename to vendor/github.com/json-iterator/go/benchmarks/jsoniter_large_file_test.go index 29eb58b16..465eaec91 100644 --- a/vendor/github.com/json-iterator/go/jsoniter_large_file_test.go +++ b/vendor/github.com/json-iterator/go/benchmarks/jsoniter_large_file_test.go @@ -1,7 +1,8 @@ -package jsoniter +package test import ( "encoding/json" + "github.com/json-iterator/go" "io/ioutil" "os" "testing" @@ -127,9 +128,9 @@ func Benchmark_jsoniter_large_file(b *testing.B) { b.ReportAllocs() for n := 0; n < b.N; n++ { file, _ := os.Open("/tmp/large-file.json") - iter := Parse(ConfigDefault, file, 4096) + iter := jsoniter.Parse(jsoniter.ConfigDefault, file, 4096) count := 0 - iter.ReadArrayCB(func(iter *Iterator) bool { + iter.ReadArrayCB(func(iter *jsoniter.Iterator) bool { // Skip() is strict by default, use --tags jsoniter-sloppy to skip without validation iter.Skip() count++ diff --git a/vendor/github.com/json-iterator/go/compatible_test.go b/vendor/github.com/json-iterator/go/compatible_test.go deleted file mode 100644 index 4b725c536..000000000 --- a/vendor/github.com/json-iterator/go/compatible_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package jsoniter - -import ( - "bytes" - "encoding/json" - "testing" - - "github.com/stretchr/testify/require" -) - -// Standard Encoder has trailing newline. -func TestEncoderHasTrailingNewline(t *testing.T) { - should := require.New(t) - var buf, stdbuf bytes.Buffer - enc := ConfigCompatibleWithStandardLibrary.NewEncoder(&buf) - enc.Encode(1) - stdenc := json.NewEncoder(&stdbuf) - stdenc.Encode(1) - should.Equal(stdbuf.Bytes(), buf.Bytes()) -} - -// Non-nil but empty map should be ignored. -func TestOmitempty(t *testing.T) { - o := struct { - A string `json:"a,omitempty"` - B string `json:"b,omitempty"` - Annotations map[string]string `json:"annotations,omitempty"` - }{ - A: "a", - B: "b", - Annotations: map[string]string{}, - } - should := require.New(t) - var buf, stdbuf bytes.Buffer - enc := ConfigCompatibleWithStandardLibrary.NewEncoder(&buf) - enc.Encode(o) - stdenc := json.NewEncoder(&stdbuf) - stdenc.Encode(o) - should.Equal(string(stdbuf.Bytes()), string(buf.Bytes())) -} diff --git a/vendor/github.com/json-iterator/go/feature_config.go b/vendor/github.com/json-iterator/go/config.go similarity index 61% rename from vendor/github.com/json-iterator/go/feature_config.go rename to vendor/github.com/json-iterator/go/config.go index 2d2fc8cd0..b69cdbfc3 100644 --- a/vendor/github.com/json-iterator/go/feature_config.go +++ b/vendor/github.com/json-iterator/go/config.go @@ -2,10 +2,11 @@ package jsoniter import ( "encoding/json" - "errors" + "github.com/modern-go/reflect2" "io" - "reflect" + "sync" "unsafe" + "github.com/modern-go/concurrent" ) // Config customize how the API should behave. @@ -16,6 +17,7 @@ type Config struct { EscapeHTML bool SortMapKeys bool UseNumber bool + DisallowUnknownFields bool TagKey string OnlyTaggedField bool ValidateJsonRawMessage bool @@ -58,35 +60,119 @@ var ConfigFastest = Config{ ObjectFieldMustBeSimpleString: true, // do not unescape object field }.Froze() + +type frozenConfig struct { + configBeforeFrozen Config + sortMapKeys bool + indentionStep int + objectFieldMustBeSimpleString bool + onlyTaggedField bool + disallowUnknownFields bool + decoderCache *concurrent.Map + encoderCache *concurrent.Map + extensions []Extension + streamPool *sync.Pool + iteratorPool *sync.Pool +} + +func (cfg *frozenConfig) initCache() { + cfg.decoderCache = concurrent.NewMap() + cfg.encoderCache = concurrent.NewMap() +} + +func (cfg *frozenConfig) addDecoderToCache(cacheKey uintptr, decoder ValDecoder) { + cfg.decoderCache.Store(cacheKey, decoder) +} + +func (cfg *frozenConfig) addEncoderToCache(cacheKey uintptr, encoder ValEncoder) { + cfg.encoderCache.Store(cacheKey, encoder) +} + +func (cfg *frozenConfig) getDecoderFromCache(cacheKey uintptr) ValDecoder { + decoder, found := cfg.decoderCache.Load(cacheKey) + if found { + return decoder.(ValDecoder) + } + return nil +} + +func (cfg *frozenConfig) getEncoderFromCache(cacheKey uintptr) ValEncoder { + encoder, found := cfg.encoderCache.Load(cacheKey) + if found { + return encoder.(ValEncoder) + } + return nil +} + +var cfgCache = &sync.Map{} + +func getFrozenConfigFromCache(cfg Config) *frozenConfig { + obj, found := cfgCache.Load(cfg) + if found { + return obj.(*frozenConfig) + } + return nil +} + +func addFrozenConfigToCache(cfg Config, frozenConfig *frozenConfig) { + cfgCache.Store(cfg, frozenConfig) +} + // Froze forge API from config func (cfg Config) Froze() API { - // TODO: cache frozen config - frozenConfig := &frozenConfig{ + api := &frozenConfig{ sortMapKeys: cfg.SortMapKeys, indentionStep: cfg.IndentionStep, objectFieldMustBeSimpleString: cfg.ObjectFieldMustBeSimpleString, onlyTaggedField: cfg.OnlyTaggedField, - streamPool: make(chan *Stream, 16), - iteratorPool: make(chan *Iterator, 16), + disallowUnknownFields: cfg.DisallowUnknownFields, } - frozenConfig.initCache() + api.streamPool = &sync.Pool{ + New: func() interface{} { + return NewStream(api, nil, 512) + }, + } + api.iteratorPool = &sync.Pool{ + New: func() interface{} { + return NewIterator(api) + }, + } + api.initCache() + encoderExtension := EncoderExtension{} + decoderExtension := DecoderExtension{} if cfg.MarshalFloatWith6Digits { - frozenConfig.marshalFloatWith6Digits() + api.marshalFloatWith6Digits(encoderExtension) } if cfg.EscapeHTML { - frozenConfig.escapeHTML() + api.escapeHTML(encoderExtension) } if cfg.UseNumber { - frozenConfig.useNumber() + api.useNumber(decoderExtension) } if cfg.ValidateJsonRawMessage { - frozenConfig.validateJsonRawMessage() + api.validateJsonRawMessage(encoderExtension) + } + if len(encoderExtension) > 0 { + api.extensions = append(api.extensions, encoderExtension) } - frozenConfig.configBeforeFrozen = cfg - return frozenConfig + if len(decoderExtension) > 0 { + api.extensions = append(api.extensions, decoderExtension) + } + api.configBeforeFrozen = cfg + return api } -func (cfg *frozenConfig) validateJsonRawMessage() { +func (cfg Config) frozeWithCacheReuse() *frozenConfig { + api := getFrozenConfigFromCache(cfg) + if api != nil { + return api + } + api = cfg.Froze().(*frozenConfig) + addFrozenConfigToCache(cfg, api) + return api +} + +func (cfg *frozenConfig) validateJsonRawMessage(extension EncoderExtension) { encoder := &funcEncoder{func(ptr unsafe.Pointer, stream *Stream) { rawMessage := *(*json.RawMessage)(ptr) iter := cfg.BorrowIterator([]byte(rawMessage)) @@ -100,18 +186,18 @@ func (cfg *frozenConfig) validateJsonRawMessage() { }, func(ptr unsafe.Pointer) bool { return false }} - cfg.addEncoderToCache(reflect.TypeOf((*json.RawMessage)(nil)).Elem(), encoder) - cfg.addEncoderToCache(reflect.TypeOf((*RawMessage)(nil)).Elem(), encoder) + extension[reflect2.TypeOfPtr((*json.RawMessage)(nil)).Elem()] = encoder + extension[reflect2.TypeOfPtr((*RawMessage)(nil)).Elem()] = encoder } -func (cfg *frozenConfig) useNumber() { - cfg.addDecoderToCache(reflect.TypeOf((*interface{})(nil)).Elem(), &funcDecoder{func(ptr unsafe.Pointer, iter *Iterator) { +func (cfg *frozenConfig) useNumber(extension DecoderExtension) { + extension[reflect2.TypeOfPtr((*interface{})(nil)).Elem()] = &funcDecoder{func(ptr unsafe.Pointer, iter *Iterator) { if iter.WhatIsNext() == NumberValue { *((*interface{})(ptr)) = json.Number(iter.readNumberAsString()) } else { *((*interface{})(ptr)) = iter.Read() } - }}) + }} } func (cfg *frozenConfig) getTagKey() string { tagKey := cfg.configBeforeFrozen.TagKey @@ -132,10 +218,6 @@ func (encoder *lossyFloat32Encoder) Encode(ptr unsafe.Pointer, stream *Stream) { stream.WriteFloat32Lossy(*((*float32)(ptr))) } -func (encoder *lossyFloat32Encoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - func (encoder *lossyFloat32Encoder) IsEmpty(ptr unsafe.Pointer) bool { return *((*float32)(ptr)) == 0 } @@ -147,20 +229,16 @@ func (encoder *lossyFloat64Encoder) Encode(ptr unsafe.Pointer, stream *Stream) { stream.WriteFloat64Lossy(*((*float64)(ptr))) } -func (encoder *lossyFloat64Encoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - func (encoder *lossyFloat64Encoder) IsEmpty(ptr unsafe.Pointer) bool { return *((*float64)(ptr)) == 0 } // EnableLossyFloatMarshalling keeps 10**(-6) precision // for float variables for better performance. -func (cfg *frozenConfig) marshalFloatWith6Digits() { +func (cfg *frozenConfig) marshalFloatWith6Digits(extension EncoderExtension) { // for better performance - cfg.addEncoderToCache(reflect.TypeOf((*float32)(nil)).Elem(), &lossyFloat32Encoder{}) - cfg.addEncoderToCache(reflect.TypeOf((*float64)(nil)).Elem(), &lossyFloat64Encoder{}) + extension[reflect2.TypeOfPtr((*float32)(nil)).Elem()] = &lossyFloat32Encoder{} + extension[reflect2.TypeOfPtr((*float64)(nil)).Elem()] = &lossyFloat64Encoder{} } type htmlEscapedStringEncoder struct { @@ -171,16 +249,12 @@ func (encoder *htmlEscapedStringEncoder) Encode(ptr unsafe.Pointer, stream *Stre stream.WriteStringWithHTMLEscaped(str) } -func (encoder *htmlEscapedStringEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - func (encoder *htmlEscapedStringEncoder) IsEmpty(ptr unsafe.Pointer) bool { return *((*string)(ptr)) == "" } -func (cfg *frozenConfig) escapeHTML() { - cfg.addEncoderToCache(reflect.TypeOf((*string)(nil)).Elem(), &htmlEscapedStringEncoder{}) +func (cfg *frozenConfig) escapeHTML(encoderExtension EncoderExtension) { + encoderExtension[reflect2.TypeOfPtr((*string)(nil)).Elem()] = &htmlEscapedStringEncoder{} } func (cfg *frozenConfig) cleanDecoders() { @@ -229,24 +303,22 @@ func (cfg *frozenConfig) MarshalIndent(v interface{}, prefix, indent string) ([] } newCfg := cfg.configBeforeFrozen newCfg.IndentionStep = len(indent) - return newCfg.Froze().Marshal(v) + return newCfg.frozeWithCacheReuse().Marshal(v) } func (cfg *frozenConfig) UnmarshalFromString(str string, v interface{}) error { data := []byte(str) - data = data[:lastNotSpacePos(data)] iter := cfg.BorrowIterator(data) defer cfg.ReturnIterator(iter) iter.ReadVal(v) - if iter.head == iter.tail { - iter.loadMore() - } - if iter.Error == io.EOF { - return nil - } - if iter.Error == nil { - iter.ReportError("UnmarshalFromString", "there are bytes left after unmarshal") + c := iter.nextToken() + if c == 0 { + if iter.Error == io.EOF { + return nil + } + return iter.Error } + iter.ReportError("Unmarshal", "there are bytes left after unmarshal") return iter.Error } @@ -257,24 +329,17 @@ func (cfg *frozenConfig) Get(data []byte, path ...interface{}) Any { } func (cfg *frozenConfig) Unmarshal(data []byte, v interface{}) error { - data = data[:lastNotSpacePos(data)] iter := cfg.BorrowIterator(data) defer cfg.ReturnIterator(iter) - typ := reflect.TypeOf(v) - if typ.Kind() != reflect.Ptr { - // return non-pointer error - return errors.New("the second param must be ptr type") - } iter.ReadVal(v) - if iter.head == iter.tail { - iter.loadMore() - } - if iter.Error == io.EOF { - return nil - } - if iter.Error == nil { - iter.ReportError("Unmarshal", "there are bytes left after unmarshal") + c := iter.nextToken() + if c == 0 { + if iter.Error == io.EOF { + return nil + } + return iter.Error } + iter.ReportError("Unmarshal", "there are bytes left after unmarshal") return iter.Error } diff --git a/vendor/github.com/json-iterator/go/example_test.go b/vendor/github.com/json-iterator/go/example_test.go index 1c8f341c1..7f521a300 100644 --- a/vendor/github.com/json-iterator/go/example_test.go +++ b/vendor/github.com/json-iterator/go/example_test.go @@ -3,6 +3,7 @@ package jsoniter import ( "fmt" "os" + "strings" ) func ExampleMarshal() { @@ -93,3 +94,28 @@ func ExampleGet() { // Output: // Crimson } + +func ExampleMapKey() { + hello := MyKey("hello") + output, _ := Marshal(map[*MyKey]string{&hello: "world"}) + fmt.Println(string(output)) + obj := map[*MyKey]string{} + Unmarshal(output, &obj) + for k, v := range obj { + fmt.Println(*k, v) + } + // Output: + // {"Hello":"world"} + // Hel world +} + +type MyKey string + +func (m *MyKey) MarshalText() ([]byte, error) { + return []byte(strings.Replace(string(*m), "h", "H", -1)), nil +} + +func (m *MyKey) UnmarshalText(text []byte) error { + *m = MyKey(text[:3]) + return nil +} diff --git a/vendor/github.com/json-iterator/go/extension_tests/decoder_test.go b/vendor/github.com/json-iterator/go/extension_tests/decoder_test.go new file mode 100644 index 000000000..db253d885 --- /dev/null +++ b/vendor/github.com/json-iterator/go/extension_tests/decoder_test.go @@ -0,0 +1,100 @@ +package test + +import ( + "github.com/json-iterator/go" + "github.com/stretchr/testify/require" + "strconv" + "testing" + "time" + "unsafe" +) + +func Test_customize_type_decoder(t *testing.T) { + t.Skip() + jsoniter.RegisterTypeDecoderFunc("time.Time", func(ptr unsafe.Pointer, iter *jsoniter.Iterator) { + t, err := time.ParseInLocation("2006-01-02 15:04:05", iter.ReadString(), time.UTC) + if err != nil { + iter.Error = err + return + } + *((*time.Time)(ptr)) = t + }) + //defer jsoniter.ConfigDefault.(*frozenConfig).cleanDecoders() + val := time.Time{} + err := jsoniter.Unmarshal([]byte(`"2016-12-05 08:43:28"`), &val) + if err != nil { + t.Fatal(err) + } + year, month, day := val.Date() + if year != 2016 || month != 12 || day != 5 { + t.Fatal(val) + } +} + +func Test_customize_byte_array_encoder(t *testing.T) { + t.Skip() + //jsoniter.ConfigDefault.(*frozenConfig).cleanEncoders() + should := require.New(t) + jsoniter.RegisterTypeEncoderFunc("[]uint8", func(ptr unsafe.Pointer, stream *jsoniter.Stream) { + t := *((*[]byte)(ptr)) + stream.WriteString(string(t)) + }, nil) + //defer jsoniter.ConfigDefault.(*frozenConfig).cleanEncoders() + val := []byte("abc") + str, err := jsoniter.MarshalToString(val) + should.Nil(err) + should.Equal(`"abc"`, str) +} + +func Test_customize_field_decoder(t *testing.T) { + type Tom struct { + field1 string + } + jsoniter.RegisterFieldDecoderFunc("jsoniter.Tom", "field1", func(ptr unsafe.Pointer, iter *jsoniter.Iterator) { + *((*string)(ptr)) = strconv.Itoa(iter.ReadInt()) + }) + //defer jsoniter.ConfigDefault.(*frozenConfig).cleanDecoders() + tom := Tom{} + err := jsoniter.Unmarshal([]byte(`{"field1": 100}`), &tom) + if err != nil { + t.Fatal(err) + } +} + +func Test_recursive_empty_interface_customization(t *testing.T) { + t.Skip() + var obj interface{} + jsoniter.RegisterTypeDecoderFunc("interface {}", func(ptr unsafe.Pointer, iter *jsoniter.Iterator) { + switch iter.WhatIsNext() { + case jsoniter.NumberValue: + *(*interface{})(ptr) = iter.ReadInt64() + default: + *(*interface{})(ptr) = iter.Read() + } + }) + should := require.New(t) + jsoniter.Unmarshal([]byte("[100]"), &obj) + should.Equal([]interface{}{int64(100)}, obj) +} + +type MyInterface interface { + Hello() string +} + +type MyString string + +func (ms MyString) Hello() string { + return string(ms) +} + +func Test_read_custom_interface(t *testing.T) { + t.Skip() + should := require.New(t) + var val MyInterface + jsoniter.RegisterTypeDecoderFunc("jsoniter.MyInterface", func(ptr unsafe.Pointer, iter *jsoniter.Iterator) { + *((*MyInterface)(ptr)) = MyString(iter.ReadString()) + }) + err := jsoniter.UnmarshalFromString(`"hello"`, &val) + should.Nil(err) + should.Equal("hello", val.Hello()) +} diff --git a/vendor/github.com/json-iterator/go/extension_tests/extension_test.go b/vendor/github.com/json-iterator/go/extension_tests/extension_test.go new file mode 100644 index 000000000..043379ea4 --- /dev/null +++ b/vendor/github.com/json-iterator/go/extension_tests/extension_test.go @@ -0,0 +1,120 @@ +package test + +import ( + "github.com/json-iterator/go" + "github.com/stretchr/testify/require" + "github.com/modern-go/reflect2" + "reflect" + "strconv" + "testing" + "unsafe" +) + +type TestObject1 struct { + Field1 string +} + +type testExtension struct { + jsoniter.DummyExtension +} + +func (extension *testExtension) UpdateStructDescriptor(structDescriptor *jsoniter.StructDescriptor) { + if structDescriptor.Type.String() != "test.TestObject1" { + return + } + binding := structDescriptor.GetField("Field1") + binding.Encoder = &funcEncoder{fun: func(ptr unsafe.Pointer, stream *jsoniter.Stream) { + str := *((*string)(ptr)) + val, _ := strconv.Atoi(str) + stream.WriteInt(val) + }} + binding.Decoder = &funcDecoder{func(ptr unsafe.Pointer, iter *jsoniter.Iterator) { + *((*string)(ptr)) = strconv.Itoa(iter.ReadInt()) + }} + binding.ToNames = []string{"field-1"} + binding.FromNames = []string{"field-1"} +} + +func Test_customize_field_by_extension(t *testing.T) { + should := require.New(t) + cfg := jsoniter.Config{}.Froze() + cfg.RegisterExtension(&testExtension{}) + obj := TestObject1{} + err := cfg.UnmarshalFromString(`{"field-1": 100}`, &obj) + should.Nil(err) + should.Equal("100", obj.Field1) + str, err := cfg.MarshalToString(obj) + should.Nil(err) + should.Equal(`{"field-1":100}`, str) +} + +func Test_customize_map_key_encoder(t *testing.T) { + should := require.New(t) + cfg := jsoniter.Config{}.Froze() + cfg.RegisterExtension(&testMapKeyExtension{}) + m := map[int]int{1: 2} + output, err := cfg.MarshalToString(m) + should.NoError(err) + should.Equal(`{"2":2}`, output) + m = map[int]int{} + should.NoError(cfg.UnmarshalFromString(output, &m)) + should.Equal(map[int]int{1: 2}, m) +} + +type testMapKeyExtension struct { + jsoniter.DummyExtension +} + +func (extension *testMapKeyExtension) CreateMapKeyEncoder(typ reflect2.Type) jsoniter.ValEncoder { + if typ.Kind() == reflect.Int { + return &funcEncoder{ + fun: func(ptr unsafe.Pointer, stream *jsoniter.Stream) { + stream.WriteRaw(`"`) + stream.WriteInt(*(*int)(ptr) + 1) + stream.WriteRaw(`"`) + }, + } + } + return nil +} + +func (extension *testMapKeyExtension) CreateMapKeyDecoder(typ reflect2.Type) jsoniter.ValDecoder { + if typ.Kind() == reflect.Int { + return &funcDecoder{ + fun: func(ptr unsafe.Pointer, iter *jsoniter.Iterator) { + i, err := strconv.Atoi(iter.ReadString()) + if err != nil { + iter.ReportError("read map key", err.Error()) + return + } + i-- + *(*int)(ptr) = i + }, + } + } + return nil +} + +type funcDecoder struct { + fun jsoniter.DecoderFunc +} + +func (decoder *funcDecoder) Decode(ptr unsafe.Pointer, iter *jsoniter.Iterator) { + decoder.fun(ptr, iter) +} + +type funcEncoder struct { + fun jsoniter.EncoderFunc + isEmptyFunc func(ptr unsafe.Pointer) bool +} + +func (encoder *funcEncoder) Encode(ptr unsafe.Pointer, stream *jsoniter.Stream) { + encoder.fun(ptr, stream) +} + +func (encoder *funcEncoder) IsEmpty(ptr unsafe.Pointer) bool { + if encoder.isEmptyFunc == nil { + return false + } + return encoder.isEmptyFunc(ptr) +} diff --git a/vendor/github.com/json-iterator/go/extra/binary_as_string_codec.go b/vendor/github.com/json-iterator/go/extra/binary_as_string_codec.go new file mode 100644 index 000000000..f9d8b7502 --- /dev/null +++ b/vendor/github.com/json-iterator/go/extra/binary_as_string_codec.go @@ -0,0 +1,238 @@ +package extra + +import ( + "github.com/json-iterator/go" + "unsafe" + "unicode/utf8" + "github.com/modern-go/reflect2" +) + +// safeSet holds the value true if the ASCII character with the given array +// position can be represented inside a JSON string without any further +// escaping. +// +// All values are true except for the ASCII control characters (0-31), the +// double quote ("), and the backslash character ("\"). +var safeSet = [utf8.RuneSelf]bool{ + ' ': true, + '!': true, + '"': false, + '#': true, + '$': true, + '%': true, + '&': true, + '\'': true, + '(': true, + ')': true, + '*': true, + '+': true, + ',': true, + '-': true, + '.': true, + '/': true, + '0': true, + '1': true, + '2': true, + '3': true, + '4': true, + '5': true, + '6': true, + '7': true, + '8': true, + '9': true, + ':': true, + ';': true, + '<': true, + '=': true, + '>': true, + '?': true, + '@': true, + 'A': true, + 'B': true, + 'C': true, + 'D': true, + 'E': true, + 'F': true, + 'G': true, + 'H': true, + 'I': true, + 'J': true, + 'K': true, + 'L': true, + 'M': true, + 'N': true, + 'O': true, + 'P': true, + 'Q': true, + 'R': true, + 'S': true, + 'T': true, + 'U': true, + 'V': true, + 'W': true, + 'X': true, + 'Y': true, + 'Z': true, + '[': true, + '\\': false, + ']': true, + '^': true, + '_': true, + '`': true, + 'a': true, + 'b': true, + 'c': true, + 'd': true, + 'e': true, + 'f': true, + 'g': true, + 'h': true, + 'i': true, + 'j': true, + 'k': true, + 'l': true, + 'm': true, + 'n': true, + 'o': true, + 'p': true, + 'q': true, + 'r': true, + 's': true, + 't': true, + 'u': true, + 'v': true, + 'w': true, + 'x': true, + 'y': true, + 'z': true, + '{': true, + '|': true, + '}': true, + '~': true, + '\u007f': true, +} + +var binaryType = reflect2.TypeOfPtr((*[]byte)(nil)).Elem() + +type BinaryAsStringExtension struct { + jsoniter.DummyExtension +} + +func (extension *BinaryAsStringExtension) CreateEncoder(typ reflect2.Type) jsoniter.ValEncoder { + if typ == binaryType { + return &binaryAsStringCodec{} + } + return nil +} + +func (extension *BinaryAsStringExtension) CreateDecoder(typ reflect2.Type) jsoniter.ValDecoder { + if typ == binaryType { + return &binaryAsStringCodec{} + } + return nil +} + +type binaryAsStringCodec struct { +} + +func (codec *binaryAsStringCodec) Decode(ptr unsafe.Pointer, iter *jsoniter.Iterator) { + rawBytes := iter.ReadStringAsSlice() + bytes := make([]byte, 0, len(rawBytes)) + for i := 0; i < len(rawBytes); i++ { + b := rawBytes[i] + if b == '\\' { + b2 := rawBytes[i+1] + if b2 != '\\' { + iter.ReportError("decode binary as string", `\\x is only supported escape`) + return + } + b3 := rawBytes[i+2] + if b3 != 'x' { + iter.ReportError("decode binary as string", `\\x is only supported escape`) + return + } + b4 := rawBytes[i+3] + b5 := rawBytes[i+4] + i = i + 4 + b = readHex(iter, b4, b5) + } + bytes = append(bytes, b) + } + *(*[]byte)(ptr) = bytes +} +func (codec *binaryAsStringCodec) IsEmpty(ptr unsafe.Pointer) bool { + return len(*((*[]byte)(ptr))) == 0 +} +func (codec *binaryAsStringCodec) Encode(ptr unsafe.Pointer, stream *jsoniter.Stream) { + newBuffer := writeBytes(stream.Buffer(), *(*[]byte)(ptr)) + stream.SetBuffer(newBuffer) +} + +func readHex(iter *jsoniter.Iterator, b1, b2 byte) byte { + var ret byte + if b1 >= '0' && b1 <= '9' { + ret = b1-'0' + } else if b1 >= 'a' && b1 <= 'f' { + ret = b1-'a'+10 + } else { + iter.ReportError("read hex", "expects 0~9 or a~f, but found "+string([]byte{b1})) + return 0 + } + ret = ret * 16 + if b2 >= '0' && b2 <= '9' { + ret = b2-'0' + } else if b2 >= 'a' && b2 <= 'f' { + ret = b2-'a'+10 + } else { + iter.ReportError("read hex", "expects 0~9 or a~f, but found "+string([]byte{b2})) + return 0 + } + return ret +} + +var hex = "0123456789abcdef" + +func writeBytes(space []byte, s []byte) []byte { + space = append(space, '"') + // write string, the fast path, without utf8 and escape support + var i int + var c byte + for i, c = range s { + if c < utf8.RuneSelf && safeSet[c] { + space = append(space, c) + } else { + break + } + } + if i == len(s)-1 { + space = append(space, '"') + return space + } + return writeBytesSlowPath(space, s[i:]) +} + +func writeBytesSlowPath(space []byte, s []byte) []byte { + start := 0 + // for the remaining parts, we process them char by char + var i int + var b byte + for i, b = range s { + if b >= utf8.RuneSelf { + space = append(space, '\\', '\\', 'x', hex[b>>4], hex[b&0xF]) + start = i + 1 + continue + } + if safeSet[b] { + continue + } + if start < i { + space = append(space, s[start:i]...) + } + space = append(space, '\\', '\\', 'x', hex[b>>4], hex[b&0xF]) + start = i + 1 + } + if start < len(s) { + space = append(space, s[start:]...) + } + return append(space, '"') +} diff --git a/vendor/github.com/json-iterator/go/extra/binary_as_string_codec_test.go b/vendor/github.com/json-iterator/go/extra/binary_as_string_codec_test.go new file mode 100644 index 000000000..d67716810 --- /dev/null +++ b/vendor/github.com/json-iterator/go/extra/binary_as_string_codec_test.go @@ -0,0 +1,32 @@ +package extra + +import ( + "testing" + "github.com/stretchr/testify/require" + "github.com/json-iterator/go" +) + +func init() { + jsoniter.RegisterExtension(&BinaryAsStringExtension{}) +} + +func TestBinaryAsStringCodec(t *testing.T) { + t.Run("safe set", func(t *testing.T) { + should := require.New(t) + output, err := jsoniter.Marshal([]byte("hello")) + should.NoError(err) + should.Equal(`"hello"`, string(output)) + var val []byte + should.NoError(jsoniter.Unmarshal(output, &val)) + should.Equal(`hello`, string(val)) + }) + t.Run("non safe set", func(t *testing.T) { + should := require.New(t) + output, err := jsoniter.Marshal([]byte{1, 2, 3, 15}) + should.NoError(err) + should.Equal(`"\\x01\\x02\\x03\\x0f"`, string(output)) + var val []byte + should.NoError(jsoniter.Unmarshal(output, &val)) + should.Equal([]byte{1, 2, 3, 15}, val) + }) +} diff --git a/vendor/github.com/json-iterator/go/extra/fuzzy_decoder.go b/vendor/github.com/json-iterator/go/extra/fuzzy_decoder.go index 9b63c277f..8ff1cc3db 100644 --- a/vendor/github.com/json-iterator/go/extra/fuzzy_decoder.go +++ b/vendor/github.com/json-iterator/go/extra/fuzzy_decoder.go @@ -9,6 +9,7 @@ import ( "unsafe" "github.com/json-iterator/go" + "github.com/modern-go/reflect2" ) const maxUint = ^uint(0) @@ -148,7 +149,7 @@ type tolerateEmptyArrayExtension struct { jsoniter.DummyExtension } -func (extension *tolerateEmptyArrayExtension) DecorateDecoder(typ reflect.Type, decoder jsoniter.ValDecoder) jsoniter.ValDecoder { +func (extension *tolerateEmptyArrayExtension) DecorateDecoder(typ reflect2.Type, decoder jsoniter.ValDecoder) jsoniter.ValDecoder { if typ.Kind() == reflect.Struct || typ.Kind() == reflect.Map { return &tolerateEmptyArrayDecoder{decoder} } @@ -182,6 +183,9 @@ func (decoder *fuzzyStringDecoder) Decode(ptr unsafe.Pointer, iter *jsoniter.Ite *((*string)(ptr)) = string(number) case jsoniter.StringValue: *((*string)(ptr)) = iter.ReadString() + case jsoniter.NilValue: + iter.Skip() + *((*string)(ptr)) = "" default: iter.ReportError("fuzzyStringDecoder", "not number or string") } @@ -207,6 +211,9 @@ func (decoder *fuzzyIntegerDecoder) Decode(ptr unsafe.Pointer, iter *jsoniter.It } else { str = "0" } + case jsoniter.NilValue: + iter.Skip() + str = "0" default: iter.ReportError("fuzzyIntegerDecoder", "not number or string") } @@ -243,6 +250,9 @@ func (decoder *fuzzyFloat32Decoder) Decode(ptr unsafe.Pointer, iter *jsoniter.It } else { *((*float32)(ptr)) = 0 } + case jsoniter.NilValue: + iter.Skip() + *((*float32)(ptr)) = 0 default: iter.ReportError("fuzzyFloat32Decoder", "not number or string") } @@ -272,7 +282,10 @@ func (decoder *fuzzyFloat64Decoder) Decode(ptr unsafe.Pointer, iter *jsoniter.It } else { *((*float64)(ptr)) = 0 } + case jsoniter.NilValue: + iter.Skip() + *((*float64)(ptr)) = 0 default: - iter.ReportError("fuzzyFloat32Decoder", "not number or string") + iter.ReportError("fuzzyFloat64Decoder", "not number or string") } } diff --git a/vendor/github.com/json-iterator/go/extra/fuzzy_decoder_test.go b/vendor/github.com/json-iterator/go/extra/fuzzy_decoder_test.go index b6a15596d..3490e3a23 100644 --- a/vendor/github.com/json-iterator/go/extra/fuzzy_decoder_test.go +++ b/vendor/github.com/json-iterator/go/extra/fuzzy_decoder_test.go @@ -357,3 +357,35 @@ func Test_bad_case(t *testing.T) { should := require.New(t) should.Nil(err) } + +func Test_null_to_string(t *testing.T) { + should := require.New(t) + body := []byte(`null`) + var message string + err := jsoniter.Unmarshal(body, &message) + should.NoError(err) +} + +func Test_null_to_int(t *testing.T) { + should := require.New(t) + body := []byte(`null`) + var message int + err := jsoniter.Unmarshal(body, &message) + should.NoError(err) +} + +func Test_null_to_float32(t *testing.T) { + should := require.New(t) + body := []byte(`null`) + var message float32 + err := jsoniter.Unmarshal(body, &message) + should.NoError(err) +} + +func Test_null_to_float64(t *testing.T) { + should := require.New(t) + body := []byte(`null`) + var message float64 + err := jsoniter.Unmarshal(body, &message) + should.NoError(err) +} diff --git a/vendor/github.com/json-iterator/go/extra/naming_strategy.go b/vendor/github.com/json-iterator/go/extra/naming_strategy.go index 642556fed..671e4951b 100644 --- a/vendor/github.com/json-iterator/go/extra/naming_strategy.go +++ b/vendor/github.com/json-iterator/go/extra/naming_strategy.go @@ -17,8 +17,8 @@ type namingStrategyExtension struct { func (extension *namingStrategyExtension) UpdateStructDescriptor(structDescriptor *jsoniter.StructDescriptor) { for _, binding := range structDescriptor.Fields { - binding.ToNames = []string{extension.translate(binding.Field.Name)} - binding.FromNames = []string{extension.translate(binding.Field.Name)} + binding.ToNames = []string{extension.translate(binding.Field.Name())} + binding.FromNames = []string{extension.translate(binding.Field.Name())} } } diff --git a/vendor/github.com/json-iterator/go/extra/privat_fields.go b/vendor/github.com/json-iterator/go/extra/privat_fields.go index 18643961f..ac7096ff4 100644 --- a/vendor/github.com/json-iterator/go/extra/privat_fields.go +++ b/vendor/github.com/json-iterator/go/extra/privat_fields.go @@ -16,10 +16,10 @@ type privateFieldsExtension struct { func (extension *privateFieldsExtension) UpdateStructDescriptor(structDescriptor *jsoniter.StructDescriptor) { for _, binding := range structDescriptor.Fields { - isPrivate := unicode.IsLower(rune(binding.Field.Name[0])) + isPrivate := unicode.IsLower(rune(binding.Field.Name()[0])) if isPrivate { - binding.FromNames = []string{binding.Field.Name} - binding.ToNames = []string{binding.Field.Name} + binding.FromNames = []string{binding.Field.Name()} + binding.ToNames = []string{binding.Field.Name()} } } } diff --git a/vendor/github.com/json-iterator/go/extra/time_as_int64_codec.go b/vendor/github.com/json-iterator/go/extra/time_as_int64_codec.go index e270cd403..9893872a0 100644 --- a/vendor/github.com/json-iterator/go/extra/time_as_int64_codec.go +++ b/vendor/github.com/json-iterator/go/extra/time_as_int64_codec.go @@ -29,6 +29,3 @@ func (codec *timeAsInt64Codec) Encode(ptr unsafe.Pointer, stream *jsoniter.Strea ts := *((*time.Time)(ptr)) stream.WriteInt64(ts.UnixNano() / codec.precision.Nanoseconds()) } -func (codec *timeAsInt64Codec) EncodeInterface(val interface{}, stream *jsoniter.Stream) { - jsoniter.WriteToStream(val, stream, codec) -} diff --git a/vendor/github.com/json-iterator/go/feature_config_with_sync_map.go b/vendor/github.com/json-iterator/go/feature_config_with_sync_map.go deleted file mode 100644 index e81e1b7f7..000000000 --- a/vendor/github.com/json-iterator/go/feature_config_with_sync_map.go +++ /dev/null @@ -1,51 +0,0 @@ -//+build go1.9 - -package jsoniter - -import ( - "reflect" - "sync" -) - -type frozenConfig struct { - configBeforeFrozen Config - sortMapKeys bool - indentionStep int - objectFieldMustBeSimpleString bool - onlyTaggedField bool - decoderCache sync.Map - encoderCache sync.Map - extensions []Extension - streamPool chan *Stream - iteratorPool chan *Iterator -} - -func (cfg *frozenConfig) initCache() { - cfg.decoderCache = sync.Map{} - cfg.encoderCache = sync.Map{} -} - - -func (cfg *frozenConfig) addDecoderToCache(cacheKey reflect.Type, decoder ValDecoder) { - cfg.decoderCache.Store(cacheKey, decoder) -} - -func (cfg *frozenConfig) addEncoderToCache(cacheKey reflect.Type, encoder ValEncoder) { - cfg.encoderCache.Store(cacheKey, encoder) -} - -func (cfg *frozenConfig) getDecoderFromCache(cacheKey reflect.Type) ValDecoder { - decoder, found := cfg.decoderCache.Load(cacheKey) - if found { - return decoder.(ValDecoder) - } - return nil -} - -func (cfg *frozenConfig) getEncoderFromCache(cacheKey reflect.Type) ValEncoder { - encoder, found := cfg.encoderCache.Load(cacheKey) - if found { - return encoder.(ValEncoder) - } - return nil -} \ No newline at end of file diff --git a/vendor/github.com/json-iterator/go/feature_config_without_sync_map.go b/vendor/github.com/json-iterator/go/feature_config_without_sync_map.go deleted file mode 100644 index f01f971e0..000000000 --- a/vendor/github.com/json-iterator/go/feature_config_without_sync_map.go +++ /dev/null @@ -1,54 +0,0 @@ -//+build !go1.9 - -package jsoniter - -import ( - "reflect" - "sync" -) - -type frozenConfig struct { - configBeforeFrozen Config - sortMapKeys bool - indentionStep int - objectFieldMustBeSimpleString bool - onlyTaggedField bool - cacheLock *sync.RWMutex - decoderCache map[reflect.Type]ValDecoder - encoderCache map[reflect.Type]ValEncoder - extensions []Extension - streamPool chan *Stream - iteratorPool chan *Iterator -} - -func (cfg *frozenConfig) initCache() { - cfg.cacheLock = &sync.RWMutex{} - cfg.decoderCache = map[reflect.Type]ValDecoder{} - cfg.encoderCache = map[reflect.Type]ValEncoder{} -} - -func (cfg *frozenConfig) addDecoderToCache(cacheKey reflect.Type, decoder ValDecoder) { - cfg.cacheLock.Lock() - cfg.decoderCache[cacheKey] = decoder - cfg.cacheLock.Unlock() -} - -func (cfg *frozenConfig) addEncoderToCache(cacheKey reflect.Type, encoder ValEncoder) { - cfg.cacheLock.Lock() - cfg.encoderCache[cacheKey] = encoder - cfg.cacheLock.Unlock() -} - -func (cfg *frozenConfig) getDecoderFromCache(cacheKey reflect.Type) ValDecoder { - cfg.cacheLock.RLock() - decoder, _ := cfg.decoderCache[cacheKey].(ValDecoder) - cfg.cacheLock.RUnlock() - return decoder -} - -func (cfg *frozenConfig) getEncoderFromCache(cacheKey reflect.Type) ValEncoder { - cfg.cacheLock.RLock() - encoder, _ := cfg.encoderCache[cacheKey].(ValEncoder) - cfg.cacheLock.RUnlock() - return encoder -} diff --git a/vendor/github.com/json-iterator/go/feature_json_number.go b/vendor/github.com/json-iterator/go/feature_json_number.go deleted file mode 100644 index e187b200a..000000000 --- a/vendor/github.com/json-iterator/go/feature_json_number.go +++ /dev/null @@ -1,31 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "strconv" -) - -type Number string - -// String returns the literal text of the number. -func (n Number) String() string { return string(n) } - -// Float64 returns the number as a float64. -func (n Number) Float64() (float64, error) { - return strconv.ParseFloat(string(n), 64) -} - -// Int64 returns the number as an int64. -func (n Number) Int64() (int64, error) { - return strconv.ParseInt(string(n), 10, 64) -} - -func CastJsonNumber(val interface{}) (string, bool) { - switch typedVal := val.(type) { - case json.Number: - return string(typedVal), true - case Number: - return string(typedVal), true - } - return "", false -} diff --git a/vendor/github.com/json-iterator/go/feature_reflect.go b/vendor/github.com/json-iterator/go/feature_reflect.go deleted file mode 100644 index 75d533b07..000000000 --- a/vendor/github.com/json-iterator/go/feature_reflect.go +++ /dev/null @@ -1,607 +0,0 @@ -package jsoniter - -import ( - "encoding" - "encoding/json" - "fmt" - "reflect" - "time" - "unsafe" -) - -// ValDecoder is an internal type registered to cache as needed. -// Don't confuse jsoniter.ValDecoder with json.Decoder. -// For json.Decoder's adapter, refer to jsoniter.AdapterDecoder(todo link). -// -// Reflection on type to create decoders, which is then cached -// Reflection on value is avoided as we can, as the reflect.Value itself will allocate, with following exceptions -// 1. create instance of new value, for example *int will need a int to be allocated -// 2. append to slice, if the existing cap is not enough, allocate will be done using Reflect.New -// 3. assignment to map, both key and value will be reflect.Value -// For a simple struct binding, it will be reflect.Value free and allocation free -type ValDecoder interface { - Decode(ptr unsafe.Pointer, iter *Iterator) -} - -// ValEncoder is an internal type registered to cache as needed. -// Don't confuse jsoniter.ValEncoder with json.Encoder. -// For json.Encoder's adapter, refer to jsoniter.AdapterEncoder(todo godoc link). -type ValEncoder interface { - IsEmpty(ptr unsafe.Pointer) bool - Encode(ptr unsafe.Pointer, stream *Stream) - EncodeInterface(val interface{}, stream *Stream) -} - -type checkIsEmpty interface { - IsEmpty(ptr unsafe.Pointer) bool -} - -// WriteToStream the default implementation for TypeEncoder method EncodeInterface -func WriteToStream(val interface{}, stream *Stream, encoder ValEncoder) { - e := (*emptyInterface)(unsafe.Pointer(&val)) - if e.word == nil { - stream.WriteNil() - return - } - if reflect.TypeOf(val).Kind() == reflect.Ptr { - encoder.Encode(unsafe.Pointer(&e.word), stream) - } else { - encoder.Encode(e.word, stream) - } -} - -var jsonNumberType reflect.Type -var jsoniterNumberType reflect.Type -var jsonRawMessageType reflect.Type -var jsoniterRawMessageType reflect.Type -var anyType reflect.Type -var marshalerType reflect.Type -var unmarshalerType reflect.Type -var textMarshalerType reflect.Type -var textUnmarshalerType reflect.Type - -func init() { - jsonNumberType = reflect.TypeOf((*json.Number)(nil)).Elem() - jsoniterNumberType = reflect.TypeOf((*Number)(nil)).Elem() - jsonRawMessageType = reflect.TypeOf((*json.RawMessage)(nil)).Elem() - jsoniterRawMessageType = reflect.TypeOf((*RawMessage)(nil)).Elem() - anyType = reflect.TypeOf((*Any)(nil)).Elem() - marshalerType = reflect.TypeOf((*json.Marshaler)(nil)).Elem() - unmarshalerType = reflect.TypeOf((*json.Unmarshaler)(nil)).Elem() - textMarshalerType = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem() - textUnmarshalerType = reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem() -} - -// ReadVal copy the underlying JSON into go interface, same as json.Unmarshal -func (iter *Iterator) ReadVal(obj interface{}) { - typ := reflect.TypeOf(obj) - cacheKey := typ.Elem() - decoder := decoderOfType(iter.cfg, "", cacheKey) - e := (*emptyInterface)(unsafe.Pointer(&obj)) - if e.word == nil { - iter.ReportError("ReadVal", "can not read into nil pointer") - return - } - decoder.Decode(e.word, iter) -} - -// WriteVal copy the go interface into underlying JSON, same as json.Marshal -func (stream *Stream) WriteVal(val interface{}) { - if nil == val { - stream.WriteNil() - return - } - typ := reflect.TypeOf(val) - cacheKey := typ - encoder := encoderOfType(stream.cfg, "", cacheKey) - encoder.EncodeInterface(val, stream) -} - -func decoderOfType(cfg *frozenConfig, prefix string, typ reflect.Type) ValDecoder { - cacheKey := typ - decoder := cfg.getDecoderFromCache(cacheKey) - if decoder != nil { - return decoder - } - decoder = getTypeDecoderFromExtension(cfg, typ) - if decoder != nil { - cfg.addDecoderToCache(cacheKey, decoder) - return decoder - } - decoder = &placeholderDecoder{cfg: cfg, cacheKey: cacheKey} - cfg.addDecoderToCache(cacheKey, decoder) - decoder = createDecoderOfType(cfg, prefix, typ) - for _, extension := range extensions { - decoder = extension.DecorateDecoder(typ, decoder) - } - for _, extension := range cfg.extensions { - decoder = extension.DecorateDecoder(typ, decoder) - } - cfg.addDecoderToCache(cacheKey, decoder) - return decoder -} - -func createDecoderOfType(cfg *frozenConfig, prefix string, typ reflect.Type) ValDecoder { - typeName := typ.String() - if typ == jsonRawMessageType { - return &jsonRawMessageCodec{} - } - if typ == jsoniterRawMessageType { - return &jsoniterRawMessageCodec{} - } - if typ.AssignableTo(jsonNumberType) { - return &jsonNumberCodec{} - } - if typ.AssignableTo(jsoniterNumberType) { - return &jsoniterNumberCodec{} - } - if typ.Implements(unmarshalerType) { - templateInterface := reflect.New(typ).Elem().Interface() - var decoder ValDecoder = &unmarshalerDecoder{extractInterface(templateInterface)} - if typ.Kind() == reflect.Ptr { - decoder = &OptionalDecoder{typ.Elem(), decoder} - } - return decoder - } - if reflect.PtrTo(typ).Implements(unmarshalerType) { - templateInterface := reflect.New(typ).Interface() - var decoder ValDecoder = &unmarshalerDecoder{extractInterface(templateInterface)} - return decoder - } - if typ.Implements(textUnmarshalerType) { - templateInterface := reflect.New(typ).Elem().Interface() - var decoder ValDecoder = &textUnmarshalerDecoder{extractInterface(templateInterface)} - if typ.Kind() == reflect.Ptr { - decoder = &OptionalDecoder{typ.Elem(), decoder} - } - return decoder - } - if reflect.PtrTo(typ).Implements(textUnmarshalerType) { - templateInterface := reflect.New(typ).Interface() - var decoder ValDecoder = &textUnmarshalerDecoder{extractInterface(templateInterface)} - return decoder - } - if typ.Kind() == reflect.Slice && typ.Elem().Kind() == reflect.Uint8 { - sliceDecoder := decoderOfSlice(cfg, prefix, typ) - return &base64Codec{sliceDecoder: sliceDecoder} - } - if typ.Implements(anyType) { - return &anyCodec{} - } - switch typ.Kind() { - case reflect.String: - if typeName != "string" { - return decoderOfType(cfg, prefix, reflect.TypeOf((*string)(nil)).Elem()) - } - return &stringCodec{} - case reflect.Int: - if typeName != "int" { - return decoderOfType(cfg, prefix, reflect.TypeOf((*int)(nil)).Elem()) - } - return &intCodec{} - case reflect.Int8: - if typeName != "int8" { - return decoderOfType(cfg, prefix, reflect.TypeOf((*int8)(nil)).Elem()) - } - return &int8Codec{} - case reflect.Int16: - if typeName != "int16" { - return decoderOfType(cfg, prefix, reflect.TypeOf((*int16)(nil)).Elem()) - } - return &int16Codec{} - case reflect.Int32: - if typeName != "int32" { - return decoderOfType(cfg, prefix, reflect.TypeOf((*int32)(nil)).Elem()) - } - return &int32Codec{} - case reflect.Int64: - if typeName != "int64" { - return decoderOfType(cfg, prefix, reflect.TypeOf((*int64)(nil)).Elem()) - } - return &int64Codec{} - case reflect.Uint: - if typeName != "uint" { - return decoderOfType(cfg, prefix, reflect.TypeOf((*uint)(nil)).Elem()) - } - return &uintCodec{} - case reflect.Uint8: - if typeName != "uint8" { - return decoderOfType(cfg, prefix, reflect.TypeOf((*uint8)(nil)).Elem()) - } - return &uint8Codec{} - case reflect.Uint16: - if typeName != "uint16" { - return decoderOfType(cfg, prefix, reflect.TypeOf((*uint16)(nil)).Elem()) - } - return &uint16Codec{} - case reflect.Uint32: - if typeName != "uint32" { - return decoderOfType(cfg, prefix, reflect.TypeOf((*uint32)(nil)).Elem()) - } - return &uint32Codec{} - case reflect.Uintptr: - if typeName != "uintptr" { - return decoderOfType(cfg, prefix, reflect.TypeOf((*uintptr)(nil)).Elem()) - } - return &uintptrCodec{} - case reflect.Uint64: - if typeName != "uint64" { - return decoderOfType(cfg, prefix, reflect.TypeOf((*uint64)(nil)).Elem()) - } - return &uint64Codec{} - case reflect.Float32: - if typeName != "float32" { - return decoderOfType(cfg, prefix, reflect.TypeOf((*float32)(nil)).Elem()) - } - return &float32Codec{} - case reflect.Float64: - if typeName != "float64" { - return decoderOfType(cfg, prefix, reflect.TypeOf((*float64)(nil)).Elem()) - } - return &float64Codec{} - case reflect.Bool: - if typeName != "bool" { - return decoderOfType(cfg, prefix, reflect.TypeOf((*bool)(nil)).Elem()) - } - return &boolCodec{} - case reflect.Interface: - if typ.NumMethod() == 0 { - return &emptyInterfaceCodec{} - } - return &nonEmptyInterfaceCodec{} - case reflect.Struct: - return decoderOfStruct(cfg, prefix, typ) - case reflect.Array: - return decoderOfArray(cfg, prefix, typ) - case reflect.Slice: - return decoderOfSlice(cfg, prefix, typ) - case reflect.Map: - return decoderOfMap(cfg, prefix, typ) - case reflect.Ptr: - return decoderOfOptional(cfg, prefix, typ) - default: - return &lazyErrorDecoder{err: fmt.Errorf("%s%s is unsupported type", prefix, typ.String())} - } -} - -func encoderOfType(cfg *frozenConfig, prefix string, typ reflect.Type) ValEncoder { - cacheKey := typ - encoder := cfg.getEncoderFromCache(cacheKey) - if encoder != nil { - return encoder - } - encoder = getTypeEncoderFromExtension(cfg, typ) - if encoder != nil { - cfg.addEncoderToCache(cacheKey, encoder) - return encoder - } - encoder = &placeholderEncoder{cfg: cfg, cacheKey: cacheKey} - cfg.addEncoderToCache(cacheKey, encoder) - encoder = createEncoderOfType(cfg, prefix, typ) - for _, extension := range extensions { - encoder = extension.DecorateEncoder(typ, encoder) - } - for _, extension := range cfg.extensions { - encoder = extension.DecorateEncoder(typ, encoder) - } - cfg.addEncoderToCache(cacheKey, encoder) - return encoder -} - -func createEncoderOfType(cfg *frozenConfig, prefix string, typ reflect.Type) ValEncoder { - if typ == jsonRawMessageType { - return &jsonRawMessageCodec{} - } - if typ == jsoniterRawMessageType { - return &jsoniterRawMessageCodec{} - } - if typ.AssignableTo(jsonNumberType) { - return &jsonNumberCodec{} - } - if typ.AssignableTo(jsoniterNumberType) { - return &jsoniterNumberCodec{} - } - if typ.Implements(marshalerType) { - checkIsEmpty := createCheckIsEmpty(cfg, typ) - templateInterface := reflect.New(typ).Elem().Interface() - var encoder ValEncoder = &marshalerEncoder{ - templateInterface: extractInterface(templateInterface), - checkIsEmpty: checkIsEmpty, - } - if typ.Kind() == reflect.Ptr { - encoder = &OptionalEncoder{encoder} - } - return encoder - } - if reflect.PtrTo(typ).Implements(marshalerType) { - checkIsEmpty := createCheckIsEmpty(cfg, reflect.PtrTo(typ)) - templateInterface := reflect.New(typ).Interface() - var encoder ValEncoder = &marshalerEncoder{ - templateInterface: extractInterface(templateInterface), - checkIsEmpty: checkIsEmpty, - } - return encoder - } - if typ.Implements(textMarshalerType) { - checkIsEmpty := createCheckIsEmpty(cfg, typ) - templateInterface := reflect.New(typ).Elem().Interface() - var encoder ValEncoder = &textMarshalerEncoder{ - templateInterface: extractInterface(templateInterface), - checkIsEmpty: checkIsEmpty, - } - if typ.Kind() == reflect.Ptr { - encoder = &OptionalEncoder{encoder} - } - return encoder - } - if typ.Kind() == reflect.Slice && typ.Elem().Kind() == reflect.Uint8 { - return &base64Codec{} - } - if typ.Implements(anyType) { - return &anyCodec{} - } - return createEncoderOfSimpleType(cfg, prefix, typ) -} - -func createCheckIsEmpty(cfg *frozenConfig, typ reflect.Type) checkIsEmpty { - kind := typ.Kind() - switch kind { - case reflect.String: - return &stringCodec{} - case reflect.Int: - return &intCodec{} - case reflect.Int8: - return &int8Codec{} - case reflect.Int16: - return &int16Codec{} - case reflect.Int32: - return &int32Codec{} - case reflect.Int64: - return &int64Codec{} - case reflect.Uint: - return &uintCodec{} - case reflect.Uint8: - return &uint8Codec{} - case reflect.Uint16: - return &uint16Codec{} - case reflect.Uint32: - return &uint32Codec{} - case reflect.Uintptr: - return &uintptrCodec{} - case reflect.Uint64: - return &uint64Codec{} - case reflect.Float32: - return &float32Codec{} - case reflect.Float64: - return &float64Codec{} - case reflect.Bool: - return &boolCodec{} - case reflect.Interface: - if typ.NumMethod() == 0 { - return &emptyInterfaceCodec{} - } - return &nonEmptyInterfaceCodec{} - case reflect.Struct: - return &structEncoder{typ: typ} - case reflect.Array: - return &arrayEncoder{} - case reflect.Slice: - return &sliceEncoder{} - case reflect.Map: - return encoderOfMap(cfg, "", typ) - case reflect.Ptr: - return &OptionalEncoder{} - default: - return &lazyErrorEncoder{err: fmt.Errorf("unsupported type: %v", typ)} - } -} - -func createEncoderOfSimpleType(cfg *frozenConfig, prefix string, typ reflect.Type) ValEncoder { - typeName := typ.String() - kind := typ.Kind() - switch kind { - case reflect.String: - if typeName != "string" { - return encoderOfType(cfg, prefix, reflect.TypeOf((*string)(nil)).Elem()) - } - return &stringCodec{} - case reflect.Int: - if typeName != "int" { - return encoderOfType(cfg, prefix, reflect.TypeOf((*int)(nil)).Elem()) - } - return &intCodec{} - case reflect.Int8: - if typeName != "int8" { - return encoderOfType(cfg, prefix, reflect.TypeOf((*int8)(nil)).Elem()) - } - return &int8Codec{} - case reflect.Int16: - if typeName != "int16" { - return encoderOfType(cfg, prefix, reflect.TypeOf((*int16)(nil)).Elem()) - } - return &int16Codec{} - case reflect.Int32: - if typeName != "int32" { - return encoderOfType(cfg, prefix, reflect.TypeOf((*int32)(nil)).Elem()) - } - return &int32Codec{} - case reflect.Int64: - if typeName != "int64" { - return encoderOfType(cfg, prefix, reflect.TypeOf((*int64)(nil)).Elem()) - } - return &int64Codec{} - case reflect.Uint: - if typeName != "uint" { - return encoderOfType(cfg, prefix, reflect.TypeOf((*uint)(nil)).Elem()) - } - return &uintCodec{} - case reflect.Uint8: - if typeName != "uint8" { - return encoderOfType(cfg, prefix, reflect.TypeOf((*uint8)(nil)).Elem()) - } - return &uint8Codec{} - case reflect.Uint16: - if typeName != "uint16" { - return encoderOfType(cfg, prefix, reflect.TypeOf((*uint16)(nil)).Elem()) - } - return &uint16Codec{} - case reflect.Uint32: - if typeName != "uint32" { - return encoderOfType(cfg, prefix, reflect.TypeOf((*uint32)(nil)).Elem()) - } - return &uint32Codec{} - case reflect.Uintptr: - if typeName != "uintptr" { - return encoderOfType(cfg, prefix, reflect.TypeOf((*uintptr)(nil)).Elem()) - } - return &uintptrCodec{} - case reflect.Uint64: - if typeName != "uint64" { - return encoderOfType(cfg, prefix, reflect.TypeOf((*uint64)(nil)).Elem()) - } - return &uint64Codec{} - case reflect.Float32: - if typeName != "float32" { - return encoderOfType(cfg, prefix, reflect.TypeOf((*float32)(nil)).Elem()) - } - return &float32Codec{} - case reflect.Float64: - if typeName != "float64" { - return encoderOfType(cfg, prefix, reflect.TypeOf((*float64)(nil)).Elem()) - } - return &float64Codec{} - case reflect.Bool: - if typeName != "bool" { - return encoderOfType(cfg, prefix, reflect.TypeOf((*bool)(nil)).Elem()) - } - return &boolCodec{} - case reflect.Interface: - if typ.NumMethod() == 0 { - return &emptyInterfaceCodec{} - } - return &nonEmptyInterfaceCodec{} - case reflect.Struct: - return encoderOfStruct(cfg, prefix, typ) - case reflect.Array: - return encoderOfArray(cfg, prefix, typ) - case reflect.Slice: - return encoderOfSlice(cfg, prefix, typ) - case reflect.Map: - return encoderOfMap(cfg, prefix, typ) - case reflect.Ptr: - return encoderOfOptional(cfg, prefix, typ) - default: - return &lazyErrorEncoder{err: fmt.Errorf("%s%s is unsupported type", prefix, typ.String())} - } -} - -type placeholderEncoder struct { - cfg *frozenConfig - cacheKey reflect.Type -} - -func (encoder *placeholderEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - encoder.getRealEncoder().Encode(ptr, stream) -} - -func (encoder *placeholderEncoder) EncodeInterface(val interface{}, stream *Stream) { - encoder.getRealEncoder().EncodeInterface(val, stream) -} - -func (encoder *placeholderEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.getRealEncoder().IsEmpty(ptr) -} - -func (encoder *placeholderEncoder) getRealEncoder() ValEncoder { - for i := 0; i < 500; i++ { - realDecoder := encoder.cfg.getEncoderFromCache(encoder.cacheKey) - _, isPlaceholder := realDecoder.(*placeholderEncoder) - if isPlaceholder { - time.Sleep(10 * time.Millisecond) - } else { - return realDecoder - } - } - panic(fmt.Sprintf("real encoder not found for cache key: %v", encoder.cacheKey)) -} - -type placeholderDecoder struct { - cfg *frozenConfig - cacheKey reflect.Type -} - -func (decoder *placeholderDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - for i := 0; i < 500; i++ { - realDecoder := decoder.cfg.getDecoderFromCache(decoder.cacheKey) - _, isPlaceholder := realDecoder.(*placeholderDecoder) - if isPlaceholder { - time.Sleep(10 * time.Millisecond) - } else { - realDecoder.Decode(ptr, iter) - return - } - } - panic(fmt.Sprintf("real decoder not found for cache key: %v", decoder.cacheKey)) -} - -type lazyErrorDecoder struct { - err error -} - -func (decoder *lazyErrorDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if iter.WhatIsNext() != NilValue { - if iter.Error == nil { - iter.Error = decoder.err - } - } else { - iter.Skip() - } -} - -type lazyErrorEncoder struct { - err error -} - -func (encoder *lazyErrorEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - if ptr == nil { - stream.WriteNil() - } else if stream.Error == nil { - stream.Error = encoder.err - } -} - -func (encoder *lazyErrorEncoder) EncodeInterface(val interface{}, stream *Stream) { - if val == nil { - stream.WriteNil() - } else if stream.Error == nil { - stream.Error = encoder.err - } -} - -func (encoder *lazyErrorEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return false -} - -func extractInterface(val interface{}) emptyInterface { - return *((*emptyInterface)(unsafe.Pointer(&val))) -} - -// emptyInterface is the header for an interface{} value. -type emptyInterface struct { - typ unsafe.Pointer - word unsafe.Pointer -} - -// emptyInterface is the header for an interface with method (not interface{}) -type nonEmptyInterface struct { - // see ../runtime/iface.go:/Itab - itab *struct { - ityp unsafe.Pointer // static interface type - typ unsafe.Pointer // dynamic concrete type - link unsafe.Pointer - bad int32 - unused int32 - fun [100000]unsafe.Pointer // method table - } - word unsafe.Pointer -} diff --git a/vendor/github.com/json-iterator/go/feature_reflect_array.go b/vendor/github.com/json-iterator/go/feature_reflect_array.go deleted file mode 100644 index a6dd91cab..000000000 --- a/vendor/github.com/json-iterator/go/feature_reflect_array.go +++ /dev/null @@ -1,110 +0,0 @@ -package jsoniter - -import ( - "fmt" - "io" - "reflect" - "unsafe" -) - -func decoderOfArray(cfg *frozenConfig, prefix string, typ reflect.Type) ValDecoder { - decoder := decoderOfType(cfg, prefix+"[array]->", typ.Elem()) - return &arrayDecoder{typ, typ.Elem(), decoder} -} - -func encoderOfArray(cfg *frozenConfig, prefix string, typ reflect.Type) ValEncoder { - if typ.Len() == 0 { - return emptyArrayEncoder{} - } - encoder := encoderOfType(cfg, prefix+"[array]->", typ.Elem()) - if typ.Elem().Kind() == reflect.Map { - encoder = &OptionalEncoder{encoder} - } - return &arrayEncoder{typ, typ.Elem(), encoder} -} - -type emptyArrayEncoder struct{} - -func (encoder emptyArrayEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteEmptyArray() -} - -func (encoder emptyArrayEncoder) EncodeInterface(val interface{}, stream *Stream) { - stream.WriteEmptyArray() -} - -func (encoder emptyArrayEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return true -} - -type arrayEncoder struct { - arrayType reflect.Type - elemType reflect.Type - elemEncoder ValEncoder -} - -func (encoder *arrayEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteArrayStart() - elemPtr := unsafe.Pointer(ptr) - encoder.elemEncoder.Encode(elemPtr, stream) - for i := 1; i < encoder.arrayType.Len(); i++ { - stream.WriteMore() - elemPtr = unsafe.Pointer(uintptr(elemPtr) + encoder.elemType.Size()) - encoder.elemEncoder.Encode(unsafe.Pointer(elemPtr), stream) - } - stream.WriteArrayEnd() - if stream.Error != nil && stream.Error != io.EOF { - stream.Error = fmt.Errorf("%v: %s", encoder.arrayType, stream.Error.Error()) - } -} - -func (encoder *arrayEncoder) EncodeInterface(val interface{}, stream *Stream) { - // special optimization for interface{} - e := (*emptyInterface)(unsafe.Pointer(&val)) - if e.word == nil { - stream.WriteArrayStart() - stream.WriteNil() - stream.WriteArrayEnd() - return - } - elemType := encoder.arrayType.Elem() - if encoder.arrayType.Len() == 1 && (elemType.Kind() == reflect.Ptr || elemType.Kind() == reflect.Map) { - ptr := uintptr(e.word) - e.word = unsafe.Pointer(&ptr) - } - if reflect.TypeOf(val).Kind() == reflect.Ptr { - encoder.Encode(unsafe.Pointer(&e.word), stream) - } else { - encoder.Encode(e.word, stream) - } -} - -func (encoder *arrayEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return false -} - -type arrayDecoder struct { - arrayType reflect.Type - elemType reflect.Type - elemDecoder ValDecoder -} - -func (decoder *arrayDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - decoder.doDecode(ptr, iter) - if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%v: %s", decoder.arrayType, iter.Error.Error()) - } -} - -func (decoder *arrayDecoder) doDecode(ptr unsafe.Pointer, iter *Iterator) { - offset := uintptr(0) - iter.ReadArrayCB(func(iter *Iterator) bool { - if offset < decoder.arrayType.Size() { - decoder.elemDecoder.Decode(unsafe.Pointer(uintptr(ptr)+offset), iter) - offset += decoder.elemType.Size() - } else { - iter.Skip() - } - return true - }) -} diff --git a/vendor/github.com/json-iterator/go/feature_reflect_map.go b/vendor/github.com/json-iterator/go/feature_reflect_map.go deleted file mode 100644 index f537d026a..000000000 --- a/vendor/github.com/json-iterator/go/feature_reflect_map.go +++ /dev/null @@ -1,260 +0,0 @@ -package jsoniter - -import ( - "encoding" - "encoding/json" - "reflect" - "sort" - "strconv" - "unsafe" -) - -func decoderOfMap(cfg *frozenConfig, prefix string, typ reflect.Type) ValDecoder { - decoder := decoderOfType(cfg, prefix+"[map]->", typ.Elem()) - mapInterface := reflect.New(typ).Interface() - return &mapDecoder{typ, typ.Key(), typ.Elem(), decoder, extractInterface(mapInterface)} -} - -func encoderOfMap(cfg *frozenConfig, prefix string, typ reflect.Type) ValEncoder { - elemType := typ.Elem() - encoder := encoderOfType(cfg, prefix+"[map]->", elemType) - mapInterface := reflect.New(typ).Elem().Interface() - if cfg.sortMapKeys { - return &sortKeysMapEncoder{typ, elemType, encoder, *((*emptyInterface)(unsafe.Pointer(&mapInterface)))} - } - return &mapEncoder{typ, elemType, encoder, *((*emptyInterface)(unsafe.Pointer(&mapInterface)))} -} - -type mapDecoder struct { - mapType reflect.Type - keyType reflect.Type - elemType reflect.Type - elemDecoder ValDecoder - mapInterface emptyInterface -} - -func (decoder *mapDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - // dark magic to cast unsafe.Pointer back to interface{} using reflect.Type - mapInterface := decoder.mapInterface - mapInterface.word = ptr - realInterface := (*interface{})(unsafe.Pointer(&mapInterface)) - realVal := reflect.ValueOf(*realInterface).Elem() - if iter.ReadNil() { - realVal.Set(reflect.Zero(decoder.mapType)) - return - } - if realVal.IsNil() { - realVal.Set(reflect.MakeMap(realVal.Type())) - } - iter.ReadMapCB(func(iter *Iterator, keyStr string) bool { - elem := reflect.New(decoder.elemType) - decoder.elemDecoder.Decode(extractInterface(elem.Interface()).word, iter) - // to put into map, we have to use reflection - keyType := decoder.keyType - // TODO: remove this from loop - switch { - case keyType.Kind() == reflect.String: - realVal.SetMapIndex(reflect.ValueOf(keyStr).Convert(keyType), elem.Elem()) - return true - case keyType.Implements(textUnmarshalerType): - textUnmarshaler := reflect.New(keyType.Elem()).Interface().(encoding.TextUnmarshaler) - err := textUnmarshaler.UnmarshalText([]byte(keyStr)) - if err != nil { - iter.ReportError("read map key as TextUnmarshaler", err.Error()) - return false - } - realVal.SetMapIndex(reflect.ValueOf(textUnmarshaler), elem.Elem()) - return true - case reflect.PtrTo(keyType).Implements(textUnmarshalerType): - textUnmarshaler := reflect.New(keyType).Interface().(encoding.TextUnmarshaler) - err := textUnmarshaler.UnmarshalText([]byte(keyStr)) - if err != nil { - iter.ReportError("read map key as TextUnmarshaler", err.Error()) - return false - } - realVal.SetMapIndex(reflect.ValueOf(textUnmarshaler).Elem(), elem.Elem()) - return true - default: - switch keyType.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - n, err := strconv.ParseInt(keyStr, 10, 64) - if err != nil || reflect.Zero(keyType).OverflowInt(n) { - iter.ReportError("read map key as int64", "read int64 failed") - return false - } - realVal.SetMapIndex(reflect.ValueOf(n).Convert(keyType), elem.Elem()) - return true - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - n, err := strconv.ParseUint(keyStr, 10, 64) - if err != nil || reflect.Zero(keyType).OverflowUint(n) { - iter.ReportError("read map key as uint64", "read uint64 failed") - return false - } - realVal.SetMapIndex(reflect.ValueOf(n).Convert(keyType), elem.Elem()) - return true - } - } - iter.ReportError("read map key", "unexpected map key type "+keyType.String()) - return true - }) -} - -type mapEncoder struct { - mapType reflect.Type - elemType reflect.Type - elemEncoder ValEncoder - mapInterface emptyInterface -} - -func (encoder *mapEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - mapInterface := encoder.mapInterface - mapInterface.word = ptr - realInterface := (*interface{})(unsafe.Pointer(&mapInterface)) - realVal := reflect.ValueOf(*realInterface) - stream.WriteObjectStart() - for i, key := range realVal.MapKeys() { - if i != 0 { - stream.WriteMore() - } - encodeMapKey(key, stream) - if stream.indention > 0 { - stream.writeTwoBytes(byte(':'), byte(' ')) - } else { - stream.writeByte(':') - } - val := realVal.MapIndex(key).Interface() - encoder.elemEncoder.EncodeInterface(val, stream) - } - stream.WriteObjectEnd() -} - -func encodeMapKey(key reflect.Value, stream *Stream) { - if key.Kind() == reflect.String { - stream.WriteString(key.String()) - return - } - if tm, ok := key.Interface().(encoding.TextMarshaler); ok { - buf, err := tm.MarshalText() - if err != nil { - stream.Error = err - return - } - stream.writeByte('"') - stream.Write(buf) - stream.writeByte('"') - return - } - switch key.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - stream.writeByte('"') - stream.WriteInt64(key.Int()) - stream.writeByte('"') - return - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - stream.writeByte('"') - stream.WriteUint64(key.Uint()) - stream.writeByte('"') - return - } - stream.Error = &json.UnsupportedTypeError{Type: key.Type()} -} - -func (encoder *mapEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - -func (encoder *mapEncoder) IsEmpty(ptr unsafe.Pointer) bool { - mapInterface := encoder.mapInterface - mapInterface.word = ptr - realInterface := (*interface{})(unsafe.Pointer(&mapInterface)) - realVal := reflect.ValueOf(*realInterface) - return realVal.Len() == 0 -} - -type sortKeysMapEncoder struct { - mapType reflect.Type - elemType reflect.Type - elemEncoder ValEncoder - mapInterface emptyInterface -} - -func (encoder *sortKeysMapEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - mapInterface := encoder.mapInterface - mapInterface.word = ptr - realInterface := (*interface{})(unsafe.Pointer(&mapInterface)) - realVal := reflect.ValueOf(*realInterface) - - // Extract and sort the keys. - keys := realVal.MapKeys() - sv := stringValues(make([]reflectWithString, len(keys))) - for i, v := range keys { - sv[i].v = v - if err := sv[i].resolve(); err != nil { - stream.Error = err - return - } - } - sort.Sort(sv) - - stream.WriteObjectStart() - for i, key := range sv { - if i != 0 { - stream.WriteMore() - } - stream.WriteVal(key.s) // might need html escape, so can not WriteString directly - if stream.indention > 0 { - stream.writeTwoBytes(byte(':'), byte(' ')) - } else { - stream.writeByte(':') - } - val := realVal.MapIndex(key.v).Interface() - encoder.elemEncoder.EncodeInterface(val, stream) - } - stream.WriteObjectEnd() -} - -// stringValues is a slice of reflect.Value holding *reflect.StringValue. -// It implements the methods to sort by string. -type stringValues []reflectWithString - -type reflectWithString struct { - v reflect.Value - s string -} - -func (w *reflectWithString) resolve() error { - if w.v.Kind() == reflect.String { - w.s = w.v.String() - return nil - } - if tm, ok := w.v.Interface().(encoding.TextMarshaler); ok { - buf, err := tm.MarshalText() - w.s = string(buf) - return err - } - switch w.v.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - w.s = strconv.FormatInt(w.v.Int(), 10) - return nil - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - w.s = strconv.FormatUint(w.v.Uint(), 10) - return nil - } - return &json.UnsupportedTypeError{Type: w.v.Type()} -} - -func (sv stringValues) Len() int { return len(sv) } -func (sv stringValues) Swap(i, j int) { sv[i], sv[j] = sv[j], sv[i] } -func (sv stringValues) Less(i, j int) bool { return sv[i].s < sv[j].s } - -func (encoder *sortKeysMapEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - -func (encoder *sortKeysMapEncoder) IsEmpty(ptr unsafe.Pointer) bool { - mapInterface := encoder.mapInterface - mapInterface.word = ptr - realInterface := (*interface{})(unsafe.Pointer(&mapInterface)) - realVal := reflect.ValueOf(*realInterface) - return realVal.Len() == 0 -} diff --git a/vendor/github.com/json-iterator/go/feature_reflect_native.go b/vendor/github.com/json-iterator/go/feature_reflect_native.go deleted file mode 100644 index 464a8f7a6..000000000 --- a/vendor/github.com/json-iterator/go/feature_reflect_native.go +++ /dev/null @@ -1,789 +0,0 @@ -package jsoniter - -import ( - "encoding" - "encoding/base64" - "encoding/json" - "reflect" - "unsafe" -) - -type stringCodec struct { -} - -func (codec *stringCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - *((*string)(ptr)) = iter.ReadString() -} - -func (codec *stringCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - str := *((*string)(ptr)) - stream.WriteString(str) -} - -func (codec *stringCodec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *stringCodec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*string)(ptr)) == "" -} - -type intCodec struct { -} - -func (codec *intCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*int)(ptr)) = iter.ReadInt() - } -} - -func (codec *intCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteInt(*((*int)(ptr))) -} - -func (codec *intCodec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *intCodec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*int)(ptr)) == 0 -} - -type uintptrCodec struct { -} - -func (codec *uintptrCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*uintptr)(ptr)) = uintptr(iter.ReadUint64()) - } -} - -func (codec *uintptrCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteUint64(uint64(*((*uintptr)(ptr)))) -} - -func (codec *uintptrCodec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *uintptrCodec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*uintptr)(ptr)) == 0 -} - -type int8Codec struct { -} - -func (codec *int8Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*int8)(ptr)) = iter.ReadInt8() - } -} - -func (codec *int8Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteInt8(*((*int8)(ptr))) -} - -func (codec *int8Codec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *int8Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*int8)(ptr)) == 0 -} - -type int16Codec struct { -} - -func (codec *int16Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*int16)(ptr)) = iter.ReadInt16() - } -} - -func (codec *int16Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteInt16(*((*int16)(ptr))) -} - -func (codec *int16Codec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *int16Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*int16)(ptr)) == 0 -} - -type int32Codec struct { -} - -func (codec *int32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*int32)(ptr)) = iter.ReadInt32() - } -} - -func (codec *int32Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteInt32(*((*int32)(ptr))) -} - -func (codec *int32Codec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *int32Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*int32)(ptr)) == 0 -} - -type int64Codec struct { -} - -func (codec *int64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*int64)(ptr)) = iter.ReadInt64() - } -} - -func (codec *int64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteInt64(*((*int64)(ptr))) -} - -func (codec *int64Codec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *int64Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*int64)(ptr)) == 0 -} - -type uintCodec struct { -} - -func (codec *uintCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*uint)(ptr)) = iter.ReadUint() - return - } -} - -func (codec *uintCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteUint(*((*uint)(ptr))) -} - -func (codec *uintCodec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *uintCodec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*uint)(ptr)) == 0 -} - -type uint8Codec struct { -} - -func (codec *uint8Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*uint8)(ptr)) = iter.ReadUint8() - } -} - -func (codec *uint8Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteUint8(*((*uint8)(ptr))) -} - -func (codec *uint8Codec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *uint8Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*uint8)(ptr)) == 0 -} - -type uint16Codec struct { -} - -func (codec *uint16Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*uint16)(ptr)) = iter.ReadUint16() - } -} - -func (codec *uint16Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteUint16(*((*uint16)(ptr))) -} - -func (codec *uint16Codec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *uint16Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*uint16)(ptr)) == 0 -} - -type uint32Codec struct { -} - -func (codec *uint32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*uint32)(ptr)) = iter.ReadUint32() - } -} - -func (codec *uint32Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteUint32(*((*uint32)(ptr))) -} - -func (codec *uint32Codec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *uint32Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*uint32)(ptr)) == 0 -} - -type uint64Codec struct { -} - -func (codec *uint64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*uint64)(ptr)) = iter.ReadUint64() - } -} - -func (codec *uint64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteUint64(*((*uint64)(ptr))) -} - -func (codec *uint64Codec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *uint64Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*uint64)(ptr)) == 0 -} - -type float32Codec struct { -} - -func (codec *float32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*float32)(ptr)) = iter.ReadFloat32() - } -} - -func (codec *float32Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteFloat32(*((*float32)(ptr))) -} - -func (codec *float32Codec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *float32Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*float32)(ptr)) == 0 -} - -type float64Codec struct { -} - -func (codec *float64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*float64)(ptr)) = iter.ReadFloat64() - } -} - -func (codec *float64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteFloat64(*((*float64)(ptr))) -} - -func (codec *float64Codec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *float64Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*float64)(ptr)) == 0 -} - -type boolCodec struct { -} - -func (codec *boolCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*bool)(ptr)) = iter.ReadBool() - } -} - -func (codec *boolCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteBool(*((*bool)(ptr))) -} - -func (codec *boolCodec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *boolCodec) IsEmpty(ptr unsafe.Pointer) bool { - return !(*((*bool)(ptr))) -} - -type emptyInterfaceCodec struct { -} - -func (codec *emptyInterfaceCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - existing := *((*interface{})(ptr)) - - // Checking for both typed and untyped nil pointers. - if existing != nil && - reflect.TypeOf(existing).Kind() == reflect.Ptr && - !reflect.ValueOf(existing).IsNil() { - - var ptrToExisting interface{} - for { - elem := reflect.ValueOf(existing).Elem() - if elem.Kind() != reflect.Ptr || elem.IsNil() { - break - } - ptrToExisting = existing - existing = elem.Interface() - } - - if iter.ReadNil() { - if ptrToExisting != nil { - nilPtr := reflect.Zero(reflect.TypeOf(ptrToExisting).Elem()) - reflect.ValueOf(ptrToExisting).Elem().Set(nilPtr) - } else { - *((*interface{})(ptr)) = nil - } - } else { - iter.ReadVal(existing) - } - - return - } - - if iter.ReadNil() { - *((*interface{})(ptr)) = nil - } else { - *((*interface{})(ptr)) = iter.Read() - } -} - -func (codec *emptyInterfaceCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteVal(*((*interface{})(ptr))) -} - -func (codec *emptyInterfaceCodec) EncodeInterface(val interface{}, stream *Stream) { - stream.WriteVal(val) -} - -func (codec *emptyInterfaceCodec) IsEmpty(ptr unsafe.Pointer) bool { - emptyInterface := (*emptyInterface)(ptr) - return emptyInterface.typ == nil -} - -type nonEmptyInterfaceCodec struct { -} - -func (codec *nonEmptyInterfaceCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if iter.WhatIsNext() == NilValue { - iter.skipFourBytes('n', 'u', 'l', 'l') - *((*interface{})(ptr)) = nil - return - } - nonEmptyInterface := (*nonEmptyInterface)(ptr) - if nonEmptyInterface.itab == nil { - iter.ReportError("read non-empty interface", "do not know which concrete type to decode to") - return - } - var i interface{} - e := (*emptyInterface)(unsafe.Pointer(&i)) - e.typ = nonEmptyInterface.itab.typ - e.word = nonEmptyInterface.word - iter.ReadVal(&i) - if e.word == nil { - nonEmptyInterface.itab = nil - } - nonEmptyInterface.word = e.word -} - -func (codec *nonEmptyInterfaceCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - nonEmptyInterface := (*nonEmptyInterface)(ptr) - var i interface{} - if nonEmptyInterface.itab != nil { - e := (*emptyInterface)(unsafe.Pointer(&i)) - e.typ = nonEmptyInterface.itab.typ - e.word = nonEmptyInterface.word - } - stream.WriteVal(i) -} - -func (codec *nonEmptyInterfaceCodec) EncodeInterface(val interface{}, stream *Stream) { - stream.WriteVal(val) -} - -func (codec *nonEmptyInterfaceCodec) IsEmpty(ptr unsafe.Pointer) bool { - nonEmptyInterface := (*nonEmptyInterface)(ptr) - return nonEmptyInterface.word == nil -} - -type anyCodec struct { -} - -func (codec *anyCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - *((*Any)(ptr)) = iter.ReadAny() -} - -func (codec *anyCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - (*((*Any)(ptr))).WriteTo(stream) -} - -func (codec *anyCodec) EncodeInterface(val interface{}, stream *Stream) { - (val.(Any)).WriteTo(stream) -} - -func (codec *anyCodec) IsEmpty(ptr unsafe.Pointer) bool { - return (*((*Any)(ptr))).Size() == 0 -} - -type jsonNumberCodec struct { -} - -func (codec *jsonNumberCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - switch iter.WhatIsNext() { - case StringValue: - *((*json.Number)(ptr)) = json.Number(iter.ReadString()) - case NilValue: - iter.skipFourBytes('n', 'u', 'l', 'l') - *((*json.Number)(ptr)) = "" - default: - *((*json.Number)(ptr)) = json.Number([]byte(iter.readNumberAsString())) - } -} - -func (codec *jsonNumberCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - number := *((*json.Number)(ptr)) - if len(number) == 0 { - stream.WriteRaw("0") - } else { - stream.WriteRaw(string(number)) - } -} - -func (codec *jsonNumberCodec) EncodeInterface(val interface{}, stream *Stream) { - number := val.(json.Number) - if len(number) == 0 { - stream.WriteRaw("0") - } else { - stream.WriteRaw(string(number)) - } -} - -func (codec *jsonNumberCodec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*json.Number)(ptr))) == 0 -} - -type jsoniterNumberCodec struct { -} - -func (codec *jsoniterNumberCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - switch iter.WhatIsNext() { - case StringValue: - *((*Number)(ptr)) = Number(iter.ReadString()) - case NilValue: - iter.skipFourBytes('n', 'u', 'l', 'l') - *((*Number)(ptr)) = "" - default: - *((*Number)(ptr)) = Number([]byte(iter.readNumberAsString())) - } -} - -func (codec *jsoniterNumberCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - number := *((*Number)(ptr)) - if len(number) == 0 { - stream.WriteRaw("0") - } else { - stream.WriteRaw(string(number)) - } -} - -func (codec *jsoniterNumberCodec) EncodeInterface(val interface{}, stream *Stream) { - number := val.(Number) - if len(number) == 0 { - stream.WriteRaw("0") - } else { - stream.WriteRaw(string(number)) - } -} - -func (codec *jsoniterNumberCodec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*Number)(ptr))) == 0 -} - -type jsonRawMessageCodec struct { -} - -func (codec *jsonRawMessageCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - *((*json.RawMessage)(ptr)) = json.RawMessage(iter.SkipAndReturnBytes()) -} - -func (codec *jsonRawMessageCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteRaw(string(*((*json.RawMessage)(ptr)))) -} - -func (codec *jsonRawMessageCodec) EncodeInterface(val interface{}, stream *Stream) { - stream.WriteRaw(string(val.(json.RawMessage))) -} - -func (codec *jsonRawMessageCodec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*json.RawMessage)(ptr))) == 0 -} - -type jsoniterRawMessageCodec struct { -} - -func (codec *jsoniterRawMessageCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - *((*RawMessage)(ptr)) = RawMessage(iter.SkipAndReturnBytes()) -} - -func (codec *jsoniterRawMessageCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteRaw(string(*((*RawMessage)(ptr)))) -} - -func (codec *jsoniterRawMessageCodec) EncodeInterface(val interface{}, stream *Stream) { - stream.WriteRaw(string(val.(RawMessage))) -} - -func (codec *jsoniterRawMessageCodec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*RawMessage)(ptr))) == 0 -} - -type base64Codec struct { - sliceDecoder ValDecoder -} - -func (codec *base64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if iter.ReadNil() { - ptrSlice := (*sliceHeader)(ptr) - ptrSlice.Len = 0 - ptrSlice.Cap = 0 - ptrSlice.Data = nil - return - } - switch iter.WhatIsNext() { - case StringValue: - encoding := base64.StdEncoding - src := iter.SkipAndReturnBytes() - src = src[1 : len(src)-1] - decodedLen := encoding.DecodedLen(len(src)) - dst := make([]byte, decodedLen) - len, err := encoding.Decode(dst, src) - if err != nil { - iter.ReportError("decode base64", err.Error()) - } else { - dst = dst[:len] - dstSlice := (*sliceHeader)(unsafe.Pointer(&dst)) - ptrSlice := (*sliceHeader)(ptr) - ptrSlice.Data = dstSlice.Data - ptrSlice.Cap = dstSlice.Cap - ptrSlice.Len = dstSlice.Len - } - case ArrayValue: - codec.sliceDecoder.Decode(ptr, iter) - default: - iter.ReportError("base64Codec", "invalid input") - } -} - -func (codec *base64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - src := *((*[]byte)(ptr)) - if len(src) == 0 { - stream.WriteNil() - return - } - encoding := base64.StdEncoding - stream.writeByte('"') - toGrow := encoding.EncodedLen(len(src)) - stream.ensure(toGrow) - encoding.Encode(stream.buf[stream.n:], src) - stream.n += toGrow - stream.writeByte('"') -} - -func (codec *base64Codec) EncodeInterface(val interface{}, stream *Stream) { - ptr := extractInterface(val).word - src := *((*[]byte)(ptr)) - if len(src) == 0 { - stream.WriteNil() - return - } - encoding := base64.StdEncoding - stream.writeByte('"') - toGrow := encoding.EncodedLen(len(src)) - stream.ensure(toGrow) - encoding.Encode(stream.buf[stream.n:], src) - stream.n += toGrow - stream.writeByte('"') -} - -func (codec *base64Codec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*[]byte)(ptr))) == 0 -} - -type stringModeNumberDecoder struct { - elemDecoder ValDecoder -} - -func (decoder *stringModeNumberDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - c := iter.nextToken() - if c != '"' { - iter.ReportError("stringModeNumberDecoder", `expect ", but found `+string([]byte{c})) - return - } - decoder.elemDecoder.Decode(ptr, iter) - if iter.Error != nil { - return - } - c = iter.readByte() - if c != '"' { - iter.ReportError("stringModeNumberDecoder", `expect ", but found `+string([]byte{c})) - return - } -} - -type stringModeStringDecoder struct { - elemDecoder ValDecoder - cfg *frozenConfig -} - -func (decoder *stringModeStringDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - decoder.elemDecoder.Decode(ptr, iter) - str := *((*string)(ptr)) - tempIter := decoder.cfg.BorrowIterator([]byte(str)) - defer decoder.cfg.ReturnIterator(tempIter) - *((*string)(ptr)) = tempIter.ReadString() -} - -type stringModeNumberEncoder struct { - elemEncoder ValEncoder -} - -func (encoder *stringModeNumberEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.writeByte('"') - encoder.elemEncoder.Encode(ptr, stream) - stream.writeByte('"') -} - -func (encoder *stringModeNumberEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - -func (encoder *stringModeNumberEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.elemEncoder.IsEmpty(ptr) -} - -type stringModeStringEncoder struct { - elemEncoder ValEncoder - cfg *frozenConfig -} - -func (encoder *stringModeStringEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - tempStream := encoder.cfg.BorrowStream(nil) - defer encoder.cfg.ReturnStream(tempStream) - encoder.elemEncoder.Encode(ptr, tempStream) - stream.WriteString(string(tempStream.Buffer())) -} - -func (encoder *stringModeStringEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - -func (encoder *stringModeStringEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.elemEncoder.IsEmpty(ptr) -} - -type marshalerEncoder struct { - templateInterface emptyInterface - checkIsEmpty checkIsEmpty -} - -func (encoder *marshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - templateInterface := encoder.templateInterface - templateInterface.word = ptr - realInterface := (*interface{})(unsafe.Pointer(&templateInterface)) - marshaler, ok := (*realInterface).(json.Marshaler) - if !ok { - stream.WriteVal(nil) - return - } - - bytes, err := marshaler.MarshalJSON() - if err != nil { - stream.Error = err - } else { - stream.Write(bytes) - } -} -func (encoder *marshalerEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - -func (encoder *marshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.checkIsEmpty.IsEmpty(ptr) -} - -type textMarshalerEncoder struct { - templateInterface emptyInterface - checkIsEmpty checkIsEmpty -} - -func (encoder *textMarshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - templateInterface := encoder.templateInterface - templateInterface.word = ptr - realInterface := (*interface{})(unsafe.Pointer(&templateInterface)) - marshaler := (*realInterface).(encoding.TextMarshaler) - bytes, err := marshaler.MarshalText() - if err != nil { - stream.Error = err - } else { - stream.WriteString(string(bytes)) - } -} - -func (encoder *textMarshalerEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - -func (encoder *textMarshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.checkIsEmpty.IsEmpty(ptr) -} - -type unmarshalerDecoder struct { - templateInterface emptyInterface -} - -func (decoder *unmarshalerDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - templateInterface := decoder.templateInterface - templateInterface.word = ptr - realInterface := (*interface{})(unsafe.Pointer(&templateInterface)) - unmarshaler := (*realInterface).(json.Unmarshaler) - iter.nextToken() - iter.unreadByte() // skip spaces - bytes := iter.SkipAndReturnBytes() - err := unmarshaler.UnmarshalJSON(bytes) - if err != nil { - iter.ReportError("unmarshalerDecoder", err.Error()) - } -} - -type textUnmarshalerDecoder struct { - templateInterface emptyInterface -} - -func (decoder *textUnmarshalerDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - templateInterface := decoder.templateInterface - templateInterface.word = ptr - realInterface := (*interface{})(unsafe.Pointer(&templateInterface)) - unmarshaler := (*realInterface).(encoding.TextUnmarshaler) - str := iter.ReadString() - err := unmarshaler.UnmarshalText([]byte(str)) - if err != nil { - iter.ReportError("textUnmarshalerDecoder", err.Error()) - } -} diff --git a/vendor/github.com/json-iterator/go/feature_reflect_slice.go b/vendor/github.com/json-iterator/go/feature_reflect_slice.go deleted file mode 100644 index 078b3bc07..000000000 --- a/vendor/github.com/json-iterator/go/feature_reflect_slice.go +++ /dev/null @@ -1,143 +0,0 @@ -package jsoniter - -import ( - "fmt" - "io" - "reflect" - "unsafe" -) - -func decoderOfSlice(cfg *frozenConfig, prefix string, typ reflect.Type) ValDecoder { - decoder := decoderOfType(cfg, prefix+"[slice]->", typ.Elem()) - return &sliceDecoder{typ, typ.Elem(), decoder} -} - -func encoderOfSlice(cfg *frozenConfig, prefix string, typ reflect.Type) ValEncoder { - encoder := encoderOfType(cfg, prefix+"[slice]->", typ.Elem()) - if typ.Elem().Kind() == reflect.Map { - encoder = &OptionalEncoder{encoder} - } - return &sliceEncoder{typ, typ.Elem(), encoder} -} - -type sliceEncoder struct { - sliceType reflect.Type - elemType reflect.Type - elemEncoder ValEncoder -} - -func (encoder *sliceEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - slice := (*sliceHeader)(ptr) - if slice.Data == nil { - stream.WriteNil() - return - } - if slice.Len == 0 { - stream.WriteEmptyArray() - return - } - stream.WriteArrayStart() - elemPtr := unsafe.Pointer(slice.Data) - encoder.elemEncoder.Encode(unsafe.Pointer(elemPtr), stream) - for i := 1; i < slice.Len; i++ { - stream.WriteMore() - elemPtr = unsafe.Pointer(uintptr(elemPtr) + encoder.elemType.Size()) - encoder.elemEncoder.Encode(unsafe.Pointer(elemPtr), stream) - } - stream.WriteArrayEnd() - if stream.Error != nil && stream.Error != io.EOF { - stream.Error = fmt.Errorf("%v: %s", encoder.sliceType, stream.Error.Error()) - } -} - -func (encoder *sliceEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - -func (encoder *sliceEncoder) IsEmpty(ptr unsafe.Pointer) bool { - slice := (*sliceHeader)(ptr) - return slice.Len == 0 -} - -type sliceDecoder struct { - sliceType reflect.Type - elemType reflect.Type - elemDecoder ValDecoder -} - -// sliceHeader is a safe version of SliceHeader used within this package. -type sliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -func (decoder *sliceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - decoder.doDecode(ptr, iter) - if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%v: %s", decoder.sliceType, iter.Error.Error()) - } -} - -func (decoder *sliceDecoder) doDecode(ptr unsafe.Pointer, iter *Iterator) { - slice := (*sliceHeader)(ptr) - if iter.ReadNil() { - slice.Len = 0 - slice.Cap = 0 - slice.Data = nil - return - } - reuseSlice(slice, decoder.sliceType, 4) - slice.Len = 0 - offset := uintptr(0) - iter.ReadArrayCB(func(iter *Iterator) bool { - growOne(slice, decoder.sliceType, decoder.elemType) - decoder.elemDecoder.Decode(unsafe.Pointer(uintptr(slice.Data)+offset), iter) - offset += decoder.elemType.Size() - return true - }) -} - -// grow grows the slice s so that it can hold extra more values, allocating -// more capacity if needed. It also returns the old and new slice lengths. -func growOne(slice *sliceHeader, sliceType reflect.Type, elementType reflect.Type) { - newLen := slice.Len + 1 - if newLen <= slice.Cap { - slice.Len = newLen - return - } - newCap := slice.Cap - if newCap == 0 { - newCap = 1 - } else { - for newCap < newLen { - if slice.Len < 1024 { - newCap += newCap - } else { - newCap += newCap / 4 - } - } - } - newVal := reflect.MakeSlice(sliceType, newLen, newCap).Interface() - newValPtr := extractInterface(newVal).word - dst := (*sliceHeader)(newValPtr).Data - // copy old array into new array - originalBytesCount := slice.Len * int(elementType.Size()) - srcSliceHeader := (unsafe.Pointer)(&sliceHeader{slice.Data, originalBytesCount, originalBytesCount}) - dstSliceHeader := (unsafe.Pointer)(&sliceHeader{dst, originalBytesCount, originalBytesCount}) - copy(*(*[]byte)(dstSliceHeader), *(*[]byte)(srcSliceHeader)) - slice.Data = dst - slice.Len = newLen - slice.Cap = newCap -} - -func reuseSlice(slice *sliceHeader, sliceType reflect.Type, expectedCap int) { - if expectedCap <= slice.Cap { - return - } - newVal := reflect.MakeSlice(sliceType, 0, expectedCap).Interface() - newValPtr := extractInterface(newVal).word - dst := (*sliceHeader)(newValPtr).Data - slice.Data = dst - slice.Cap = expectedCap -} diff --git a/vendor/github.com/json-iterator/go/feature_stream_int.go b/vendor/github.com/json-iterator/go/feature_stream_int.go deleted file mode 100644 index 7cfd522c1..000000000 --- a/vendor/github.com/json-iterator/go/feature_stream_int.go +++ /dev/null @@ -1,320 +0,0 @@ -package jsoniter - -var digits []uint32 - -func init() { - digits = make([]uint32, 1000) - for i := uint32(0); i < 1000; i++ { - digits[i] = (((i / 100) + '0') << 16) + ((((i / 10) % 10) + '0') << 8) + i%10 + '0' - if i < 10 { - digits[i] += 2 << 24 - } else if i < 100 { - digits[i] += 1 << 24 - } - } -} - -func writeFirstBuf(buf []byte, v uint32, n int) int { - start := v >> 24 - if start == 0 { - buf[n] = byte(v >> 16) - n++ - buf[n] = byte(v >> 8) - n++ - } else if start == 1 { - buf[n] = byte(v >> 8) - n++ - } - buf[n] = byte(v) - n++ - return n -} - -func writeBuf(buf []byte, v uint32, n int) { - buf[n] = byte(v >> 16) - buf[n+1] = byte(v >> 8) - buf[n+2] = byte(v) -} - -// WriteUint8 write uint8 to stream -func (stream *Stream) WriteUint8(val uint8) { - stream.ensure(3) - stream.n = writeFirstBuf(stream.buf, digits[val], stream.n) -} - -// WriteInt8 write int8 to stream -func (stream *Stream) WriteInt8(nval int8) { - stream.ensure(4) - n := stream.n - var val uint8 - if nval < 0 { - val = uint8(-nval) - stream.buf[n] = '-' - n++ - } else { - val = uint8(nval) - } - stream.n = writeFirstBuf(stream.buf, digits[val], n) -} - -// WriteUint16 write uint16 to stream -func (stream *Stream) WriteUint16(val uint16) { - stream.ensure(5) - q1 := val / 1000 - if q1 == 0 { - stream.n = writeFirstBuf(stream.buf, digits[val], stream.n) - return - } - r1 := val - q1*1000 - n := writeFirstBuf(stream.buf, digits[q1], stream.n) - writeBuf(stream.buf, digits[r1], n) - stream.n = n + 3 - return -} - -// WriteInt16 write int16 to stream -func (stream *Stream) WriteInt16(nval int16) { - stream.ensure(6) - n := stream.n - var val uint16 - if nval < 0 { - val = uint16(-nval) - stream.buf[n] = '-' - n++ - } else { - val = uint16(nval) - } - q1 := val / 1000 - if q1 == 0 { - stream.n = writeFirstBuf(stream.buf, digits[val], n) - return - } - r1 := val - q1*1000 - n = writeFirstBuf(stream.buf, digits[q1], n) - writeBuf(stream.buf, digits[r1], n) - stream.n = n + 3 - return -} - -// WriteUint32 write uint32 to stream -func (stream *Stream) WriteUint32(val uint32) { - stream.ensure(10) - n := stream.n - q1 := val / 1000 - if q1 == 0 { - stream.n = writeFirstBuf(stream.buf, digits[val], n) - return - } - r1 := val - q1*1000 - q2 := q1 / 1000 - if q2 == 0 { - n := writeFirstBuf(stream.buf, digits[q1], n) - writeBuf(stream.buf, digits[r1], n) - stream.n = n + 3 - return - } - r2 := q1 - q2*1000 - q3 := q2 / 1000 - if q3 == 0 { - n = writeFirstBuf(stream.buf, digits[q2], n) - } else { - r3 := q2 - q3*1000 - stream.buf[n] = byte(q3 + '0') - n++ - writeBuf(stream.buf, digits[r3], n) - n += 3 - } - writeBuf(stream.buf, digits[r2], n) - writeBuf(stream.buf, digits[r1], n+3) - stream.n = n + 6 -} - -// WriteInt32 write int32 to stream -func (stream *Stream) WriteInt32(nval int32) { - stream.ensure(11) - n := stream.n - var val uint32 - if nval < 0 { - val = uint32(-nval) - stream.buf[n] = '-' - n++ - } else { - val = uint32(nval) - } - q1 := val / 1000 - if q1 == 0 { - stream.n = writeFirstBuf(stream.buf, digits[val], n) - return - } - r1 := val - q1*1000 - q2 := q1 / 1000 - if q2 == 0 { - n := writeFirstBuf(stream.buf, digits[q1], n) - writeBuf(stream.buf, digits[r1], n) - stream.n = n + 3 - return - } - r2 := q1 - q2*1000 - q3 := q2 / 1000 - if q3 == 0 { - n = writeFirstBuf(stream.buf, digits[q2], n) - } else { - r3 := q2 - q3*1000 - stream.buf[n] = byte(q3 + '0') - n++ - writeBuf(stream.buf, digits[r3], n) - n += 3 - } - writeBuf(stream.buf, digits[r2], n) - writeBuf(stream.buf, digits[r1], n+3) - stream.n = n + 6 -} - -// WriteUint64 write uint64 to stream -func (stream *Stream) WriteUint64(val uint64) { - stream.ensure(20) - n := stream.n - q1 := val / 1000 - if q1 == 0 { - stream.n = writeFirstBuf(stream.buf, digits[val], n) - return - } - r1 := val - q1*1000 - q2 := q1 / 1000 - if q2 == 0 { - n := writeFirstBuf(stream.buf, digits[q1], n) - writeBuf(stream.buf, digits[r1], n) - stream.n = n + 3 - return - } - r2 := q1 - q2*1000 - q3 := q2 / 1000 - if q3 == 0 { - n = writeFirstBuf(stream.buf, digits[q2], n) - writeBuf(stream.buf, digits[r2], n) - writeBuf(stream.buf, digits[r1], n+3) - stream.n = n + 6 - return - } - r3 := q2 - q3*1000 - q4 := q3 / 1000 - if q4 == 0 { - n = writeFirstBuf(stream.buf, digits[q3], n) - writeBuf(stream.buf, digits[r3], n) - writeBuf(stream.buf, digits[r2], n+3) - writeBuf(stream.buf, digits[r1], n+6) - stream.n = n + 9 - return - } - r4 := q3 - q4*1000 - q5 := q4 / 1000 - if q5 == 0 { - n = writeFirstBuf(stream.buf, digits[q4], n) - writeBuf(stream.buf, digits[r4], n) - writeBuf(stream.buf, digits[r3], n+3) - writeBuf(stream.buf, digits[r2], n+6) - writeBuf(stream.buf, digits[r1], n+9) - stream.n = n + 12 - return - } - r5 := q4 - q5*1000 - q6 := q5 / 1000 - if q6 == 0 { - n = writeFirstBuf(stream.buf, digits[q5], n) - } else { - n = writeFirstBuf(stream.buf, digits[q6], n) - r6 := q5 - q6*1000 - writeBuf(stream.buf, digits[r6], n) - n += 3 - } - writeBuf(stream.buf, digits[r5], n) - writeBuf(stream.buf, digits[r4], n+3) - writeBuf(stream.buf, digits[r3], n+6) - writeBuf(stream.buf, digits[r2], n+9) - writeBuf(stream.buf, digits[r1], n+12) - stream.n = n + 15 -} - -// WriteInt64 write int64 to stream -func (stream *Stream) WriteInt64(nval int64) { - stream.ensure(20) - n := stream.n - var val uint64 - if nval < 0 { - val = uint64(-nval) - stream.buf[n] = '-' - n++ - } else { - val = uint64(nval) - } - q1 := val / 1000 - if q1 == 0 { - stream.n = writeFirstBuf(stream.buf, digits[val], n) - return - } - r1 := val - q1*1000 - q2 := q1 / 1000 - if q2 == 0 { - n := writeFirstBuf(stream.buf, digits[q1], n) - writeBuf(stream.buf, digits[r1], n) - stream.n = n + 3 - return - } - r2 := q1 - q2*1000 - q3 := q2 / 1000 - if q3 == 0 { - n = writeFirstBuf(stream.buf, digits[q2], n) - writeBuf(stream.buf, digits[r2], n) - writeBuf(stream.buf, digits[r1], n+3) - stream.n = n + 6 - return - } - r3 := q2 - q3*1000 - q4 := q3 / 1000 - if q4 == 0 { - n = writeFirstBuf(stream.buf, digits[q3], n) - writeBuf(stream.buf, digits[r3], n) - writeBuf(stream.buf, digits[r2], n+3) - writeBuf(stream.buf, digits[r1], n+6) - stream.n = n + 9 - return - } - r4 := q3 - q4*1000 - q5 := q4 / 1000 - if q5 == 0 { - n = writeFirstBuf(stream.buf, digits[q4], n) - writeBuf(stream.buf, digits[r4], n) - writeBuf(stream.buf, digits[r3], n+3) - writeBuf(stream.buf, digits[r2], n+6) - writeBuf(stream.buf, digits[r1], n+9) - stream.n = n + 12 - return - } - r5 := q4 - q5*1000 - q6 := q5 / 1000 - if q6 == 0 { - n = writeFirstBuf(stream.buf, digits[q5], n) - } else { - stream.buf[n] = byte(q6 + '0') - n++ - r6 := q5 - q6*1000 - writeBuf(stream.buf, digits[r6], n) - n += 3 - } - writeBuf(stream.buf, digits[r5], n) - writeBuf(stream.buf, digits[r4], n+3) - writeBuf(stream.buf, digits[r3], n+6) - writeBuf(stream.buf, digits[r2], n+9) - writeBuf(stream.buf, digits[r1], n+12) - stream.n = n + 15 -} - -// WriteInt write int to stream -func (stream *Stream) WriteInt(val int) { - stream.WriteInt64(int64(val)) -} - -// WriteUint write uint to stream -func (stream *Stream) WriteUint(val uint) { - stream.WriteUint64(uint64(val)) -} diff --git a/vendor/github.com/json-iterator/go/feature_iter.go b/vendor/github.com/json-iterator/go/iter.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_iter.go rename to vendor/github.com/json-iterator/go/iter.go diff --git a/vendor/github.com/json-iterator/go/feature_iter_array.go b/vendor/github.com/json-iterator/go/iter_array.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_iter_array.go rename to vendor/github.com/json-iterator/go/iter_array.go diff --git a/vendor/github.com/json-iterator/go/feature_iter_float.go b/vendor/github.com/json-iterator/go/iter_float.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_iter_float.go rename to vendor/github.com/json-iterator/go/iter_float.go diff --git a/vendor/github.com/json-iterator/go/feature_iter_int.go b/vendor/github.com/json-iterator/go/iter_int.go similarity index 98% rename from vendor/github.com/json-iterator/go/feature_iter_int.go rename to vendor/github.com/json-iterator/go/iter_int.go index 4781c6393..214232035 100644 --- a/vendor/github.com/json-iterator/go/feature_iter_int.go +++ b/vendor/github.com/json-iterator/go/iter_int.go @@ -22,11 +22,17 @@ func init() { // ReadUint read uint func (iter *Iterator) ReadUint() uint { + if strconv.IntSize == 32 { + return uint(iter.ReadUint32()) + } return uint(iter.ReadUint64()) } // ReadInt read int func (iter *Iterator) ReadInt() int { + if strconv.IntSize == 32 { + return int(iter.ReadInt32()) + } return int(iter.ReadInt64()) } diff --git a/vendor/github.com/json-iterator/go/feature_iter_object.go b/vendor/github.com/json-iterator/go/iter_object.go similarity index 68% rename from vendor/github.com/json-iterator/go/feature_iter_object.go rename to vendor/github.com/json-iterator/go/iter_object.go index dfd91fa60..ebd3da895 100644 --- a/vendor/github.com/json-iterator/go/feature_iter_object.go +++ b/vendor/github.com/json-iterator/go/iter_object.go @@ -3,7 +3,6 @@ package jsoniter import ( "fmt" "unicode" - "unsafe" ) // ReadObject read one field from object. @@ -19,16 +18,12 @@ func (iter *Iterator) ReadObject() (ret string) { c = iter.nextToken() if c == '"' { iter.unreadByte() - if iter.cfg.objectFieldMustBeSimpleString { - return string(iter.readObjectFieldAsBytes()) - } else { - field := iter.ReadString() - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } - return field + field := iter.ReadString() + c = iter.nextToken() + if c != ':' { + iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) } + return field } if c == '}' { return "" // end of object @@ -36,16 +31,12 @@ func (iter *Iterator) ReadObject() (ret string) { iter.ReportError("ReadObject", `expect " after {, but found `+string([]byte{c})) return case ',': - if iter.cfg.objectFieldMustBeSimpleString { - return string(iter.readObjectFieldAsBytes()) - } else { - field := iter.ReadString() - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } - return field + field := iter.ReadString() + c = iter.nextToken() + if c != ':' { + iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) } + return field case '}': return "" // end of object default: @@ -54,97 +45,87 @@ func (iter *Iterator) ReadObject() (ret string) { } } -func (iter *Iterator) readFieldHash() int32 { +// CaseInsensitive +func (iter *Iterator) readFieldHash() int64 { hash := int64(0x811c9dc5) c := iter.nextToken() - if c == '"' { - for { - for i := iter.head; i < iter.tail; i++ { - // require ascii string and no escape - b := iter.buf[i] - if !iter.cfg.objectFieldMustBeSimpleString && b == '\\' { - iter.head = i - for _, b := range iter.readStringSlowPath() { - if 'A' <= b && b <= 'Z' { - b += 'a' - 'A' - } - hash ^= int64(b) - hash *= 0x1000193 - } - c = iter.nextToken() - if c != ':' { - iter.ReportError("readFieldHash", `expect :, but found `+string([]byte{c})) - return 0 + if c != '"' { + iter.ReportError("readFieldHash", `expect ", but found `+string([]byte{c})) + return 0 + } + for { + for i := iter.head; i < iter.tail; i++ { + // require ascii string and no escape + b := iter.buf[i] + if b == '\\' { + iter.head = i + for _, b := range iter.readStringSlowPath() { + if 'A' <= b && b <= 'Z' { + b += 'a' - 'A' } - return int32(hash) + hash ^= int64(b) + hash *= 0x1000193 } - if b == '"' { - iter.head = i + 1 - c = iter.nextToken() - if c != ':' { - iter.ReportError("readFieldHash", `expect :, but found `+string([]byte{c})) - return 0 - } - return int32(hash) + c = iter.nextToken() + if c != ':' { + iter.ReportError("readFieldHash", `expect :, but found `+string([]byte{c})) + return 0 } - if 'A' <= b && b <= 'Z' { - b += 'a' - 'A' + return hash + } + if b == '"' { + iter.head = i + 1 + c = iter.nextToken() + if c != ':' { + iter.ReportError("readFieldHash", `expect :, but found `+string([]byte{c})) + return 0 } - hash ^= int64(b) - hash *= 0x1000193 + return hash } - if !iter.loadMore() { - iter.ReportError("readFieldHash", `incomplete field name`) - return 0 + if 'A' <= b && b <= 'Z' { + b += 'a' - 'A' } + hash ^= int64(b) + hash *= 0x1000193 + } + if !iter.loadMore() { + iter.ReportError("readFieldHash", `incomplete field name`) + return 0 } } - iter.ReportError("readFieldHash", `expect ", but found `+string([]byte{c})) - return 0 } -func calcHash(str string) int32 { +func calcHash(str string) int64 { hash := int64(0x811c9dc5) for _, b := range str { hash ^= int64(unicode.ToLower(b)) hash *= 0x1000193 } - return int32(hash) + return int64(hash) } // ReadObjectCB read object with callback, the key is ascii only and field name not copied func (iter *Iterator) ReadObjectCB(callback func(*Iterator, string) bool) bool { c := iter.nextToken() - var fieldBytes []byte var field string if c == '{' { c = iter.nextToken() if c == '"' { iter.unreadByte() - if iter.cfg.objectFieldMustBeSimpleString { - fieldBytes = iter.readObjectFieldAsBytes() - field = *(*string)(unsafe.Pointer(&fieldBytes)) - } else { - field = iter.ReadString() - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } + field = iter.ReadString() + c = iter.nextToken() + if c != ':' { + iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) } if !callback(iter, field) { return false } c = iter.nextToken() for c == ',' { - if iter.cfg.objectFieldMustBeSimpleString { - fieldBytes = iter.readObjectFieldAsBytes() - field = *(*string)(unsafe.Pointer(&fieldBytes)) - } else { - field = iter.ReadString() - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } + field = iter.ReadString() + c = iter.nextToken() + if c != ':' { + iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) } if !callback(iter, field) { return false diff --git a/vendor/github.com/json-iterator/go/feature_iter_skip.go b/vendor/github.com/json-iterator/go/iter_skip.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_iter_skip.go rename to vendor/github.com/json-iterator/go/iter_skip.go diff --git a/vendor/github.com/json-iterator/go/feature_iter_skip_sloppy.go b/vendor/github.com/json-iterator/go/iter_skip_sloppy.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_iter_skip_sloppy.go rename to vendor/github.com/json-iterator/go/iter_skip_sloppy.go diff --git a/vendor/github.com/json-iterator/go/jsoniter_sloppy_test.go b/vendor/github.com/json-iterator/go/iter_skip_sloppy_test.go similarity index 99% rename from vendor/github.com/json-iterator/go/jsoniter_sloppy_test.go rename to vendor/github.com/json-iterator/go/iter_skip_sloppy_test.go index 487713ae7..bcb491fe6 100644 --- a/vendor/github.com/json-iterator/go/jsoniter_sloppy_test.go +++ b/vendor/github.com/json-iterator/go/iter_skip_sloppy_test.go @@ -1,4 +1,4 @@ -//+build jsoniter-sloppy +//+build jsoniter_sloppy package jsoniter diff --git a/vendor/github.com/json-iterator/go/feature_iter_skip_strict.go b/vendor/github.com/json-iterator/go/iter_skip_strict.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_iter_skip_strict.go rename to vendor/github.com/json-iterator/go/iter_skip_strict.go diff --git a/vendor/github.com/json-iterator/go/feature_iter_string.go b/vendor/github.com/json-iterator/go/iter_str.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_iter_string.go rename to vendor/github.com/json-iterator/go/iter_str.go diff --git a/vendor/github.com/json-iterator/go/jsoniter_adapter_test.go b/vendor/github.com/json-iterator/go/jsoniter_adapter_test.go deleted file mode 100644 index 30f03deb6..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_adapter_test.go +++ /dev/null @@ -1,84 +0,0 @@ -package jsoniter - -import ( - "bytes" - "encoding/json" - "github.com/stretchr/testify/require" - "io/ioutil" - "testing" -) - -func Test_new_decoder(t *testing.T) { - should := require.New(t) - decoder1 := json.NewDecoder(bytes.NewBufferString(`[1][2]`)) - decoder2 := NewDecoder(bytes.NewBufferString(`[1][2]`)) - arr1 := []int{} - should.Nil(decoder1.Decode(&arr1)) - should.Equal([]int{1}, arr1) - arr2 := []int{} - should.True(decoder1.More()) - buffered, _ := ioutil.ReadAll(decoder1.Buffered()) - should.Equal("[2]", string(buffered)) - should.Nil(decoder2.Decode(&arr2)) - should.Equal([]int{1}, arr2) - should.True(decoder2.More()) - buffered, _ = ioutil.ReadAll(decoder2.Buffered()) - should.Equal("[2]", string(buffered)) - - should.Nil(decoder1.Decode(&arr1)) - should.Equal([]int{2}, arr1) - should.False(decoder1.More()) - should.Nil(decoder2.Decode(&arr2)) - should.Equal([]int{2}, arr2) - should.False(decoder2.More()) -} - -func Test_use_number(t *testing.T) { - should := require.New(t) - decoder1 := json.NewDecoder(bytes.NewBufferString(`123`)) - decoder1.UseNumber() - decoder2 := NewDecoder(bytes.NewBufferString(`123`)) - decoder2.UseNumber() - var obj1 interface{} - should.Nil(decoder1.Decode(&obj1)) - should.Equal(json.Number("123"), obj1) - var obj2 interface{} - should.Nil(decoder2.Decode(&obj2)) - should.Equal(json.Number("123"), obj2) -} - -func Test_use_number_for_unmarshal(t *testing.T) { - should := require.New(t) - api := Config{UseNumber: true}.Froze() - var obj interface{} - should.Nil(api.UnmarshalFromString("123", &obj)) - should.Equal(json.Number("123"), obj) -} - -func Test_marshal_indent(t *testing.T) { - should := require.New(t) - obj := struct { - F1 int - F2 []int - }{1, []int{2, 3, 4}} - output, err := json.MarshalIndent(obj, "", " ") - should.Nil(err) - should.Equal("{\n \"F1\": 1,\n \"F2\": [\n 2,\n 3,\n 4\n ]\n}", string(output)) - output, err = MarshalIndent(obj, "", " ") - should.Nil(err) - should.Equal("{\n \"F1\": 1,\n \"F2\": [\n 2,\n 3,\n 4\n ]\n}", string(output)) -} - -func Test_marshal_indent_map(t *testing.T) { - should := require.New(t) - obj := map[int]int{1: 2} - output, err := json.MarshalIndent(obj, "", " ") - should.Nil(err) - should.Equal("{\n \"1\": 2\n}", string(output)) - output, err = MarshalIndent(obj, "", " ") - should.Nil(err) - should.Equal("{\n \"1\": 2\n}", string(output)) - output, err = ConfigCompatibleWithStandardLibrary.MarshalIndent(obj, "", " ") - should.Nil(err) - should.Equal("{\n \"1\": 2\n}", string(output)) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_alias_test.go b/vendor/github.com/json-iterator/go/jsoniter_alias_test.go deleted file mode 100644 index 246651f75..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_alias_test.go +++ /dev/null @@ -1,62 +0,0 @@ -package jsoniter - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func Test_alias(t *testing.T) { - should := require.New(t) - type myint int - type myint8 int8 - type myint16 int16 - type myint32 int32 - type myint64 int64 - type myuint uint - type myuint8 uint8 - type myuint16 uint16 - type myuint32 uint32 - type myuint64 uint64 - type myfloat32 float32 - type myfloat64 float64 - type mystring string - type mybool bool - type myuintptr uintptr - var a struct { - A myint8 `json:"a"` - B myint16 `json:"stream"` - C myint32 `json:"c"` - D myint64 `json:"d"` - E myuint8 `json:"e"` - F myuint16 `json:"f"` - G myuint32 `json:"g"` - H myuint64 `json:"h"` - I myfloat32 `json:"i"` - J myfloat64 `json:"j"` - K mystring `json:"k"` - L myint `json:"l"` - M myuint `json:"m"` - N mybool `json:"n"` - O myuintptr `json:"o"` - } - - should.Nil(UnmarshalFromString(`{"a" : 1, "stream" : 1, "c": 1, "d" : 1, "e" : 1, "f" : 1, "g" : 1, "h": 1, "i" : 1, "j" : 1, "k" :"xxxx", "l" : 1, "m":1, "n": true, "o" : 1}`, &a)) - should.Equal(myfloat32(1), a.I) - should.Equal(myfloat64(1), a.J) - should.Equal(myint8(1), a.A) - should.Equal(myint16(1), a.B) - should.Equal(myint32(1), a.C) - should.Equal(myint64(1), a.D) - should.Equal(myuint8(1), a.E) - should.Equal(myuint16(1), a.F) - should.Equal(myuint32(1), a.G) - should.Equal(myuint64(1), a.H) - should.Equal(mystring("xxxx"), a.K) - should.Equal(mybool(true), a.N) - should.Equal(myuintptr(1), a.O) - b, err := Marshal(a) - should.Nil(err) - should.Equal(`{"a":1,"stream":1,"c":1,"d":1,"e":1,"f":1,"g":1,"h":1,"i":1,"j":1,"k":"xxxx","l":1,"m":1,"n":true,"o":1}`, string(b)) - -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_any_map_test.go b/vendor/github.com/json-iterator/go/jsoniter_any_map_test.go deleted file mode 100644 index f93ea4e61..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_any_map_test.go +++ /dev/null @@ -1,14 +0,0 @@ -package jsoniter - -import ( - "github.com/stretchr/testify/require" - "testing" -) - -func Test_wrap_map(t *testing.T) { - should := require.New(t) - any := Wrap(map[string]string{"Field1": "hello"}) - should.Equal("hello", any.Get("Field1").ToString()) - any = Wrap(map[string]string{"Field1": "hello"}) - should.Equal(1, any.Size()) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_bool_test.go b/vendor/github.com/json-iterator/go/jsoniter_bool_test.go deleted file mode 100644 index 461b88ba3..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_bool_test.go +++ /dev/null @@ -1,113 +0,0 @@ -package jsoniter - -import ( - "bytes" - "encoding/json" - "testing" - - "github.com/stretchr/testify/require" -) - -func Test_true(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `true`) - should.True(iter.ReadBool()) - iter = ParseString(ConfigDefault, `true`) - should.Equal(true, iter.Read()) -} - -func Test_false(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `false`) - should.False(iter.ReadBool()) -} - -func Test_write_true_false(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteTrue() - stream.WriteFalse() - stream.WriteBool(false) - stream.Flush() - should.Nil(stream.Error) - should.Equal("truefalsefalse", buf.String()) -} - -func Test_write_val_bool(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteVal(true) - should.Equal(stream.Buffered(), 4) - stream.Flush() - should.Equal(stream.Buffered(), 0) - should.Nil(stream.Error) - should.Equal("true", buf.String()) -} - -func Test_encode_string_bool(t *testing.T) { - type TestObject struct { - Field bool `json:",omitempty,string"` - } - should := require.New(t) - output, err := json.Marshal(TestObject{true}) - should.Nil(err) - should.Equal(`{"Field":"true"}`, string(output)) - output, err = Marshal(TestObject{true}) - should.Nil(err) - should.Equal(`{"Field":"true"}`, string(output)) -} - -func Test_decode_string_bool(t *testing.T) { - type TestObject struct { - Field bool `json:",omitempty,string"` - } - should := require.New(t) - obj := TestObject{} - err := json.Unmarshal([]byte(`{"Field":"true"}`), &obj) - should.Nil(err) - should.True(obj.Field) - - obj = TestObject{} - err = json.Unmarshal([]byte(`{"Field":true}`), &obj) - should.NotNil(err) - - obj = TestObject{} - err = Unmarshal([]byte(`{"Field":"true"}`), &obj) - should.Nil(err) - should.True(obj.Field) - - obj = TestObject{} - err = Unmarshal([]byte(`{"Field":true}`), &obj) - should.NotNil(err) -} - -func Test_bool_can_be_null(t *testing.T) { - type TestData struct { - Field bool `json:"field"` - } - should := require.New(t) - - obj := TestData{} - data1 := []byte(`{"field": true}`) - err := Unmarshal(data1, &obj) - should.NoError(err) - should.Equal(true, obj.Field) - - data2 := []byte(`{"field": null}`) - err = Unmarshal(data2, &obj) - should.NoError(err) - // Same behavior as stdlib, not touching the existing value. - should.Equal(true, obj.Field) - - // Checking stdlib behavior as well - obj2 := TestData{} - err = json.Unmarshal(data1, &obj2) - should.NoError(err) - should.Equal(true, obj2.Field) - - err = json.Unmarshal(data2, &obj2) - should.NoError(err) - should.Equal(true, obj2.Field) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_customize_test.go b/vendor/github.com/json-iterator/go/jsoniter_customize_test.go deleted file mode 100644 index 0e1cb512d..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_customize_test.go +++ /dev/null @@ -1,342 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "strconv" - "testing" - "time" - "unsafe" - - "github.com/stretchr/testify/require" -) - -func Test_customize_type_decoder(t *testing.T) { - RegisterTypeDecoderFunc("time.Time", func(ptr unsafe.Pointer, iter *Iterator) { - t, err := time.ParseInLocation("2006-01-02 15:04:05", iter.ReadString(), time.UTC) - if err != nil { - iter.Error = err - return - } - *((*time.Time)(ptr)) = t - }) - defer ConfigDefault.(*frozenConfig).cleanDecoders() - val := time.Time{} - err := Unmarshal([]byte(`"2016-12-05 08:43:28"`), &val) - if err != nil { - t.Fatal(err) - } - year, month, day := val.Date() - if year != 2016 || month != 12 || day != 5 { - t.Fatal(val) - } -} - -func Test_customize_type_encoder(t *testing.T) { - should := require.New(t) - RegisterTypeEncoderFunc("time.Time", func(ptr unsafe.Pointer, stream *Stream) { - t := *((*time.Time)(ptr)) - stream.WriteString(t.UTC().Format("2006-01-02 15:04:05")) - }, nil) - defer ConfigDefault.(*frozenConfig).cleanEncoders() - val := time.Unix(0, 0) - str, err := MarshalToString(val) - should.Nil(err) - should.Equal(`"1970-01-01 00:00:00"`, str) -} - -func Test_customize_byte_array_encoder(t *testing.T) { - ConfigDefault.(*frozenConfig).cleanEncoders() - should := require.New(t) - RegisterTypeEncoderFunc("[]uint8", func(ptr unsafe.Pointer, stream *Stream) { - t := *((*[]byte)(ptr)) - stream.WriteString(string(t)) - }, nil) - defer ConfigDefault.(*frozenConfig).cleanEncoders() - val := []byte("abc") - str, err := MarshalToString(val) - should.Nil(err) - should.Equal(`"abc"`, str) -} - -func Test_customize_float_marshal(t *testing.T) { - should := require.New(t) - json := Config{MarshalFloatWith6Digits: true}.Froze() - str, err := json.MarshalToString(float32(1.23456789)) - should.Nil(err) - should.Equal("1.234568", str) -} - -type Tom struct { - field1 string -} - -func Test_customize_field_decoder(t *testing.T) { - RegisterFieldDecoderFunc("jsoniter.Tom", "field1", func(ptr unsafe.Pointer, iter *Iterator) { - *((*string)(ptr)) = strconv.Itoa(iter.ReadInt()) - }) - defer ConfigDefault.(*frozenConfig).cleanDecoders() - tom := Tom{} - err := Unmarshal([]byte(`{"field1": 100}`), &tom) - if err != nil { - t.Fatal(err) - } -} - -type TestObject1 struct { - Field1 string -} - -type testExtension struct { - DummyExtension -} - -func (extension *testExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) { - if structDescriptor.Type.String() != "jsoniter.TestObject1" { - return - } - binding := structDescriptor.GetField("Field1") - binding.Encoder = &funcEncoder{fun: func(ptr unsafe.Pointer, stream *Stream) { - str := *((*string)(ptr)) - val, _ := strconv.Atoi(str) - stream.WriteInt(val) - }} - binding.Decoder = &funcDecoder{func(ptr unsafe.Pointer, iter *Iterator) { - *((*string)(ptr)) = strconv.Itoa(iter.ReadInt()) - }} - binding.ToNames = []string{"field-1"} - binding.FromNames = []string{"field-1"} -} - -func Test_customize_field_by_extension(t *testing.T) { - should := require.New(t) - cfg := Config{}.Froze() - cfg.RegisterExtension(&testExtension{}) - obj := TestObject1{} - err := cfg.UnmarshalFromString(`{"field-1": 100}`, &obj) - should.Nil(err) - should.Equal("100", obj.Field1) - str, err := cfg.MarshalToString(obj) - should.Nil(err) - should.Equal(`{"field-1":100}`, str) -} - -type timeImplementedMarshaler time.Time - -func (obj timeImplementedMarshaler) MarshalJSON() ([]byte, error) { - seconds := time.Time(obj).Unix() - return []byte(strconv.FormatInt(seconds, 10)), nil -} - -func Test_marshaler(t *testing.T) { - type TestObject struct { - Field timeImplementedMarshaler - } - should := require.New(t) - val := timeImplementedMarshaler(time.Unix(123, 0)) - obj := TestObject{val} - bytes, err := json.Marshal(obj) - should.Nil(err) - should.Equal(`{"Field":123}`, string(bytes)) - str, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`{"Field":123}`, str) -} - -func Test_marshaler_and_encoder(t *testing.T) { - type TestObject struct { - Field *timeImplementedMarshaler - } - ConfigDefault.(*frozenConfig).cleanEncoders() - should := require.New(t) - RegisterTypeEncoderFunc("jsoniter.timeImplementedMarshaler", func(ptr unsafe.Pointer, stream *Stream) { - stream.WriteString("hello from encoder") - }, nil) - val := timeImplementedMarshaler(time.Unix(123, 0)) - obj := TestObject{&val} - bytes, err := json.Marshal(obj) - should.Nil(err) - should.Equal(`{"Field":123}`, string(bytes)) - str, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`{"Field":"hello from encoder"}`, str) -} - -type ObjectImplementedUnmarshaler int - -func (obj *ObjectImplementedUnmarshaler) UnmarshalJSON(s []byte) error { - val, _ := strconv.ParseInt(string(s[1:len(s)-1]), 10, 64) - *obj = ObjectImplementedUnmarshaler(val) - return nil -} - -func Test_unmarshaler(t *testing.T) { - should := require.New(t) - var obj ObjectImplementedUnmarshaler - err := json.Unmarshal([]byte(` "100" `), &obj) - should.Nil(err) - should.Equal(100, int(obj)) - iter := ParseString(ConfigDefault, ` "100" `) - iter.ReadVal(&obj) - should.Nil(err) - should.Equal(100, int(obj)) -} - -func Test_unmarshaler_and_decoder(t *testing.T) { - type TestObject struct { - Field *ObjectImplementedUnmarshaler - Field2 string - } - ConfigDefault.(*frozenConfig).cleanDecoders() - should := require.New(t) - RegisterTypeDecoderFunc("jsoniter.ObjectImplementedUnmarshaler", func(ptr unsafe.Pointer, iter *Iterator) { - *(*ObjectImplementedUnmarshaler)(ptr) = 10 - iter.Skip() - }) - obj := TestObject{} - val := ObjectImplementedUnmarshaler(0) - obj.Field = &val - err := json.Unmarshal([]byte(`{"Field":"100"}`), &obj) - should.Nil(err) - should.Equal(100, int(*obj.Field)) - err = Unmarshal([]byte(`{"Field":"100"}`), &obj) - should.Nil(err) - should.Equal(10, int(*obj.Field)) -} - -type tmString string -type tmStruct struct { - String tmString -} - -func (s tmStruct) MarshalJSON() ([]byte, error) { - var b []byte - b = append(b, '"') - b = append(b, s.String...) - b = append(b, '"') - return b, nil -} - -func Test_marshaler_on_struct(t *testing.T) { - fixed := tmStruct{"hello"} - //json.Marshal(fixed) - Marshal(fixed) -} - -type withChan struct { - F2 chan []byte -} - -func (q withChan) MarshalJSON() ([]byte, error) { - return []byte(`""`), nil -} - -func (q *withChan) UnmarshalJSON(value []byte) error { - return nil -} - -func Test_marshal_json_with_chan(t *testing.T) { - type TestObject struct { - F1 withChan - } - should := require.New(t) - output, err := MarshalToString(TestObject{}) - should.Nil(err) - should.Equal(`{"F1":""}`, output) -} - -type withTime struct { - time.Time -} - -func (t *withTime) UnmarshalJSON(b []byte) error { - return nil -} -func (t withTime) MarshalJSON() ([]byte, error) { - return []byte(`"fake"`), nil -} - -func Test_marshal_json_with_time(t *testing.T) { - type S1 struct { - F1 withTime - F2 *withTime - } - type TestObject struct { - TF1 S1 - } - should := require.New(t) - obj := TestObject{ - S1{ - F1: withTime{ - time.Unix(0, 0), - }, - F2: &withTime{ - time.Unix(0, 0), - }, - }, - } - output, err := json.Marshal(obj) - should.Nil(err) - should.Equal(`{"TF1":{"F1":"fake","F2":"fake"}}`, string(output)) - output, err = Marshal(obj) - should.Nil(err) - should.Equal(`{"TF1":{"F1":"fake","F2":"fake"}}`, string(output)) - obj = TestObject{} - should.Nil(json.Unmarshal([]byte(`{"TF1":{"F1":"fake","F2":"fake"}}`), &obj)) - should.NotNil(obj.TF1.F2) - obj = TestObject{} - should.Nil(Unmarshal([]byte(`{"TF1":{"F1":"fake","F2":"fake"}}`), &obj)) - should.NotNil(obj.TF1.F2) -} - -func Test_customize_tag_key(t *testing.T) { - - type TestObject struct { - Field string `orm:"field"` - } - - should := require.New(t) - json := Config{TagKey: "orm"}.Froze() - str, err := json.MarshalToString(TestObject{"hello"}) - should.Nil(err) - should.Equal(`{"field":"hello"}`, str) -} - -func Test_recursive_empty_interface_customization(t *testing.T) { - t.Skip() - var obj interface{} - RegisterTypeDecoderFunc("interface {}", func(ptr unsafe.Pointer, iter *Iterator) { - switch iter.WhatIsNext() { - case NumberValue: - *(*interface{})(ptr) = iter.ReadInt64() - default: - *(*interface{})(ptr) = iter.Read() - } - }) - should := require.New(t) - Unmarshal([]byte("[100]"), &obj) - should.Equal([]interface{}{int64(100)}, obj) -} - -type GeoLocation struct { - Id string `json:"id,omitempty" db:"id"` -} - -func (p *GeoLocation) MarshalJSON() ([]byte, error) { - return []byte(`{}`), nil -} - -func (p *GeoLocation) UnmarshalJSON(input []byte) error { - p.Id = "hello" - return nil -} - -func Test_marshal_and_unmarshal_on_non_pointer(t *testing.T) { - should := require.New(t) - locations := []GeoLocation{{"000"}} - bytes, err := Marshal(locations) - should.Nil(err) - should.Equal("[{}]", string(bytes)) - err = Unmarshal([]byte("[1]"), &locations) - should.Nil(err) - should.Equal("hello", locations[0].Id) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_demo_test.go b/vendor/github.com/json-iterator/go/jsoniter_demo_test.go deleted file mode 100644 index 85718d1b2..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_demo_test.go +++ /dev/null @@ -1,87 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "testing" - - "github.com/stretchr/testify/require" -) - -func Test_bind_api_demo(t *testing.T) { - should := require.New(t) - val := []int{} - err := UnmarshalFromString(`[0,1,2,3] `, &val) - should.Nil(err) - should.Equal([]int{0, 1, 2, 3}, val) -} - -func Test_iterator_api_demo(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `[0,1,2,3]`) - total := 0 - for iter.ReadArray() { - total += iter.ReadInt() - } - should.Equal(6, total) -} - -type People struct { - Name string - Gender string - Age int - Address string - Mobile string - Country string - Height int -} - -func jsoniterMarshal(p *People) error { - _, err := Marshal(p) - if nil != err { - return err - } - return nil -} -func stdMarshal(p *People) error { - _, err := json.Marshal(p) - if nil != err { - return err - } - return nil -} - -func BenchmarkJosniterMarshal(b *testing.B) { - var p People - p.Address = "上海市徐汇区漕宝路" - p.Age = 30 - p.Country = "中国" - p.Gender = "male" - p.Height = 170 - p.Mobile = "18502120533" - p.Name = "Elvin" - b.ReportAllocs() - for i := 0; i < b.N; i++ { - err := jsoniterMarshal(&p) - if nil != err { - b.Error(err) - } - } -} - -func BenchmarkStdMarshal(b *testing.B) { - var p People - p.Address = "上海市徐汇区漕宝路" - p.Age = 30 - p.Country = "中国" - p.Gender = "male" - p.Height = 170 - p.Mobile = "18502120533" - p.Name = "Elvin" - b.ReportAllocs() - for i := 0; i < b.N; i++ { - err := stdMarshal(&p) - if nil != err { - b.Error(err) - } - } -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_encode_interface_test.go b/vendor/github.com/json-iterator/go/jsoniter_encode_interface_test.go deleted file mode 100644 index 14b7add9a..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_encode_interface_test.go +++ /dev/null @@ -1,42 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "testing" - - "github.com/stretchr/testify/require" -) - -func Test_encode_interface(t *testing.T) { - should := require.New(t) - var a interface{} - a = int8(10) - str, err := MarshalToString(a) - should.Nil(err) - should.Equal(str, "10") - a = float32(3) - str, err = MarshalToString(a) - should.Nil(err) - should.Equal(str, "3") - a = map[string]interface{}{"abc": 1} - str, err = MarshalToString(a) - should.Nil(err) - should.Equal(str, `{"abc":1}`) - a = uintptr(1) - str, err = MarshalToString(a) - should.Nil(err) - should.Equal(str, "1") - a = uint(1) - str, err = MarshalToString(a) - should.Nil(err) - should.Equal(str, "1") - a = uint8(1) - str, err = MarshalToString(a) - should.Nil(err) - should.Equal(str, "1") - a = json.RawMessage("abc") - MarshalToString(a) - str, err = MarshalToString(a) - should.Nil(err) - should.Equal(str, "abc") -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_enum_marshaler_test.go b/vendor/github.com/json-iterator/go/jsoniter_enum_marshaler_test.go deleted file mode 100644 index 69e1e8cd3..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_enum_marshaler_test.go +++ /dev/null @@ -1,50 +0,0 @@ -package jsoniter - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/require" -) - -type MyEnum int64 - -const ( - MyEnumA MyEnum = iota - MyEnumB -) - -func (m *MyEnum) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf(`"foo-%d"`, int(*m))), nil -} - -func (m *MyEnum) UnmarshalJSON(jb []byte) error { - switch string(jb) { - case `"foo-1"`: - *m = MyEnumB - default: - *m = MyEnumA - } - return nil -} - -func Test_custom_marshaler_on_enum(t *testing.T) { - type Wrapper struct { - Payload interface{} - } - type Wrapper2 struct { - Payload MyEnum - } - should := require.New(t) - - w := Wrapper{Payload: MyEnumB} - - jb, err := Marshal(w) - should.NoError(err) - should.Equal(`{"Payload":"foo-1"}`, string(jb)) - - var w2 Wrapper2 - err = Unmarshal(jb, &w2) - should.NoError(err) - should.Equal(MyEnumB, w2.Payload) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_fixed_array_test.go b/vendor/github.com/json-iterator/go/jsoniter_fixed_array_test.go deleted file mode 100644 index cbe50a0e9..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_fixed_array_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "github.com/stretchr/testify/require" - "testing" -) - -func Test_encode_fixed_array(t *testing.T) { - should := require.New(t) - type FixedArray [2]float64 - fixed := FixedArray{0.1, 1.0} - output, err := MarshalToString(fixed) - should.Nil(err) - should.Equal("[0.1,1]", output) -} - -func Test_encode_fixed_array_empty(t *testing.T) { - should := require.New(t) - type FixedArray [0]float64 - fixed := FixedArray{} - output, err := MarshalToString(fixed) - should.Nil(err) - should.Equal("[]", output) -} - -func Test_encode_fixed_array_of_map(t *testing.T) { - should := require.New(t) - type FixedArray [2]map[string]string - fixed := FixedArray{map[string]string{"1": "2"}, map[string]string{"3": "4"}} - output, err := MarshalToString(fixed) - should.Nil(err) - should.Equal(`[{"1":"2"},{"3":"4"}]`, output) -} - -func Test_decode_fixed_array(t *testing.T) { - should := require.New(t) - type FixedArray [2]float64 - var fixed FixedArray - should.Nil(json.Unmarshal([]byte("[1,2,3]"), &fixed)) - should.Equal(float64(1), fixed[0]) - should.Equal(float64(2), fixed[1]) - should.Nil(Unmarshal([]byte("[1,2,3]"), &fixed)) - should.Equal(float64(1), fixed[0]) - should.Equal(float64(2), fixed[1]) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_interface_test.go b/vendor/github.com/json-iterator/go/jsoniter_interface_test.go deleted file mode 100644 index 10a33737c..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_interface_test.go +++ /dev/null @@ -1,576 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "fmt" - "testing" - "unsafe" - - "github.com/stretchr/testify/require" - "reflect" -) - -func Test_write_empty_interface_via_placeholder(t *testing.T) { - fmt.Println(^uint(0) >> 1) - should := require.New(t) - m := map[uint32]interface{}{1: "hello"} - inf := reflect.ValueOf(m).MapIndex(reflect.ValueOf(uint32(1))).Interface() - encoder := &placeholderEncoder{ - cfg: ConfigFastest.(*frozenConfig), - cacheKey: reflect.TypeOf(m).Elem(), - } - stream := ConfigFastest.BorrowStream(nil) - encoderOfType(ConfigFastest.(*frozenConfig), "", reflect.TypeOf(m).Elem()) - encoder.EncodeInterface(inf, stream) - should.Equal(`"hello"`, string(stream.Buffer())) -} - -func Test_write_array_of_interface(t *testing.T) { - should := require.New(t) - array := []interface{}{"hello"} - str, err := MarshalToString(array) - should.Nil(err) - should.Equal(`["hello"]`, str) -} - -func Test_write_map_of_interface(t *testing.T) { - should := require.New(t) - val := map[string]interface{}{"hello": "world"} - str, err := MarshalToString(val) - should.Nil(err) - should.Equal(`{"hello":"world"}`, str) -} - -func Test_write_map_of_interface_in_struct(t *testing.T) { - type TestObject struct { - Field map[string]interface{} - } - should := require.New(t) - val := TestObject{map[string]interface{}{"hello": "world"}} - str, err := MarshalToString(val) - should.Nil(err) - should.Equal(`{"Field":{"hello":"world"}}`, str) -} - -func Test_write_map_of_interface_in_struct_with_two_fields(t *testing.T) { - type TestObject struct { - Field map[string]interface{} - Field2 string - } - should := require.New(t) - val := TestObject{map[string]interface{}{"hello": "world"}, ""} - str, err := MarshalToString(val) - should.Nil(err) - should.Contains(str, `"Field":{"hello":"world"}`) -} - -type MyInterface interface { - Hello() string -} - -type MyString string - -func (ms MyString) Hello() string { - return string(ms) -} - -func Test_write_map_of_custom_interface(t *testing.T) { - should := require.New(t) - myStr := MyString("world") - should.Equal("world", myStr.Hello()) - val := map[string]MyInterface{"hello": myStr} - str, err := MarshalToString(val) - should.Nil(err) - should.Equal(`{"hello":"world"}`, str) -} - -func Test_write_interface(t *testing.T) { - should := require.New(t) - var val interface{} - val = "hello" - str, err := MarshalToString(val) - should.Nil(err) - should.Equal(`"hello"`, str) -} - -func Test_read_interface(t *testing.T) { - should := require.New(t) - var val interface{} - err := UnmarshalFromString(`"hello"`, &val) - should.Nil(err) - should.Equal("hello", val) - err = UnmarshalFromString(`1e1`, &val) - should.Nil(err) - should.Equal(float64(10), val) - err = UnmarshalFromString(`1.0e1`, &val) - should.Nil(err) - should.Equal(float64(10), val) - err = json.Unmarshal([]byte(`1.0e1`), &val) - should.Nil(err) - should.Equal(float64(10), val) -} - -func Test_read_custom_interface(t *testing.T) { - should := require.New(t) - var val MyInterface - RegisterTypeDecoderFunc("jsoniter.MyInterface", func(ptr unsafe.Pointer, iter *Iterator) { - *((*MyInterface)(ptr)) = MyString(iter.ReadString()) - }) - err := UnmarshalFromString(`"hello"`, &val) - should.Nil(err) - should.Equal("hello", val.Hello()) -} - -func Test_decode_object_contain_empty_interface(t *testing.T) { - type TestObject struct { - Field interface{} - } - should := require.New(t) - obj := TestObject{} - obj.Field = 1024 - should.Nil(UnmarshalFromString(`{"Field": "hello"}`, &obj)) - should.Equal("hello", obj.Field) -} - -func Test_decode_object_contain_non_empty_interface(t *testing.T) { - type TestObject struct { - Field MyInterface - } - should := require.New(t) - obj := TestObject{} - obj.Field = MyString("abc") - should.Nil(UnmarshalFromString(`{"Field": "hello"}`, &obj)) - should.Equal(MyString("hello"), obj.Field) -} - -func Test_encode_object_contain_empty_interface(t *testing.T) { - type TestObject struct { - Field interface{} - } - should := require.New(t) - obj := TestObject{} - obj.Field = 1024 - str, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`{"Field":1024}`, str) -} - -func Test_encode_object_contain_non_empty_interface(t *testing.T) { - type TestObject struct { - Field MyInterface - } - should := require.New(t) - obj := TestObject{} - obj.Field = MyString("hello") - str, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`{"Field":"hello"}`, str) -} - -func Test_nil_non_empty_interface(t *testing.T) { - ConfigDefault.(*frozenConfig).cleanEncoders() - ConfigDefault.(*frozenConfig).cleanDecoders() - type TestObject struct { - Field []MyInterface - } - should := require.New(t) - obj := TestObject{} - b := []byte(`{"Field":["AAA"]}`) - should.NotNil(json.Unmarshal(b, &obj)) - should.NotNil(Unmarshal(b, &obj)) -} - -func Test_read_large_number_as_interface(t *testing.T) { - should := require.New(t) - var val interface{} - err := Config{UseNumber: true}.Froze().UnmarshalFromString(`123456789123456789123456789`, &val) - should.Nil(err) - output, err := MarshalToString(val) - should.Nil(err) - should.Equal(`123456789123456789123456789`, output) -} - -func Test_nested_one_field_struct(t *testing.T) { - should := require.New(t) - type YetYetAnotherObject struct { - Field string - } - type YetAnotherObject struct { - Field *YetYetAnotherObject - } - type AnotherObject struct { - Field *YetAnotherObject - } - type TestObject struct { - Me *AnotherObject - } - obj := TestObject{&AnotherObject{&YetAnotherObject{&YetYetAnotherObject{"abc"}}}} - str, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`{"Me":{"Field":{"Field":{"Field":"abc"}}}}`, str) - str, err = MarshalToString(&obj) - should.Nil(err) - should.Equal(`{"Me":{"Field":{"Field":{"Field":"abc"}}}}`, str) -} - -func Test_struct_with_embedded_ptr_with_tag(t *testing.T) { - type O1 struct { - O1F string - } - - type Option struct { - O1 *O1 - } - - type T struct { - Option `json:","` - } - var obj T - should := require.New(t) - output, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`{"O1":null}`, output) -} - -func Test_struct_with_one_nil(t *testing.T) { - type TestObject struct { - F *float64 - } - var obj TestObject - should := require.New(t) - output, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`{"F":null}`, output) -} - -func Test_struct_with_one_nil_embedded(t *testing.T) { - type Parent struct { - Field1 string - Field2 string - } - type TestObject struct { - *Parent - } - obj := TestObject{} - should := require.New(t) - bytes, err := json.Marshal(obj) - should.Nil(err) - should.Equal("{}", string(bytes)) - output, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`{}`, output) -} - -func Test_struct_with_not_nil_embedded(t *testing.T) { - type Parent struct { - Field0 string - Field1 []string - Field2 map[string]interface{} - } - type TestObject struct { - *Parent - } - should := require.New(t) - var obj TestObject - err := UnmarshalFromString(`{"Field0":"1","Field1":null,"Field2":{"K":"V"}}`, &obj) - should.Nil(err) - should.Nil(obj.Field1) - should.Equal(map[string]interface{}{"K": "V"}, obj.Field2) - should.Equal("1", obj.Field0) -} - -func Test_array_with_one_nil_ptr(t *testing.T) { - obj := [1]*float64{nil} - should := require.New(t) - output, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`[null]`, output) -} - -func Test_array_with_one_not_nil_ptr(t *testing.T) { - two := float64(2) - obj := [1]*float64{&two} - should := require.New(t) - output, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`[2]`, output) -} - -func Test_embedded_array_with_one_nil(t *testing.T) { - type TestObject struct { - Field1 int - Field2 [1]*float64 - } - var obj TestObject - should := require.New(t) - output, err := MarshalToString(obj) - should.Nil(err) - should.Contains(output, `"Field2":[null]`) -} - -func Test_array_with_nothing(t *testing.T) { - var obj [2]*float64 - should := require.New(t) - output, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`[null,null]`, output) -} - -func Test_unmarshal_ptr_to_interface(t *testing.T) { - type TestData struct { - Name string `json:"name"` - } - should := require.New(t) - var obj interface{} = &TestData{} - err := json.Unmarshal([]byte(`{"name":"value"}`), &obj) - should.Nil(err) - should.Equal("&{value}", fmt.Sprintf("%v", obj)) - obj = interface{}(&TestData{}) - err = Unmarshal([]byte(`{"name":"value"}`), &obj) - should.Nil(err) - should.Equal("&{value}", fmt.Sprintf("%v", obj)) -} - -func Test_nil_out_null_interface(t *testing.T) { - type TestData struct { - Field interface{} `json:"field"` - } - should := require.New(t) - - var boolVar bool - obj := TestData{ - Field: &boolVar, - } - - data1 := []byte(`{"field": true}`) - - err := Unmarshal(data1, &obj) - should.NoError(err) - should.Equal(true, *(obj.Field.(*bool))) - - data2 := []byte(`{"field": null}`) - - err = Unmarshal(data2, &obj) - should.NoError(err) - should.Equal(nil, obj.Field) - - // Checking stdlib behavior matches. - obj2 := TestData{ - Field: &boolVar, - } - - err = json.Unmarshal(data1, &obj2) - should.NoError(err) - should.Equal(true, *(obj2.Field.(*bool))) - - err = json.Unmarshal(data2, &obj2) - should.NoError(err) - should.Equal(nil, obj2.Field) -} - -func Test_omitempty_nil_interface(t *testing.T) { - type TestData struct { - Field interface{} `json:"field,omitempty"` - } - should := require.New(t) - - obj := TestData{ - Field: nil, - } - - js, err := json.Marshal(obj) - should.NoError(err) - should.Equal("{}", string(js)) - - str, err := MarshalToString(obj) - should.NoError(err) - should.Equal(string(js), str) -} - -func Test_omitempty_nil_nonempty_interface(t *testing.T) { - type TestData struct { - Field MyInterface `json:"field,omitempty"` - } - should := require.New(t) - - obj := TestData{ - Field: nil, - } - - js, err := json.Marshal(obj) - should.NoError(err) - should.Equal("{}", string(js)) - - str, err := MarshalToString(obj) - should.NoError(err) - should.Equal(string(js), str) - - obj.Field = MyString("hello") - err = UnmarshalFromString(`{"field":null}`, &obj) - should.NoError(err) - should.Nil(obj.Field) -} - -func Test_marshal_nil_marshaler_interface(t *testing.T) { - type TestData struct { - Field json.Marshaler `json:"field"` - } - should := require.New(t) - - obj := TestData{ - Field: nil, - } - - js, err := json.Marshal(obj) - should.NoError(err) - should.Equal(`{"field":null}`, string(js)) - - str, err := MarshalToString(obj) - should.NoError(err) - should.Equal(string(js), str) -} - -func Test_marshal_nil_nonempty_interface(t *testing.T) { - type TestData struct { - Field MyInterface `json:"field"` - } - should := require.New(t) - - obj := TestData{ - Field: nil, - } - - js, err := json.Marshal(obj) - should.NoError(err) - should.Equal(`{"field":null}`, string(js)) - - str, err := MarshalToString(obj) - should.NoError(err) - should.Equal(string(js), str) - - obj.Field = MyString("hello") - err = Unmarshal(js, &obj) - should.NoError(err) - should.Equal(nil, obj.Field) -} - -func Test_overwrite_interface_ptr_value_with_nil(t *testing.T) { - type Wrapper struct { - Payload interface{} `json:"payload,omitempty"` - } - type Payload struct { - Value int `json:"val,omitempty"` - } - - should := require.New(t) - - payload := &Payload{} - wrapper := &Wrapper{ - Payload: &payload, - } - - err := json.Unmarshal([]byte(`{"payload": {"val": 42}}`), &wrapper) - should.Equal(nil, err) - should.Equal(&payload, wrapper.Payload) - should.Equal(42, (*(wrapper.Payload.(**Payload))).Value) - - err = json.Unmarshal([]byte(`{"payload": null}`), &wrapper) - should.Equal(nil, err) - should.Equal(&payload, wrapper.Payload) - should.Equal((*Payload)(nil), payload) - - payload = &Payload{} - wrapper = &Wrapper{ - Payload: &payload, - } - - err = Unmarshal([]byte(`{"payload": {"val": 42}}`), &wrapper) - should.Equal(nil, err) - should.Equal(&payload, wrapper.Payload) - should.Equal(42, (*(wrapper.Payload.(**Payload))).Value) - - err = Unmarshal([]byte(`{"payload": null}`), &wrapper) - should.Equal(nil, err) - should.Equal(&payload, wrapper.Payload) - should.Equal((*Payload)(nil), payload) -} - -func Test_overwrite_interface_value_with_nil(t *testing.T) { - type Wrapper struct { - Payload interface{} `json:"payload,omitempty"` - } - type Payload struct { - Value int `json:"val,omitempty"` - } - - should := require.New(t) - - payload := &Payload{} - wrapper := &Wrapper{ - Payload: payload, - } - - err := json.Unmarshal([]byte(`{"payload": {"val": 42}}`), &wrapper) - should.Equal(nil, err) - should.Equal(42, (*(wrapper.Payload.(*Payload))).Value) - - err = json.Unmarshal([]byte(`{"payload": null}`), &wrapper) - should.Equal(nil, err) - should.Equal(nil, wrapper.Payload) - should.Equal(42, payload.Value) - - payload = &Payload{} - wrapper = &Wrapper{ - Payload: payload, - } - - err = Unmarshal([]byte(`{"payload": {"val": 42}}`), &wrapper) - should.Equal(nil, err) - should.Equal(42, (*(wrapper.Payload.(*Payload))).Value) - - err = Unmarshal([]byte(`{"payload": null}`), &wrapper) - should.Equal(nil, err) - should.Equal(nil, wrapper.Payload) - should.Equal(42, payload.Value) -} - -func Test_unmarshal_into_nil(t *testing.T) { - type Payload struct { - Value int `json:"val,omitempty"` - } - type Wrapper struct { - Payload interface{} `json:"payload,omitempty"` - } - - should := require.New(t) - - var payload *Payload - wrapper := &Wrapper{ - Payload: payload, - } - - err := json.Unmarshal([]byte(`{"payload": {"val": 42}}`), &wrapper) - should.Nil(err) - should.NotNil(wrapper.Payload) - should.Nil(payload) - - err = json.Unmarshal([]byte(`{"payload": null}`), &wrapper) - should.Nil(err) - should.Nil(wrapper.Payload) - should.Nil(payload) - - payload = nil - wrapper = &Wrapper{ - Payload: payload, - } - - err = Unmarshal([]byte(`{"payload": {"val": 42}}`), &wrapper) - should.Nil(err) - should.NotNil(wrapper.Payload) - should.Nil(payload) - - err = Unmarshal([]byte(`{"payload": null}`), &wrapper) - should.Nil(err) - should.Nil(wrapper.Payload) - should.Nil(payload) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_io_test.go b/vendor/github.com/json-iterator/go/jsoniter_io_test.go deleted file mode 100644 index 5046ccc40..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_io_test.go +++ /dev/null @@ -1,65 +0,0 @@ -package jsoniter - -import ( - "bytes" - "github.com/stretchr/testify/require" - "io" - "testing" -) - -func Test_read_by_one(t *testing.T) { - iter := Parse(ConfigDefault, bytes.NewBufferString("abc"), 1) - b := iter.readByte() - if iter.Error != nil { - t.Fatal(iter.Error) - } - if b != 'a' { - t.Fatal(b) - } - iter.unreadByte() - if iter.Error != nil { - t.Fatal(iter.Error) - } - b = iter.readByte() - if iter.Error != nil { - t.Fatal(iter.Error) - } - if b != 'a' { - t.Fatal(b) - } -} - -func Test_read_by_two(t *testing.T) { - should := require.New(t) - iter := Parse(ConfigDefault, bytes.NewBufferString("abc"), 2) - b := iter.readByte() - should.Nil(iter.Error) - should.Equal(byte('a'), b) - b = iter.readByte() - should.Nil(iter.Error) - should.Equal(byte('b'), b) - iter.unreadByte() - should.Nil(iter.Error) - iter.unreadByte() - should.Nil(iter.Error) - b = iter.readByte() - should.Nil(iter.Error) - should.Equal(byte('a'), b) -} - -func Test_read_until_eof(t *testing.T) { - iter := Parse(ConfigDefault, bytes.NewBufferString("abc"), 2) - iter.readByte() - iter.readByte() - b := iter.readByte() - if iter.Error != nil { - t.Fatal(iter.Error) - } - if b != 'c' { - t.Fatal(b) - } - iter.readByte() - if iter.Error != io.EOF { - t.Fatal(iter.Error) - } -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_map_test.go b/vendor/github.com/json-iterator/go/jsoniter_map_test.go deleted file mode 100644 index 0865428f5..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_map_test.go +++ /dev/null @@ -1,160 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "math/big" - "testing" - - "github.com/stretchr/testify/require" - "strings" -) - -func Test_read_map(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `{"hello": "world"}`) - m := map[string]string{"1": "2"} - iter.ReadVal(&m) - copy(iter.buf, []byte{0, 0, 0, 0, 0, 0}) - should.Equal(map[string]string{"1": "2", "hello": "world"}, m) -} - -func Test_read_map_of_interface(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `{"hello": "world"}`) - m := map[string]interface{}{"1": "2"} - iter.ReadVal(&m) - should.Equal(map[string]interface{}{"1": "2", "hello": "world"}, m) - iter = ParseString(ConfigDefault, `{"hello": "world"}`) - should.Equal(map[string]interface{}{"hello": "world"}, iter.Read()) -} - -func Test_map_wrapper_any_get_all(t *testing.T) { - should := require.New(t) - any := Wrap(map[string][]int{"Field1": {1, 2}}) - should.Equal(`{"Field1":1}`, any.Get('*', 0).ToString()) - should.Contains(any.Keys(), "Field1") - - // map write to - stream := NewStream(ConfigDefault, nil, 0) - any.WriteTo(stream) - // TODO cannot pass - //should.Equal(string(stream.buf), "") -} - -func Test_write_val_map(t *testing.T) { - should := require.New(t) - val := map[string]string{"1": "2"} - str, err := MarshalToString(val) - should.Nil(err) - should.Equal(`{"1":"2"}`, str) -} - -func Test_slice_of_map(t *testing.T) { - should := require.New(t) - val := []map[string]string{{"1": "2"}} - str, err := MarshalToString(val) - should.Nil(err) - should.Equal(`[{"1":"2"}]`, str) - val = []map[string]string{} - should.Nil(UnmarshalFromString(str, &val)) - should.Equal("2", val[0]["1"]) -} - -func Test_encode_int_key_map(t *testing.T) { - should := require.New(t) - val := map[int]string{1: "2"} - str, err := MarshalToString(val) - should.Nil(err) - should.Equal(`{"1":"2"}`, str) -} - -func Test_decode_int_key_map(t *testing.T) { - should := require.New(t) - var val map[int]string - should.Nil(UnmarshalFromString(`{"1":"2"}`, &val)) - should.Equal(map[int]string{1: "2"}, val) -} - -func Test_encode_TextMarshaler_key_map(t *testing.T) { - should := require.New(t) - f, _, _ := big.ParseFloat("1", 10, 64, big.ToZero) - val := map[*big.Float]string{f: "2"} - str, err := MarshalToString(val) - should.Nil(err) - should.Equal(`{"1":"2"}`, str) -} - -func Test_decode_TextMarshaler_key_map(t *testing.T) { - should := require.New(t) - var val map[*big.Float]string - should.Nil(UnmarshalFromString(`{"1":"2"}`, &val)) - str, err := MarshalToString(val) - should.Nil(err) - should.Equal(`{"1":"2"}`, str) -} - -func Test_map_key_with_escaped_char(t *testing.T) { - type Ttest struct { - Map map[string]string - } - var jsonBytes = []byte(` - { - "Map":{ - "k\"ey": "val" - } - }`) - should := require.New(t) - { - var obj Ttest - should.Nil(json.Unmarshal(jsonBytes, &obj)) - should.Equal(map[string]string{"k\"ey": "val"}, obj.Map) - } - { - var obj Ttest - should.Nil(Unmarshal(jsonBytes, &obj)) - should.Equal(map[string]string{"k\"ey": "val"}, obj.Map) - } -} - -func Test_encode_map_with_sorted_keys(t *testing.T) { - should := require.New(t) - m := map[string]interface{}{ - "3": 3, - "1": 1, - "2": 2, - } - bytes, err := json.Marshal(m) - should.Nil(err) - output, err := ConfigCompatibleWithStandardLibrary.MarshalToString(m) - should.Nil(err) - should.Equal(string(bytes), output) -} - -func Test_encode_map_uint_keys(t *testing.T) { - should := require.New(t) - m := map[uint64]interface{}{ - uint64(1): "a", - uint64(2): "a", - uint64(4): "a", - } - - bytes, err := json.Marshal(m) - should.Nil(err) - - output, err := ConfigCompatibleWithStandardLibrary.MarshalToString(m) - should.Nil(err) - should.Equal(string(bytes), output) -} - -func Test_read_map_with_reader(t *testing.T) { - should := require.New(t) - input := `{"branch":"beta","change_log":"add the rows{10}","channel":"fros","create_time":"2017-06-13 16:39:08","firmware_list":"","md5":"80dee2bf7305bcf179582088e29fd7b9","note":{"CoreServices":{"md5":"d26975c0a8c7369f70ed699f2855cc2e","package_name":"CoreServices","version_code":"76","version_name":"1.0.76"},"FrDaemon":{"md5":"6b1f0626673200bc2157422cd2103f5d","package_name":"FrDaemon","version_code":"390","version_name":"1.0.390"},"FrGallery":{"md5":"90d767f0f31bcd3c1d27281ec979ba65","package_name":"FrGallery","version_code":"349","version_name":"1.0.349"},"FrLocal":{"md5":"f15a215b2c070a80a01f07bde4f219eb","package_name":"FrLocal","version_code":"791","version_name":"1.0.791"}},"pack_region_urls":{"CN":"https://s3.cn-north-1.amazonaws.com.cn/xxx-os/ttt_xxx_android_1.5.3.344.393.zip","default":"http://192.168.8.78/ttt_xxx_android_1.5.3.344.393.zip","local":"http://192.168.8.78/ttt_xxx_android_1.5.3.344.393.zip"},"pack_version":"1.5.3.344.393","pack_version_code":393,"region":"all","release_flag":0,"revision":62,"size":38966875,"status":3}` - reader := strings.NewReader(input) - decoder := ConfigCompatibleWithStandardLibrary.NewDecoder(reader) - m1 := map[string]interface{}{} - should.Nil(decoder.Decode(&m1)) - m2 := map[string]interface{}{} - should.Nil(json.Unmarshal([]byte(input), &m2)) - should.Equal(m2, m1) - should.Equal("1.0.76", m1["note"].(map[string]interface{})["CoreServices"].(map[string]interface{})["version_name"]) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_null_test.go b/vendor/github.com/json-iterator/go/jsoniter_null_test.go deleted file mode 100644 index 8c891470f..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_null_test.go +++ /dev/null @@ -1,168 +0,0 @@ -package jsoniter - -import ( - "bytes" - "encoding/json" - "io" - "testing" - - "github.com/stretchr/testify/require" -) - -func Test_read_null(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `null`) - should.True(iter.ReadNil()) - iter = ParseString(ConfigDefault, `null`) - should.Nil(iter.Read()) - iter = ParseString(ConfigDefault, `navy`) - iter.Read() - should.True(iter.Error != nil && iter.Error != io.EOF) - iter = ParseString(ConfigDefault, `navy`) - iter.ReadNil() - should.True(iter.Error != nil && iter.Error != io.EOF) -} - -func Test_write_null(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteNil() - stream.Flush() - should.Nil(stream.Error) - should.Equal("null", buf.String()) -} - -func Test_encode_null(t *testing.T) { - should := require.New(t) - str, err := MarshalToString(nil) - should.Nil(err) - should.Equal("null", str) -} - -func Test_decode_null_object_field(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `[null,"a"]`) - iter.ReadArray() - if iter.ReadObject() != "" { - t.FailNow() - } - iter.ReadArray() - if iter.ReadString() != "a" { - t.FailNow() - } - type TestObject struct { - Field string - } - objs := []TestObject{} - should.Nil(UnmarshalFromString("[null]", &objs)) - should.Len(objs, 1) -} - -func Test_decode_null_array_element(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `[null,"a"]`) - should.True(iter.ReadArray()) - should.True(iter.ReadNil()) - should.True(iter.ReadArray()) - should.Equal("a", iter.ReadString()) -} - -func Test_decode_null_array(t *testing.T) { - should := require.New(t) - arr := []string{} - should.Nil(UnmarshalFromString("null", &arr)) - should.Nil(arr) -} - -func Test_decode_null_map(t *testing.T) { - should := require.New(t) - arr := map[string]string{} - should.Nil(UnmarshalFromString("null", &arr)) - should.Nil(arr) -} - -func Test_decode_null_string(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `[null,"a"]`) - should.True(iter.ReadArray()) - should.Equal("", iter.ReadString()) - should.True(iter.ReadArray()) - should.Equal("a", iter.ReadString()) -} - -func Test_decode_null_skip(t *testing.T) { - iter := ParseString(ConfigDefault, `[null,"a"]`) - iter.ReadArray() - iter.Skip() - iter.ReadArray() - if iter.ReadString() != "a" { - t.FailNow() - } -} - -func Test_encode_nil_map(t *testing.T) { - should := require.New(t) - type Ttest map[string]string - var obj1 Ttest - output, err := json.Marshal(obj1) - should.Nil(err) - should.Equal("null", string(output)) - output, err = json.Marshal(&obj1) - should.Nil(err) - should.Equal("null", string(output)) - output, err = Marshal(obj1) - should.Nil(err) - should.Equal("null", string(output)) - output, err = Marshal(&obj1) - should.Nil(err) - should.Equal("null", string(output)) -} - -func Test_encode_nil_array(t *testing.T) { - should := require.New(t) - type Ttest []string - var obj1 Ttest - output, err := json.Marshal(obj1) - should.Nil(err) - should.Equal("null", string(output)) - output, err = json.Marshal(&obj1) - should.Nil(err) - should.Equal("null", string(output)) - output, err = Marshal(obj1) - should.Nil(err) - should.Equal("null", string(output)) - output, err = Marshal(&obj1) - should.Nil(err) - should.Equal("null", string(output)) -} - -func Test_decode_nil_num(t *testing.T) { - type TestData struct { - Field int `json:"field"` - } - should := require.New(t) - - data1 := []byte(`{"field": 42}`) - data2 := []byte(`{"field": null}`) - - // Checking stdlib behavior as well - obj2 := TestData{} - err := json.Unmarshal(data1, &obj2) - should.Equal(nil, err) - should.Equal(42, obj2.Field) - - err = json.Unmarshal(data2, &obj2) - should.Equal(nil, err) - should.Equal(42, obj2.Field) - - obj := TestData{} - - err = Unmarshal(data1, &obj) - should.Equal(nil, err) - should.Equal(42, obj.Field) - - err = Unmarshal(data2, &obj) - should.Equal(nil, err) - should.Equal(42, obj.Field) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_object_test.go b/vendor/github.com/json-iterator/go/jsoniter_object_test.go deleted file mode 100644 index 4eb1678b7..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_object_test.go +++ /dev/null @@ -1,364 +0,0 @@ -package jsoniter - -import ( - "bytes" - "fmt" - "testing" - - "github.com/stretchr/testify/require" -) - -func Test_empty_object(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `{}`) - field := iter.ReadObject() - should.Equal("", field) - iter = ParseString(ConfigDefault, `{}`) - iter.ReadObjectCB(func(iter *Iterator, field string) bool { - should.FailNow("should not call") - return true - }) -} - -func Test_one_field(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `{"a": "stream"}`) - field := iter.ReadObject() - should.Equal("a", field) - value := iter.ReadString() - should.Equal("stream", value) - field = iter.ReadObject() - should.Equal("", field) - iter = ParseString(ConfigDefault, `{"a": "stream"}`) - should.True(iter.ReadObjectCB(func(iter *Iterator, field string) bool { - should.Equal("a", field) - iter.Skip() - return true - })) - -} - -func Test_two_field(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `{ "a": "stream" , "c": "d" }`) - field := iter.ReadObject() - should.Equal("a", field) - value := iter.ReadString() - should.Equal("stream", value) - field = iter.ReadObject() - should.Equal("c", field) - value = iter.ReadString() - should.Equal("d", value) - field = iter.ReadObject() - should.Equal("", field) - iter = ParseString(ConfigDefault, `{"field1": "1", "field2": 2}`) - for field := iter.ReadObject(); field != ""; field = iter.ReadObject() { - switch field { - case "field1": - iter.ReadString() - case "field2": - iter.ReadInt64() - default: - iter.ReportError("bind object", "unexpected field") - } - } -} - -func Test_object_wrapper_any_get_all(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 []int - Field2 []int - } - any := Wrap(TestObject{[]int{1, 2}, []int{3, 4}}) - should.Contains(any.Get('*', 0).ToString(), `"Field2":3`) - should.Contains(any.Keys(), "Field1") - should.Contains(any.Keys(), "Field2") - should.NotContains(any.Keys(), "Field3") - - //should.Contains(any.GetObject()["Field1"].GetArray()[0], 1) -} - -func Test_write_object(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(Config{IndentionStep: 2}.Froze(), buf, 4096) - stream.WriteObjectStart() - stream.WriteObjectField("hello") - stream.WriteInt(1) - stream.WriteMore() - stream.WriteObjectField("world") - stream.WriteInt(2) - stream.WriteObjectEnd() - stream.Flush() - should.Nil(stream.Error) - should.Equal("{\n \"hello\": 1,\n \"world\": 2\n}", buf.String()) -} - -func Test_write_val_zero_field_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - } - obj := TestObject{} - str, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`{}`, str) -} - -func Test_write_val_one_field_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string `json:"field-1"` - } - obj := TestObject{"hello"} - str, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`{"field-1":"hello"}`, str) -} - -func Test_mixed(t *testing.T) { - should := require.New(t) - type AA struct { - ID int `json:"id"` - Payload map[string]interface{} `json:"payload"` - buf *bytes.Buffer - } - aa := AA{} - err := UnmarshalFromString(` {"id":1, "payload":{"account":"123","password":"456"}}`, &aa) - should.Nil(err) - should.Equal(1, aa.ID) - should.Equal("123", aa.Payload["account"]) -} - -func Test_omit_empty(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string `json:"field-1,omitempty"` - Field2 string `json:"field-2,omitempty"` - Field3 string `json:"field-3,omitempty"` - } - obj := TestObject{} - obj.Field2 = "hello" - str, err := MarshalToString(&obj) - should.Nil(err) - should.Equal(`{"field-2":"hello"}`, str) -} - -func Test_ignore_field_on_not_valid_type(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string `json:"field-1,omitempty"` - Field2 func() `json:"-"` - } - obj := TestObject{} - obj.Field1 = "hello world" - obj.Field2 = func() {} - str, err := MarshalToString(&obj) - should.Nil(err) - should.Equal(`{"field-1":"hello world"}`, str) -} - -func Test_nested_field_omit_empty(t *testing.T) { - should := require.New(t) - type S1 struct { - F1 string `json:",omitempty"` - } - - type S2 struct { - *S1 - F2 string `json:",omitempty"` - } - s1 := &S1{ - //F1: "abc", - } - s2 := &S2{ - S1: s1, - F2: "123", - } - str, err := MarshalToString(s2) - should.Nil(err) - should.Equal(`{"F2":"123"}`, str) -} - -func Test_recursive_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - Me *TestObject - } - obj := TestObject{} - str, err := MarshalToString(obj) - should.Nil(err) - should.Contains(str, `"Field1":""`) - should.Contains(str, `"Me":null`) - err = UnmarshalFromString(str, &obj) - should.Nil(err) -} - -func Test_encode_anonymous_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field string - } - str, err := MarshalToString(struct { - TestObject - Field int - }{ - Field: 100, - }) - should.Nil(err) - should.Equal(`{"Field":100}`, str) -} - -func Test_decode_anonymous_struct(t *testing.T) { - should := require.New(t) - type Inner struct { - Key string `json:"key"` - } - - type Outer struct { - Inner - } - var outer Outer - j := []byte("{\"key\":\"value\"}") - should.Nil(Unmarshal(j, &outer)) - should.Equal("value", outer.Key) -} - -func Test_multiple_level_anonymous_struct(t *testing.T) { - type Level1 struct { - Field1 string - } - type Level2 struct { - Level1 - Field2 string - } - type Level3 struct { - Level2 - Field3 string - } - should := require.New(t) - obj := Level3{Level2{Level1{"1"}, "2"}, "3"} - output, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`{"Field1":"1","Field2":"2","Field3":"3"}`, output) -} - -func Test_multiple_level_anonymous_struct_with_ptr(t *testing.T) { - type Level1 struct { - Field1 string - Field2 string - Field4 string - } - type Level2 struct { - *Level1 - Field2 string - Field3 string - } - type Level3 struct { - *Level2 - Field3 string - } - should := require.New(t) - obj := Level3{&Level2{&Level1{"1", "", "4"}, "2", ""}, "3"} - output, err := MarshalToString(obj) - should.Nil(err) - should.Contains(output, `"Field1":"1"`) - should.Contains(output, `"Field2":"2"`) - should.Contains(output, `"Field3":"3"`) - should.Contains(output, `"Field4":"4"`) -} - -func Test_shadow_struct_field(t *testing.T) { - should := require.New(t) - type omit *struct{} - type CacheItem struct { - Key string `json:"key"` - MaxAge int `json:"cacheAge"` - } - output, err := MarshalToString(struct { - *CacheItem - - // Omit bad keys - OmitMaxAge omit `json:"cacheAge,omitempty"` - - // Add nice keys - MaxAge int `json:"max_age"` - }{ - CacheItem: &CacheItem{ - Key: "value", - MaxAge: 100, - }, - MaxAge: 20, - }) - should.Nil(err) - should.Contains(output, `"key":"value"`) - should.Contains(output, `"max_age":20`) -} - -func Test_embedded_order(t *testing.T) { - type A struct { - Field2 string - } - - type C struct { - Field5 string - } - - type B struct { - Field4 string - C - Field6 string - } - - type TestObject struct { - Field1 string - A - Field3 string - B - Field7 string - } - should := require.New(t) - s := TestObject{} - output, err := MarshalToString(s) - should.Nil(err) - should.Equal(`{"Field1":"","Field2":"","Field3":"","Field4":"","Field5":"","Field6":"","Field7":""}`, output) -} - -func Test_decode_nested(t *testing.T) { - type StructOfString struct { - Field1 string - Field2 string - } - iter := ParseString(ConfigDefault, `[{"field1": "hello"}, null, {"field2": "world"}]`) - slice := []*StructOfString{} - iter.ReadVal(&slice) - if len(slice) != 3 { - fmt.Println(iter.Error) - t.Fatal(len(slice)) - } - if slice[0].Field1 != "hello" { - fmt.Println(iter.Error) - t.Fatal(slice[0]) - } - if slice[1] != nil { - fmt.Println(iter.Error) - t.Fatal(slice[1]) - } - if slice[2].Field2 != "world" { - fmt.Println(iter.Error) - t.Fatal(slice[2]) - } -} - -func Test_decode_field_with_escape(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - } - var obj TestObject - should.Nil(ConfigCompatibleWithStandardLibrary.Unmarshal([]byte(`{"Field\"1":"hello"}`), &obj)) - should.Equal("", obj.Field1) - should.Nil(ConfigCompatibleWithStandardLibrary.Unmarshal([]byte(`{"\u0046ield1":"hello"}`), &obj)) - should.Equal("hello", obj.Field1) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_optional_test.go b/vendor/github.com/json-iterator/go/jsoniter_optional_test.go deleted file mode 100644 index 82b789b50..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_optional_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package jsoniter - -import ( - "github.com/stretchr/testify/require" - "testing" -) - -func Test_encode_optional_int_pointer(t *testing.T) { - should := require.New(t) - var ptr *int - str, err := MarshalToString(ptr) - should.Nil(err) - should.Equal("null", str) - val := 100 - ptr = &val - str, err = MarshalToString(ptr) - should.Nil(err) - should.Equal("100", str) -} - -func Test_decode_struct_with_optional_field(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 *string - Field2 *string - } - obj := TestObject{} - UnmarshalFromString(`{"field1": null, "field2": "world"}`, &obj) - should.Nil(obj.Field1) - should.Equal("world", *obj.Field2) -} - -func Test_encode_struct_with_optional_field(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 *string - Field2 *string - } - obj := TestObject{} - world := "world" - obj.Field2 = &world - str, err := MarshalToString(obj) - should.Nil(err) - should.Contains(str, `"Field1":null`) - should.Contains(str, `"Field2":"world"`) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_raw_message_test.go b/vendor/github.com/json-iterator/go/jsoniter_raw_message_test.go deleted file mode 100644 index 4fba33f89..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_raw_message_test.go +++ /dev/null @@ -1,114 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "github.com/stretchr/testify/require" - "strings" - "testing" -) - -func Test_json_RawMessage(t *testing.T) { - should := require.New(t) - var data json.RawMessage - should.Nil(Unmarshal([]byte(`[1,2,3]`), &data)) - should.Equal(`[1,2,3]`, string(data)) - str, err := MarshalToString(data) - should.Nil(err) - should.Equal(`[1,2,3]`, str) -} - -func Test_jsoniter_RawMessage(t *testing.T) { - should := require.New(t) - var data RawMessage - should.Nil(Unmarshal([]byte(`[1,2,3]`), &data)) - should.Equal(`[1,2,3]`, string(data)) - str, err := MarshalToString(data) - should.Nil(err) - should.Equal(`[1,2,3]`, str) -} - -func Test_json_RawMessage_in_struct(t *testing.T) { - type TestObject struct { - Field1 string - Field2 json.RawMessage - } - should := require.New(t) - var data TestObject - should.Nil(Unmarshal([]byte(`{"field1": "hello", "field2": [1,2,3]}`), &data)) - should.Equal(` [1,2,3]`, string(data.Field2)) - 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 - b := []byte("{\"test\":[{\"key\":\"value\"}]}") - var rawMap RawMap - should.Nil(Unmarshal(b, &rawMap)) - should.Equal(`[{"key":"value"}]`, string(*rawMap["test"])) - type Inner struct { - Key string `json:"key"` - } - var inner []Inner - Unmarshal(*rawMap["test"], &inner) - should.Equal("value", inner[0].Key) -} - -func Test_encode_map_of_raw_message(t *testing.T) { - should := require.New(t) - type RawMap map[string]*json.RawMessage - value := json.RawMessage("[]") - rawMap := RawMap{"hello": &value} - output, err := MarshalToString(rawMap) - should.Nil(err) - should.Equal(`{"hello":[]}`, output) -} - -func Test_encode_map_of_jsoniter_raw_message(t *testing.T) { - should := require.New(t) - type RawMap map[string]*RawMessage - value := RawMessage("[]") - rawMap := RawMap{"hello": &value} - output, err := MarshalToString(rawMap) - should.Nil(err) - should.Equal(`{"hello":[]}`, output) -} - -func Test_marshal_invalid_json_raw_message(t *testing.T) { - type A struct { - Raw json.RawMessage `json:"raw"` - } - message := []byte(`{}`) - - a := A{} - should := require.New(t) - should.Nil(ConfigCompatibleWithStandardLibrary.Unmarshal(message, &a)) - aout, aouterr := ConfigCompatibleWithStandardLibrary.Marshal(&a) - should.Equal(`{"raw":null}`, string(aout)) - should.Nil(aouterr) -} - -func Test_raw_message_memory_not_copied_issue(t *testing.T) { - jsonStream := `{"name":"xxxxx","bundle_id":"com.zonst.majiang","app_platform":"ios","app_category":"100103", "budget_day":1000,"bidding_min":1,"bidding_max":2,"bidding_type":"CPM", "freq":{"open":true,"type":"day","num":100},"speed":1, "targeting":{"vendor":{"open":true,"list":["zonst"]}, "geo_code":{"open":true,"list":["156110100"]},"app_category":{"open":true,"list":["100101"]}, "day_parting":{"open":true,"list":["100409","100410"]},"device_type":{"open":true,"list":["ipad"]}, "os_version":{"open":true,"list":[10]},"carrier":{"open":true,"list":["mobile"]}, "network":{"open":true,"list":["4G"]}},"url":{"tracking_imp_url":"http://www.baidu.com", "tracking_clk_url":"http://www.baidu.com","jump_url":"http://www.baidu.com","deep_link_url":"http://www.baidu.com"}}` - type IteratorObject struct { - Name *string `json:"name"` - BundleId *string `json:"bundle_id"` - AppCategory *string `json:"app_category"` - AppPlatform *string `json:"app_platform"` - BudgetDay *float32 `json:"budget_day"` - BiddingMax *float32 `json:"bidding_max"` - BiddingMin *float32 `json:"bidding_min"` - BiddingType *string `json:"bidding_type"` - Freq *RawMessage `json:"freq"` - Targeting *RawMessage `json:"targeting"` - Url *RawMessage `json:"url"` - Speed *int `json:"speed" db:"speed"` - } - - obj := &IteratorObject{} - decoder := NewDecoder(strings.NewReader(jsonStream)) - err := decoder.Decode(obj) - should := require.New(t) - should.Nil(err) - should.Equal(`{"open":true,"type":"day","num":100}`, string(*obj.Freq)) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_reader_test.go b/vendor/github.com/json-iterator/go/jsoniter_reader_test.go deleted file mode 100644 index b3b3588e1..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_reader_test.go +++ /dev/null @@ -1,57 +0,0 @@ -package jsoniter - -import ( - "github.com/stretchr/testify/require" - "strings" - "testing" - "time" -) - -func Test_reader_and_load_more(t *testing.T) { - should := require.New(t) - type TestObject struct { - CreatedAt time.Time - } - reader := strings.NewReader(` -{ - "agency": null, - "candidateId": 0, - "candidate": "Blah Blah", - "bookingId": 0, - "shiftId": 1, - "shiftTypeId": 0, - "shift": "Standard", - "bonus": 0, - "bonusNI": 0, - "days": [], - "totalHours": 27, - "expenses": [], - "weekEndingDateSystem": "2016-10-09", - "weekEndingDateClient": "2016-10-09", - "submittedAt": null, - "submittedById": null, - "approvedAt": "2016-10-10T18:38:04Z", - "approvedById": 0, - "authorisedAt": "2016-10-10T18:38:04Z", - "authorisedById": 0, - "invoicedAt": "2016-10-10T20:00:00Z", - "revokedAt": null, - "revokedById": null, - "revokeReason": null, - "rejectedAt": null, - "rejectedById": null, - "rejectReasonCode": null, - "rejectReason": null, - "createdAt": "2016-10-03T00:00:00Z", - "updatedAt": "2016-11-09T10:26:13Z", - "updatedById": null, - "overrides": [], - "bookingApproverId": null, - "bookingApprover": null, - "status": "approved" -} - `) - decoder := ConfigCompatibleWithStandardLibrary.NewDecoder(reader) - obj := TestObject{} - should.Nil(decoder.Decode(&obj)) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_reflect_native_test.go b/vendor/github.com/json-iterator/go/jsoniter_reflect_native_test.go deleted file mode 100644 index 0e2d68bba..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_reflect_native_test.go +++ /dev/null @@ -1,154 +0,0 @@ -package jsoniter - -import ( - "fmt" - "testing" -) - -func Test_reflect_str(t *testing.T) { - iter := ParseString(ConfigDefault, `"hello"`) - str := "" - iter.ReadVal(&str) - if str != "hello" { - fmt.Println(iter.Error) - t.Fatal(str) - } -} - -func Test_reflect_ptr_str(t *testing.T) { - iter := ParseString(ConfigDefault, `"hello"`) - var str *string - iter.ReadVal(&str) - if *str != "hello" { - t.Fatal(str) - } -} - -func Test_reflect_int(t *testing.T) { - iter := ParseString(ConfigDefault, `123`) - val := int(0) - iter.ReadVal(&val) - if val != 123 { - t.Fatal(val) - } -} - -func Test_reflect_int8(t *testing.T) { - iter := ParseString(ConfigDefault, `123`) - val := int8(0) - iter.ReadVal(&val) - if val != 123 { - t.Fatal(val) - } -} - -func Test_reflect_int16(t *testing.T) { - iter := ParseString(ConfigDefault, `123`) - val := int16(0) - iter.ReadVal(&val) - if val != 123 { - t.Fatal(val) - } -} - -func Test_reflect_int32(t *testing.T) { - iter := ParseString(ConfigDefault, `123`) - val := int32(0) - iter.ReadVal(&val) - if val != 123 { - t.Fatal(val) - } -} - -func Test_reflect_int64(t *testing.T) { - iter := ParseString(ConfigDefault, `123`) - val := int64(0) - iter.ReadVal(&val) - if val != 123 { - t.Fatal(val) - } -} - -func Test_reflect_uint(t *testing.T) { - iter := ParseString(ConfigDefault, `123`) - val := uint(0) - iter.ReadVal(&val) - if val != 123 { - t.Fatal(val) - } -} - -func Test_reflect_uint8(t *testing.T) { - iter := ParseString(ConfigDefault, `123`) - val := uint8(0) - iter.ReadVal(&val) - if val != 123 { - t.Fatal(val) - } -} - -func Test_reflect_uint16(t *testing.T) { - iter := ParseString(ConfigDefault, `123`) - val := uint16(0) - iter.ReadVal(&val) - if val != 123 { - t.Fatal(val) - } -} - -func Test_reflect_uint32(t *testing.T) { - iter := ParseString(ConfigDefault, `123`) - val := uint32(0) - iter.ReadVal(&val) - if val != 123 { - t.Fatal(val) - } -} - -func Test_reflect_uint64(t *testing.T) { - iter := ParseString(ConfigDefault, `123`) - val := uint64(0) - iter.ReadVal(&val) - if val != 123 { - t.Fatal(val) - } -} - -func Test_reflect_byte(t *testing.T) { - iter := ParseString(ConfigDefault, `123`) - val := byte(0) - iter.ReadVal(&val) - if val != 123 { - t.Fatal(val) - } -} - -func Test_reflect_float32(t *testing.T) { - iter := ParseString(ConfigDefault, `1.23`) - val := float32(0) - iter.ReadVal(&val) - if val != 1.23 { - fmt.Println(iter.Error) - t.Fatal(val) - } -} - -func Test_reflect_float64(t *testing.T) { - iter := ParseString(ConfigDefault, `1.23`) - val := float64(0) - iter.ReadVal(&val) - if val != 1.23 { - fmt.Println(iter.Error) - t.Fatal(val) - } -} - -func Test_reflect_bool(t *testing.T) { - iter := ParseString(ConfigDefault, `true`) - val := false - iter.ReadVal(&val) - if val != true { - fmt.Println(iter.Error) - t.Fatal(val) - } -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_string_test.go b/vendor/github.com/json-iterator/go/jsoniter_string_test.go deleted file mode 100644 index 61c0f33b3..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_string_test.go +++ /dev/null @@ -1,261 +0,0 @@ -// +build go1.8 - -package jsoniter - -import ( - "bytes" - "encoding/json" - "fmt" - "testing" - "unicode/utf8" - - "github.com/stretchr/testify/require" -) - -func Test_read_string(t *testing.T) { - badInputs := []string{ - ``, - `"`, - `"\"`, - `"\\\"`, - "\"\n\"", - `"\U0001f64f"`, - `"\uD83D\u00"`, - } - for i := 0; i < 32; i++ { - // control characters are invalid - badInputs = append(badInputs, string([]byte{'"', byte(i), '"'})) - } - - for _, input := range badInputs { - testReadString(t, input, "", true, "json.Unmarshal", json.Unmarshal) - testReadString(t, input, "", true, "jsoniter.Unmarshal", Unmarshal) - testReadString(t, input, "", true, "jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal", ConfigCompatibleWithStandardLibrary.Unmarshal) - } - - goodInputs := []struct { - input string - expectValue string - }{ - {`""`, ""}, - {`"a"`, "a"}, - {`null`, ""}, - {`"Iñtërnâtiônàlizætiøn,💝🐹🌇⛔"`, "Iñtërnâtiônàlizætiøn,💝🐹🌇⛔"}, - {`"\uD83D"`, string([]byte{239, 191, 189})}, - {`"\uD83D\\"`, string([]byte{239, 191, 189, '\\'})}, - {`"\uD83D\ub000"`, string([]byte{239, 191, 189, 235, 128, 128})}, - {`"\uD83D\ude04"`, "😄"}, - {`"\uDEADBEEF"`, string([]byte{239, 191, 189, 66, 69, 69, 70})}, - } - - for _, tc := range goodInputs { - testReadString(t, tc.input, tc.expectValue, false, "json.Unmarshal", json.Unmarshal) - testReadString(t, tc.input, tc.expectValue, false, "jsoniter.Unmarshal", Unmarshal) - testReadString(t, tc.input, tc.expectValue, false, "jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal", ConfigCompatibleWithStandardLibrary.Unmarshal) - } -} - -func testReadString(t *testing.T, input string, expectValue string, expectError bool, marshalerName string, marshaler func([]byte, interface{}) error) { - var value string - err := marshaler([]byte(input), &value) - if expectError != (err != nil) { - t.Errorf("%q: %s: expected error %v, got %v", input, marshalerName, expectError, err) - return - } - if value != expectValue { - t.Errorf("%q: %s: expected %q, got %q", input, marshalerName, expectValue, value) - return - } -} - -func Test_read_normal_string(t *testing.T) { - cases := map[string]string{ - `"0123456789012345678901234567890123456789"`: `0123456789012345678901234567890123456789`, - `""`: ``, - `"hello"`: `hello`, - } - for input, output := range cases { - t.Run(fmt.Sprintf("%v:%v", input, output), func(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, input) - should.Equal(output, iter.ReadString()) - }) - t.Run(fmt.Sprintf("%v:%v", input, output), func(t *testing.T) { - should := require.New(t) - iter := Parse(ConfigDefault, bytes.NewBufferString(input), 2) - should.Equal(output, iter.ReadString()) - }) - t.Run(fmt.Sprintf("%v:%v", input, output), func(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, input) - should.Equal(output, string(iter.ReadStringAsSlice())) - }) - t.Run(fmt.Sprintf("%v:%v", input, output), func(t *testing.T) { - should := require.New(t) - iter := Parse(ConfigDefault, bytes.NewBufferString(input), 2) - should.Equal(output, string(iter.ReadStringAsSlice())) - }) - } -} - -func Test_read_exotic_string(t *testing.T) { - cases := map[string]string{ - `"hel\"lo"`: `hel"lo`, - `"hel\\\/lo"`: `hel\/lo`, - `"hel\\blo"`: `hel\blo`, - `"hel\\\blo"`: "hel\\\blo", - `"hel\\nlo"`: `hel\nlo`, - `"hel\\\nlo"`: "hel\\\nlo", - `"hel\\tlo"`: `hel\tlo`, - `"hel\\flo"`: `hel\flo`, - `"hel\\\flo"`: "hel\\\flo", - `"hel\\\rlo"`: "hel\\\rlo", - `"hel\\\tlo"`: "hel\\\tlo", - `"\u4e2d\u6587"`: "中文", - `"\ud83d\udc4a"`: "\xf0\x9f\x91\x8a", // surrogate - } - for input, output := range cases { - t.Run(fmt.Sprintf("%v:%v", input, output), func(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, input) - var v string - should.Nil(json.Unmarshal([]byte(input), &v)) - should.Equal(v, iter.ReadString()) - }) - t.Run(fmt.Sprintf("%v:%v", input, output), func(t *testing.T) { - should := require.New(t) - iter := Parse(ConfigDefault, bytes.NewBufferString(input), 2) - should.Equal(output, iter.ReadString()) - }) - } -} - -func Test_read_string_as_interface(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `"hello"`) - should.Equal("hello", iter.Read()) -} - -func Test_write_string(t *testing.T) { - should := require.New(t) - str, err := MarshalToString("hello") - should.Equal(`"hello"`, str) - should.Nil(err) - str, err = MarshalToString(`hel"lo`) - should.Equal(`"hel\"lo"`, str) - should.Nil(err) -} - -func Test_write_val_string(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteVal("hello") - stream.Flush() - should.Nil(stream.Error) - should.Equal(`"hello"`, buf.String()) -} - -func Test_decode_slash(t *testing.T) { - should := require.New(t) - var obj interface{} - should.NotNil(json.Unmarshal([]byte("\\"), &obj)) - should.NotNil(UnmarshalFromString("\\", &obj)) -} - -func Test_html_escape(t *testing.T) { - should := require.New(t) - output, err := json.Marshal(`>`) - should.Nil(err) - should.Equal(`"\u003e"`, string(output)) - output, err = ConfigCompatibleWithStandardLibrary.Marshal(`>`) - should.Nil(err) - should.Equal(`"\u003e"`, string(output)) - type MyString string - output, err = ConfigCompatibleWithStandardLibrary.Marshal(MyString(`>`)) - should.Nil(err) - should.Equal(`"\u003e"`, string(output)) -} - -func Test_string_encode_with_std(t *testing.T) { - should := require.New(t) - for i := 0; i < utf8.RuneSelf; i++ { - input := string([]byte{byte(i)}) - stdOutputBytes, err := json.Marshal(input) - should.Nil(err) - stdOutput := string(stdOutputBytes) - jsoniterOutputBytes, err := ConfigCompatibleWithStandardLibrary.Marshal(input) - should.Nil(err) - jsoniterOutput := string(jsoniterOutputBytes) - should.Equal(stdOutput, jsoniterOutput) - } -} - -func Test_unicode(t *testing.T) { - should := require.New(t) - output, _ := MarshalToString(map[string]interface{}{"a": "数字山谷"}) - should.Equal(`{"a":"数字山谷"}`, output) - output, _ = Config{EscapeHTML: false}.Froze().MarshalToString(map[string]interface{}{"a": "数字山谷"}) - should.Equal(`{"a":"数字山谷"}`, output) -} - -func Test_unicode_and_escape(t *testing.T) { - should := require.New(t) - output, err := MarshalToString(`"数字山谷"`) - should.Nil(err) - should.Equal(`"\"数字山谷\""`, output) - output, err = ConfigFastest.MarshalToString(`"数字山谷"`) - should.Nil(err) - should.Equal(`"\"数字山谷\""`, output) -} - -func Test_unsafe_unicode(t *testing.T) { - ConfigDefault.(*frozenConfig).cleanEncoders() - should := require.New(t) - output, err := ConfigDefault.MarshalToString("he\u2029\u2028he") - should.Nil(err) - should.Equal(`"he\u2029\u2028he"`, output) - output, err = ConfigFastest.MarshalToString("he\u2029\u2028he") - should.Nil(err) - should.Equal("\"he\u2029\u2028he\"", output) -} - -func Benchmark_jsoniter_unicode(b *testing.B) { - for n := 0; n < b.N; n++ { - iter := ParseString(ConfigDefault, `"\ud83d\udc4a"`) - iter.ReadString() - } -} - -func Benchmark_jsoniter_ascii(b *testing.B) { - iter := NewIterator(ConfigDefault) - input := []byte(`"hello, world! hello, world!"`) - b.ResetTimer() - for n := 0; n < b.N; n++ { - iter.ResetBytes(input) - iter.ReadString() - } -} - -func Benchmark_jsoniter_string_as_bytes(b *testing.B) { - iter := ParseString(ConfigDefault, `"hello, world!"`) - b.ResetTimer() - for n := 0; n < b.N; n++ { - iter.ResetBytes(iter.buf) - iter.ReadStringAsSlice() - } -} - -func Benchmark_json_unicode(b *testing.B) { - for n := 0; n < b.N; n++ { - result := "" - json.Unmarshal([]byte(`"\ud83d\udc4a"`), &result) - } -} - -func Benchmark_json_ascii(b *testing.B) { - for n := 0; n < b.N; n++ { - result := "" - json.Unmarshal([]byte(`"hello"`), &result) - } -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_struct_decoder_test.go b/vendor/github.com/json-iterator/go/jsoniter_struct_decoder_test.go deleted file mode 100644 index 257bbdb65..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_struct_decoder_test.go +++ /dev/null @@ -1,267 +0,0 @@ -package jsoniter - -import ( - "github.com/stretchr/testify/require" - "testing" -) - -func Test_decode_one_field_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - } - obj := TestObject{} - should.Nil(UnmarshalFromString(`{}`, &obj)) - should.Equal("", obj.Field1) - should.Nil(UnmarshalFromString(`{"field1": "hello"}`, &obj)) - should.Equal("hello", obj.Field1) -} - -func Test_decode_two_fields_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - Field2 string - } - obj := TestObject{} - should.Nil(UnmarshalFromString(`{}`, &obj)) - should.Equal("", obj.Field1) - should.Nil(UnmarshalFromString(`{"Field1": "a", "Field2": "stream"}`, &obj)) - should.Equal("a", obj.Field1) - should.Equal("stream", obj.Field2) -} - -func Test_decode_three_fields_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - Field2 string - Field3 string - } - obj := TestObject{} - should.Nil(UnmarshalFromString(`{}`, &obj)) - should.Equal("", obj.Field1) - should.Nil(UnmarshalFromString(`{"Field1": "a", "Field2": "stream", "Field3": "c"}`, &obj)) - should.Equal("a", obj.Field1) - should.Equal("stream", obj.Field2) - should.Equal("c", obj.Field3) -} - -func Test_decode_four_fields_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - Field2 string - Field3 string - Field4 string - } - obj := TestObject{} - should.Nil(UnmarshalFromString(`{}`, &obj)) - should.Equal("", obj.Field1) - should.Nil(UnmarshalFromString(`{"Field1": "a", "Field2": "stream", "Field3": "c", "Field4": "d"}`, &obj)) - should.Equal("a", obj.Field1) - should.Equal("stream", obj.Field2) - should.Equal("c", obj.Field3) - should.Equal("d", obj.Field4) -} - -func Test_decode_five_fields_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - Field2 string - Field3 string - Field4 string - Field5 string - } - obj := TestObject{} - should.Nil(UnmarshalFromString(`{}`, &obj)) - should.Equal("", obj.Field1) - should.Nil(UnmarshalFromString(`{"Field1": "a", "Field2": "stream", "Field3": "c", "Field4": "d", "Field5": "e"}`, &obj)) - should.Equal("a", obj.Field1) - should.Equal("stream", obj.Field2) - should.Equal("c", obj.Field3) - should.Equal("d", obj.Field4) - should.Equal("e", obj.Field5) -} - -func Test_decode_six_fields_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - Field2 string - Field3 string - Field4 string - Field5 string - Field6 string - } - obj := TestObject{} - should.Nil(UnmarshalFromString(`{}`, &obj)) - should.Equal("", obj.Field1) - should.Nil(UnmarshalFromString(`{"Field1": "a", "Field2": "stream", "Field3": "c", "Field4": "d", "Field5": "e", "Field6": "x"}`, &obj)) - should.Equal("a", obj.Field1) - should.Equal("stream", obj.Field2) - should.Equal("c", obj.Field3) - should.Equal("d", obj.Field4) - should.Equal("e", obj.Field5) - should.Equal("x", obj.Field6) -} - -func Test_decode_seven_fields_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - Field2 string - Field3 string - Field4 string - Field5 string - Field6 string - Field7 string - } - obj := TestObject{} - should.Nil(UnmarshalFromString(`{}`, &obj)) - should.Equal("", obj.Field1) - should.Nil(UnmarshalFromString(`{"Field1": "a", "Field2": "stream", "Field3": "c", "Field4": "d", "Field5": "e", "Field6": "x", "Field7":"y"}`, &obj)) - should.Equal("a", obj.Field1) - should.Equal("stream", obj.Field2) - should.Equal("c", obj.Field3) - should.Equal("d", obj.Field4) - should.Equal("e", obj.Field5) - should.Equal("x", obj.Field6) - should.Equal("y", obj.Field7) -} - -func Test_decode_eight_fields_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - Field2 string - Field3 string - Field4 string - Field5 string - Field6 string - Field7 string - Field8 string - } - obj := TestObject{} - should.Nil(UnmarshalFromString(`{}`, &obj)) - should.Equal("", obj.Field1) - should.Nil(UnmarshalFromString(`{"Field8":"1", "Field1": "a", "Field2": "stream", "Field3": "c", "Field4": "d", "Field5": "e", "Field6": "x", "Field7":"y"}`, &obj)) - should.Equal("a", obj.Field1) - should.Equal("stream", obj.Field2) - should.Equal("c", obj.Field3) - should.Equal("d", obj.Field4) - should.Equal("e", obj.Field5) - should.Equal("x", obj.Field6) - should.Equal("y", obj.Field7) - should.Equal("1", obj.Field8) -} - -func Test_decode_nine_fields_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - Field2 string - Field3 string - Field4 string - Field5 string - Field6 string - Field7 string - Field8 string - Field9 string - } - obj := TestObject{} - should.Nil(UnmarshalFromString(`{}`, &obj)) - should.Equal("", obj.Field1) - should.Nil(UnmarshalFromString(`{"Field8" : "zzzzzzzzzzz", "Field7": "zz", "Field6" : "xx", "Field1": "a", "Field2": "stream", "Field3": "c", "Field4": "d", "Field5": "e", "Field9":"f"}`, &obj)) - should.Equal("a", obj.Field1) - should.Equal("stream", obj.Field2) - should.Equal("c", obj.Field3) - should.Equal("d", obj.Field4) - should.Equal("e", obj.Field5) - should.Equal("xx", obj.Field6) - should.Equal("zz", obj.Field7) - should.Equal("zzzzzzzzzzz", obj.Field8) - should.Equal("f", obj.Field9) -} - -func Test_decode_ten_fields_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - Field2 string - Field3 string - Field4 string - Field5 string - Field6 string - Field7 string - Field8 string - Field9 string - Field10 string - } - obj := TestObject{} - should.Nil(UnmarshalFromString(`{}`, &obj)) - should.Equal("", obj.Field1) - should.Nil(UnmarshalFromString(`{"Field10":"x", "Field9": "x", "Field8":"x", "Field7":"x", "Field6":"x", "Field1": "a", "Field2": "stream", "Field3": "c", "Field4": "d", "Field5": "e"}`, &obj)) - should.Equal("a", obj.Field1) - should.Equal("stream", obj.Field2) - should.Equal("c", obj.Field3) - should.Equal("d", obj.Field4) - should.Equal("e", obj.Field5) - should.Equal("x", obj.Field6) - should.Equal("x", obj.Field7) - should.Equal("x", obj.Field8) - should.Equal("x", obj.Field9) - should.Equal("x", obj.Field10) -} - -func Test_decode_more_than_ten_fields_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - Field2 string - Field3 string - Field4 string - Field5 string - Field6 string - Field7 string - Field8 string - Field9 string - Field10 string - Field11 int - } - obj := TestObject{} - should.Nil(UnmarshalFromString(`{}`, &obj)) - should.Equal("", obj.Field1) - should.Nil(UnmarshalFromString(`{"field11":1, "field1": "a", "Field2": "stream", "Field3": "c", "Field4": "d", "Field5": "e"}`, &obj)) - should.Equal("a", obj.Field1) - should.Equal("stream", obj.Field2) - should.Equal("c", obj.Field3) - should.Equal("d", obj.Field4) - should.Equal("e", obj.Field5) - should.Equal(1, obj.Field11) -} - -func Test_decode_struct_field_with_tag(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string `json:"field-1"` - Field2 string `json:"-"` - Field3 int `json:",string"` - } - obj := TestObject{Field2: "world"} - UnmarshalFromString(`{"field-1": "hello", "field2": "", "Field3": "100"}`, &obj) - should.Equal("hello", obj.Field1) - should.Equal("world", obj.Field2) - should.Equal(100, obj.Field3) -} - -func Test_decode_struct_field_with_tag_string(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 int `json:",string"` - } - obj := TestObject{Field1: 100} - should.Nil(UnmarshalFromString(`{"Field1": "100"}`, &obj)) - should.Equal(100, obj.Field1) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_struct_encoder_test.go b/vendor/github.com/json-iterator/go/jsoniter_struct_encoder_test.go deleted file mode 100644 index 0e3e54188..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_struct_encoder_test.go +++ /dev/null @@ -1,52 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "testing" - "time" - - "github.com/stretchr/testify/require" -) - -func Test_encode_unexported_field(t *testing.T) { - type TestData struct { - a int - b <-chan int - C int - d *time.Timer - } - - should := require.New(t) - - testChan := make(<-chan int, 10) - testTimer := time.NewTimer(10 * time.Second) - - obj := &TestData{ - a: 42, - b: testChan, - C: 21, - d: testTimer, - } - - jb, err := json.Marshal(obj) - should.NoError(err) - should.Equal([]byte(`{"C":21}`), jb) - - err = json.Unmarshal([]byte(`{"a": 444, "b":"bad", "C":55, "d":{"not": "a timer"}}`), obj) - should.NoError(err) - should.Equal(42, obj.a) - should.Equal(testChan, obj.b) - should.Equal(55, obj.C) - should.Equal(testTimer, obj.d) - - jb, err = Marshal(obj) - should.NoError(err) - should.Equal(jb, []byte(`{"C":55}`)) - - err = Unmarshal([]byte(`{"a": 444, "b":"bad", "C":256, "d":{"not":"a timer"}}`), obj) - should.NoError(err) - should.Equal(42, obj.a) - should.Equal(testChan, obj.b) - should.Equal(256, obj.C) - should.Equal(testTimer, obj.d) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_array_test.go b/vendor/github.com/json-iterator/go/misc_tests/jsoniter_array_test.go similarity index 74% rename from vendor/github.com/json-iterator/go/jsoniter_array_test.go rename to vendor/github.com/json-iterator/go/misc_tests/jsoniter_array_test.go index 0f71ecb68..ef467d184 100644 --- a/vendor/github.com/json-iterator/go/jsoniter_array_test.go +++ b/vendor/github.com/json-iterator/go/misc_tests/jsoniter_array_test.go @@ -1,19 +1,20 @@ -package jsoniter +package misc_tests import ( "bytes" "encoding/json" + "github.com/json-iterator/go" "github.com/stretchr/testify/require" "testing" ) func Test_empty_array(t *testing.T) { should := require.New(t) - iter := ParseString(ConfigDefault, `[]`) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `[]`) cont := iter.ReadArray() should.False(cont) - iter = ParseString(ConfigDefault, `[]`) - iter.ReadArrayCB(func(iter *Iterator) bool { + iter = jsoniter.ParseString(jsoniter.ConfigDefault, `[]`) + iter.ReadArrayCB(func(iter *jsoniter.Iterator) bool { should.FailNow("should not call") return true }) @@ -21,12 +22,12 @@ func Test_empty_array(t *testing.T) { func Test_one_element(t *testing.T) { should := require.New(t) - iter := ParseString(ConfigDefault, `[1]`) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `[1]`) should.True(iter.ReadArray()) should.Equal(1, iter.ReadInt()) should.False(iter.ReadArray()) - iter = ParseString(ConfigDefault, `[1]`) - iter.ReadArrayCB(func(iter *Iterator) bool { + iter = jsoniter.ParseString(jsoniter.ConfigDefault, `[1]`) + iter.ReadArrayCB(func(iter *jsoniter.Iterator) bool { should.Equal(1, iter.ReadInt()) return true }) @@ -34,18 +35,18 @@ func Test_one_element(t *testing.T) { func Test_two_elements(t *testing.T) { should := require.New(t) - iter := ParseString(ConfigDefault, `[1,2]`) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `[1,2]`) should.True(iter.ReadArray()) should.Equal(int64(1), iter.ReadInt64()) should.True(iter.ReadArray()) should.Equal(int64(2), iter.ReadInt64()) should.False(iter.ReadArray()) - iter = ParseString(ConfigDefault, `[1,2]`) + iter = jsoniter.ParseString(jsoniter.ConfigDefault, `[1,2]`) should.Equal([]interface{}{float64(1), float64(2)}, iter.Read()) } func Test_whitespace_in_head(t *testing.T) { - iter := ParseString(ConfigDefault, ` [1]`) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, ` [1]`) cont := iter.ReadArray() if cont != true { t.FailNow() @@ -56,7 +57,7 @@ func Test_whitespace_in_head(t *testing.T) { } func Test_whitespace_after_array_start(t *testing.T) { - iter := ParseString(ConfigDefault, `[ 1]`) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `[ 1]`) cont := iter.ReadArray() if cont != true { t.FailNow() @@ -67,7 +68,7 @@ func Test_whitespace_after_array_start(t *testing.T) { } func Test_whitespace_before_array_end(t *testing.T) { - iter := ParseString(ConfigDefault, `[1 ]`) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `[1 ]`) cont := iter.ReadArray() if cont != true { t.FailNow() @@ -82,7 +83,7 @@ func Test_whitespace_before_array_end(t *testing.T) { } func Test_whitespace_before_comma(t *testing.T) { - iter := ParseString(ConfigDefault, `[1 ,2]`) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `[1 ,2]`) cont := iter.ReadArray() if cont != true { t.FailNow() @@ -106,7 +107,7 @@ func Test_whitespace_before_comma(t *testing.T) { func Test_write_array(t *testing.T) { should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(Config{IndentionStep: 2}.Froze(), buf, 4096) + stream := jsoniter.NewStream(jsoniter.Config{IndentionStep: 2}.Froze(), buf, 4096) stream.WriteArrayStart() stream.WriteInt(1) stream.WriteMore() @@ -120,7 +121,7 @@ func Test_write_array(t *testing.T) { func Test_write_val_array(t *testing.T) { should := require.New(t) val := []int{1, 2, 3} - str, err := MarshalToString(&val) + str, err := jsoniter.MarshalToString(&val) should.Nil(err) should.Equal("[1,2,3]", str) } @@ -128,7 +129,7 @@ func Test_write_val_array(t *testing.T) { func Test_write_val_empty_array(t *testing.T) { should := require.New(t) val := []int{} - str, err := MarshalToString(val) + str, err := jsoniter.MarshalToString(val) should.Nil(err) should.Equal("[]", str) } @@ -140,7 +141,7 @@ func Test_write_array_of_interface_in_struct(t *testing.T) { Field2 string } val := TestObject{[]interface{}{1, 2}, ""} - str, err := MarshalToString(val) + str, err := jsoniter.MarshalToString(val) should.Nil(err) should.Contains(str, `"Field":[1,2]`) should.Contains(str, `"Field2":""`) @@ -151,7 +152,7 @@ func Test_encode_byte_array(t *testing.T) { bytes, err := json.Marshal([]byte{1, 2, 3}) should.Nil(err) should.Equal(`"AQID"`, string(bytes)) - bytes, err = Marshal([]byte{1, 2, 3}) + bytes, err = jsoniter.Marshal([]byte{1, 2, 3}) should.Nil(err) should.Equal(`"AQID"`, string(bytes)) } @@ -162,7 +163,7 @@ func Test_decode_byte_array_from_base64(t *testing.T) { err := json.Unmarshal([]byte(`"AQID"`), &data) should.Nil(err) should.Equal([]byte{1, 2, 3}, data) - err = Unmarshal([]byte(`"AQID"`), &data) + err = jsoniter.Unmarshal([]byte(`"AQID"`), &data) should.Nil(err) should.Equal([]byte{1, 2, 3}, data) } @@ -173,7 +174,7 @@ func Test_decode_byte_array_from_array(t *testing.T) { err := json.Unmarshal([]byte(`[1,2,3]`), &data) should.Nil(err) should.Equal([]byte{1, 2, 3}, data) - err = Unmarshal([]byte(`[1,2,3]`), &data) + err = jsoniter.Unmarshal([]byte(`[1,2,3]`), &data) should.Nil(err) should.Equal([]byte{1, 2, 3}, data) } @@ -181,21 +182,21 @@ func Test_decode_byte_array_from_array(t *testing.T) { func Test_decode_slice(t *testing.T) { should := require.New(t) slice := make([]string, 0, 5) - UnmarshalFromString(`["hello", "world"]`, &slice) + jsoniter.UnmarshalFromString(`["hello", "world"]`, &slice) should.Equal([]string{"hello", "world"}, slice) } func Test_decode_large_slice(t *testing.T) { should := require.New(t) slice := make([]int, 0, 1) - UnmarshalFromString(`[1,2,3,4,5,6,7,8,9]`, &slice) + jsoniter.UnmarshalFromString(`[1,2,3,4,5,6,7,8,9]`, &slice) should.Equal([]int{1, 2, 3, 4, 5, 6, 7, 8, 9}, slice) } func Benchmark_jsoniter_array(b *testing.B) { b.ReportAllocs() input := []byte(`[1,2,3,4,5,6,7,8,9]`) - iter := ParseBytes(ConfigDefault, input) + iter := jsoniter.ParseBytes(jsoniter.ConfigDefault, input) b.ResetTimer() for n := 0; n < b.N; n++ { iter.ResetBytes(input) diff --git a/vendor/github.com/json-iterator/go/misc_tests/jsoniter_bool_test.go b/vendor/github.com/json-iterator/go/misc_tests/jsoniter_bool_test.go new file mode 100644 index 000000000..8353d19b4 --- /dev/null +++ b/vendor/github.com/json-iterator/go/misc_tests/jsoniter_bool_test.go @@ -0,0 +1,47 @@ +package misc_tests + +import ( + "bytes" + "testing" + + "github.com/json-iterator/go" + "github.com/stretchr/testify/require" +) + +func Test_true(t *testing.T) { + should := require.New(t) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `true`) + should.True(iter.ReadBool()) + iter = jsoniter.ParseString(jsoniter.ConfigDefault, `true`) + should.Equal(true, iter.Read()) +} + +func Test_false(t *testing.T) { + should := require.New(t) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `false`) + should.False(iter.ReadBool()) +} + +func Test_write_true_false(t *testing.T) { + should := require.New(t) + buf := &bytes.Buffer{} + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) + stream.WriteTrue() + stream.WriteFalse() + stream.WriteBool(false) + stream.Flush() + should.Nil(stream.Error) + should.Equal("truefalsefalse", buf.String()) +} + +func Test_write_val_bool(t *testing.T) { + should := require.New(t) + buf := &bytes.Buffer{} + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) + stream.WriteVal(true) + should.Equal(stream.Buffered(), 4) + stream.Flush() + should.Equal(stream.Buffered(), 0) + should.Nil(stream.Error) + should.Equal("true", buf.String()) +} diff --git a/vendor/github.com/json-iterator/go/misc_tests/jsoniter_float_test.go b/vendor/github.com/json-iterator/go/misc_tests/jsoniter_float_test.go new file mode 100644 index 000000000..de7bc965e --- /dev/null +++ b/vendor/github.com/json-iterator/go/misc_tests/jsoniter_float_test.go @@ -0,0 +1,95 @@ +package misc_tests + +import ( + "encoding/json" + "testing" + + "github.com/json-iterator/go" + "github.com/stretchr/testify/require" +) + +func Test_read_big_float(t *testing.T) { + should := require.New(t) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `12.3`) + val := iter.ReadBigFloat() + val64, _ := val.Float64() + should.Equal(12.3, val64) +} + +func Test_read_big_int(t *testing.T) { + should := require.New(t) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `92233720368547758079223372036854775807`) + val := iter.ReadBigInt() + should.NotNil(val) + should.Equal(`92233720368547758079223372036854775807`, val.String()) +} + +func Test_read_float_as_interface(t *testing.T) { + should := require.New(t) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `12.3`) + should.Equal(float64(12.3), iter.Read()) +} + +func Test_wrap_float(t *testing.T) { + should := require.New(t) + str, err := jsoniter.MarshalToString(jsoniter.WrapFloat64(12.3)) + should.Nil(err) + should.Equal("12.3", str) +} + +func Test_read_float64_cursor(t *testing.T) { + should := require.New(t) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, "[1.23456789\n,2,3]") + should.True(iter.ReadArray()) + should.Equal(1.23456789, iter.Read()) + should.True(iter.ReadArray()) + should.Equal(float64(2), iter.Read()) +} + +func Test_read_float_scientific(t *testing.T) { + should := require.New(t) + var obj interface{} + should.NoError(jsoniter.UnmarshalFromString(`1e1`, &obj)) + should.Equal(float64(10), obj) + should.NoError(json.Unmarshal([]byte(`1e1`), &obj)) + should.Equal(float64(10), obj) + should.NoError(jsoniter.UnmarshalFromString(`1.0e1`, &obj)) + should.Equal(float64(10), obj) + should.NoError(json.Unmarshal([]byte(`1.0e1`), &obj)) + should.Equal(float64(10), obj) +} + +func Test_lossy_float_marshal(t *testing.T) { + should := require.New(t) + api := jsoniter.Config{MarshalFloatWith6Digits: true}.Froze() + output, err := api.MarshalToString(float64(0.1234567)) + should.Nil(err) + should.Equal("0.123457", output) + output, err = api.MarshalToString(float32(0.1234567)) + should.Nil(err) + should.Equal("0.123457", output) +} + +func Test_read_number(t *testing.T) { + should := require.New(t) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `92233720368547758079223372036854775807`) + val := iter.ReadNumber() + should.Equal(`92233720368547758079223372036854775807`, string(val)) +} + +func Benchmark_jsoniter_float(b *testing.B) { + b.ReportAllocs() + input := []byte(`1.1123,`) + iter := jsoniter.NewIterator(jsoniter.ConfigDefault) + for n := 0; n < b.N; n++ { + iter.ResetBytes(input) + iter.ReadFloat64() + } +} + +func Benchmark_json_float(b *testing.B) { + for n := 0; n < b.N; n++ { + result := float64(0) + json.Unmarshal([]byte(`1.1`), &result) + } +} diff --git a/vendor/github.com/json-iterator/go/misc_tests/jsoniter_int_test.go b/vendor/github.com/json-iterator/go/misc_tests/jsoniter_int_test.go new file mode 100644 index 000000000..a730f6986 --- /dev/null +++ b/vendor/github.com/json-iterator/go/misc_tests/jsoniter_int_test.go @@ -0,0 +1,101 @@ +// +build go1.8 + +package misc_tests + +import ( + "bytes" + "encoding/json" + "io/ioutil" + "strconv" + "testing" + + "github.com/json-iterator/go" + "github.com/stretchr/testify/require" +) + +func Test_read_uint64_invalid(t *testing.T) { + should := require.New(t) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, ",") + iter.ReadUint64() + should.NotNil(iter.Error) +} + +func Test_read_int32_array(t *testing.T) { + should := require.New(t) + input := `[123,456,789]` + val := make([]int32, 0) + jsoniter.UnmarshalFromString(input, &val) + should.Equal(3, len(val)) +} + +func Test_read_int64_array(t *testing.T) { + should := require.New(t) + input := `[123,456,789]` + val := make([]int64, 0) + jsoniter.UnmarshalFromString(input, &val) + should.Equal(3, len(val)) +} + +func Test_wrap_int(t *testing.T) { + should := require.New(t) + str, err := jsoniter.MarshalToString(jsoniter.WrapInt64(100)) + should.Nil(err) + should.Equal("100", str) +} + +func Test_write_val_int(t *testing.T) { + should := require.New(t) + buf := &bytes.Buffer{} + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) + stream.WriteVal(1001) + stream.Flush() + should.Nil(stream.Error) + should.Equal("1001", buf.String()) +} + +func Test_write_val_int_ptr(t *testing.T) { + should := require.New(t) + buf := &bytes.Buffer{} + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) + val := 1001 + stream.WriteVal(&val) + stream.Flush() + should.Nil(stream.Error) + should.Equal("1001", buf.String()) +} + +func Test_float_as_int(t *testing.T) { + should := require.New(t) + var i int + should.NotNil(jsoniter.Unmarshal([]byte(`1.1`), &i)) +} + +func Benchmark_jsoniter_encode_int(b *testing.B) { + stream := jsoniter.NewStream(jsoniter.ConfigDefault, ioutil.Discard, 64) + for n := 0; n < b.N; n++ { + stream.Reset(nil) + stream.WriteUint64(0xffffffff) + } +} + +func Benchmark_itoa(b *testing.B) { + for n := 0; n < b.N; n++ { + strconv.FormatInt(0xffffffff, 10) + } +} + +func Benchmark_jsoniter_int(b *testing.B) { + iter := jsoniter.NewIterator(jsoniter.ConfigDefault) + input := []byte(`100`) + for n := 0; n < b.N; n++ { + iter.ResetBytes(input) + iter.ReadInt64() + } +} + +func Benchmark_json_int(b *testing.B) { + for n := 0; n < b.N; n++ { + result := int64(0) + json.Unmarshal([]byte(`-100`), &result) + } +} diff --git a/vendor/github.com/json-iterator/go/misc_tests/jsoniter_interface_test.go b/vendor/github.com/json-iterator/go/misc_tests/jsoniter_interface_test.go new file mode 100644 index 000000000..38af1e5c8 --- /dev/null +++ b/vendor/github.com/json-iterator/go/misc_tests/jsoniter_interface_test.go @@ -0,0 +1,178 @@ +package misc_tests + +import ( + "encoding/json" + "github.com/json-iterator/go" + "github.com/stretchr/testify/require" + "io" + "testing" +) + +func Test_nil_non_empty_interface(t *testing.T) { + type TestObject struct { + Field []io.Closer + } + should := require.New(t) + obj := TestObject{} + b := []byte(`{"Field":["AAA"]}`) + should.NotNil(json.Unmarshal(b, &obj)) + should.NotNil(jsoniter.Unmarshal(b, &obj)) +} + +func Test_nil_out_null_interface(t *testing.T) { + type TestData struct { + Field interface{} `json:"field"` + } + should := require.New(t) + + var boolVar bool + obj := TestData{ + Field: &boolVar, + } + + data1 := []byte(`{"field": true}`) + + err := jsoniter.Unmarshal(data1, &obj) + should.NoError(err) + should.Equal(true, *(obj.Field.(*bool))) + + data2 := []byte(`{"field": null}`) + + err = jsoniter.Unmarshal(data2, &obj) + should.NoError(err) + should.Nil(obj.Field) + + // Checking stdlib behavior matches. + obj2 := TestData{ + Field: &boolVar, + } + + err = json.Unmarshal(data1, &obj2) + should.NoError(err) + should.Equal(true, *(obj2.Field.(*bool))) + + err = json.Unmarshal(data2, &obj2) + should.NoError(err) + should.Equal(nil, obj2.Field) +} + +func Test_overwrite_interface_ptr_value_with_nil(t *testing.T) { + type Wrapper struct { + Payload interface{} `json:"payload,omitempty"` + } + type Payload struct { + Value int `json:"val,omitempty"` + } + + should := require.New(t) + + payload := &Payload{} + wrapper := &Wrapper{ + Payload: &payload, + } + + err := json.Unmarshal([]byte(`{"payload": {"val": 42}}`), &wrapper) + should.NoError(err) + should.Equal(&payload, wrapper.Payload) + should.Equal(42, (*(wrapper.Payload.(**Payload))).Value) + + err = json.Unmarshal([]byte(`{"payload": null}`), &wrapper) + should.NoError(err) + should.Equal(&payload, wrapper.Payload) + should.Equal((*Payload)(nil), payload) + + payload = &Payload{} + wrapper = &Wrapper{ + Payload: &payload, + } + + err = jsoniter.Unmarshal([]byte(`{"payload": {"val": 42}}`), &wrapper) + should.Equal(nil, err) + should.Equal(&payload, wrapper.Payload) + should.Equal(42, (*(wrapper.Payload.(**Payload))).Value) + + err = jsoniter.Unmarshal([]byte(`{"payload": null}`), &wrapper) + should.NoError(err) + should.Equal(&payload, wrapper.Payload) + should.Equal((*Payload)(nil), payload) +} + +func Test_overwrite_interface_value_with_nil(t *testing.T) { + type Wrapper struct { + Payload interface{} `json:"payload,omitempty"` + } + type Payload struct { + Value int `json:"val,omitempty"` + } + + should := require.New(t) + + payload := &Payload{} + wrapper := &Wrapper{ + Payload: payload, + } + + err := json.Unmarshal([]byte(`{"payload": {"val": 42}}`), &wrapper) + should.NoError(err) + should.Equal(42, (*(wrapper.Payload.(*Payload))).Value) + + err = json.Unmarshal([]byte(`{"payload": null}`), &wrapper) + should.NoError(err) + should.Equal(nil, wrapper.Payload) + should.Equal(42, payload.Value) + + payload = &Payload{} + wrapper = &Wrapper{ + Payload: payload, + } + + err = jsoniter.Unmarshal([]byte(`{"payload": {"val": 42}}`), &wrapper) + should.Equal(nil, err) + should.Equal(42, (*(wrapper.Payload.(*Payload))).Value) + + err = jsoniter.Unmarshal([]byte(`{"payload": null}`), &wrapper) + should.Equal(nil, err) + should.Equal(nil, wrapper.Payload) + should.Equal(42, payload.Value) +} + +func Test_unmarshal_into_nil(t *testing.T) { + type Payload struct { + Value int `json:"val,omitempty"` + } + type Wrapper struct { + Payload interface{} `json:"payload,omitempty"` + } + + should := require.New(t) + + var payload *Payload + wrapper := &Wrapper{ + Payload: payload, + } + + err := json.Unmarshal([]byte(`{"payload": {"val": 42}}`), &wrapper) + should.NoError(err) + should.NotNil(wrapper.Payload) + should.Nil(payload) + + err = json.Unmarshal([]byte(`{"payload": null}`), &wrapper) + should.NoError(err) + should.Nil(wrapper.Payload) + should.Nil(payload) + + payload = nil + wrapper = &Wrapper{ + Payload: payload, + } + + err = jsoniter.Unmarshal([]byte(`{"payload": {"val": 42}}`), &wrapper) + should.NoError(err) + should.NotNil(wrapper.Payload) + should.Nil(payload) + + err = jsoniter.Unmarshal([]byte(`{"payload": null}`), &wrapper) + should.NoError(err) + should.Nil(wrapper.Payload) + should.Nil(payload) +} diff --git a/vendor/github.com/json-iterator/go/jsoniter_iterator_test.go b/vendor/github.com/json-iterator/go/misc_tests/jsoniter_iterator_test.go similarity index 81% rename from vendor/github.com/json-iterator/go/jsoniter_iterator_test.go rename to vendor/github.com/json-iterator/go/misc_tests/jsoniter_iterator_test.go index 951574d8d..d75d01a51 100644 --- a/vendor/github.com/json-iterator/go/jsoniter_iterator_test.go +++ b/vendor/github.com/json-iterator/go/misc_tests/jsoniter_iterator_test.go @@ -1,4 +1,4 @@ -package jsoniter +package misc_tests import ( "bytes" @@ -7,13 +7,14 @@ import ( "strconv" "testing" + "github.com/json-iterator/go" "github.com/stretchr/testify/require" ) func Test_bad_case(t *testing.T) { // field := *(*string)(unsafe.Pointer(&str)) // caused this issue - iter := Parse(ConfigDefault, bytes.NewBufferString(`{"Info":{"InfoHash":"4lzhP/fwlVLRgalC31YbfBSiqwo=","InfoHashstr":"E25CE13FF7F09552D181A942DF561B7C14A2AB0A","AnnounceList":["http://tracker.nwps.ws:6969/announce","http://tracker.nwps.ws:6969/announce","http://tracker.winglai.com/announce","http://fr33dom.h33t.com:3310/announce","http://exodus.desync.com:6969/announce","http://torrent.gresille.org/announce","http://tracker.trackerfix.com/announce","udp://tracker.btzoo.eu:80/announce","http://tracker.windsormetalbattery.com/announce","udp://10.rarbg.me:80/announce","udp://ipv4.tracker.harry.lu:80/announce","udp://tracker.ilibr.org:6969/announce","udp://tracker.zond.org:80/announce","http://torrent-tracker.ru/announce.php","http://bigfoot1942.sektori.org:6969/announce","http://tracker.best-torrents.net:6969/announce","http://announce.torrentsmd.com:6969/announce","udp://tracker.token.ro:80/announce","udp://tracker.coppersurfer.tk:80","http://tracker.thepiratebay.org/announce","udp://9.rarbg.com:2710/announce","udp://open.demonii.com:1337/announce","udp://tracker.ccc.de:80/announce","udp://tracker.istole.it:80/announce","udp://tracker.publicbt.com:80/announce","udp://tracker.openbittorrent.com:80/announce","udp://tracker.istole.it:80/announce","http://tracker.istole.it/announce","udp://tracker.publicbt.com:80/announce","http://tracker.publicbt.com/announce","udp://open.demonii.com:1337/announce"],"Length":2434793890,"PieceSize":524288,"PieceNum":4645},"InfoHashstr":"E25CE13FF7F09552D181A942DF561B7C14A2AB0A","SectionNum":32,"PieceNum":4645,"PieceSize":16384,"Finished":false,"SparseSize":104857600,"Bit":[{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="}]}`), 4096) + iter := jsoniter.Parse(jsoniter.ConfigDefault, bytes.NewBufferString(`{"Info":{"InfoHash":"4lzhP/fwlVLRgalC31YbfBSiqwo=","InfoHashstr":"E25CE13FF7F09552D181A942DF561B7C14A2AB0A","AnnounceList":["http://tracker.nwps.ws:6969/announce","http://tracker.nwps.ws:6969/announce","http://tracker.winglai.com/announce","http://fr33dom.h33t.com:3310/announce","http://exodus.desync.com:6969/announce","http://torrent.gresille.org/announce","http://tracker.trackerfix.com/announce","udp://tracker.btzoo.eu:80/announce","http://tracker.windsormetalbattery.com/announce","udp://10.rarbg.me:80/announce","udp://ipv4.tracker.harry.lu:80/announce","udp://tracker.ilibr.org:6969/announce","udp://tracker.zond.org:80/announce","http://torrent-tracker.ru/announce.php","http://bigfoot1942.sektori.org:6969/announce","http://tracker.best-torrents.net:6969/announce","http://announce.torrentsmd.com:6969/announce","udp://tracker.token.ro:80/announce","udp://tracker.coppersurfer.tk:80","http://tracker.thepiratebay.org/announce","udp://9.rarbg.com:2710/announce","udp://open.demonii.com:1337/announce","udp://tracker.ccc.de:80/announce","udp://tracker.istole.it:80/announce","udp://tracker.publicbt.com:80/announce","udp://tracker.openbittorrent.com:80/announce","udp://tracker.istole.it:80/announce","http://tracker.istole.it/announce","udp://tracker.publicbt.com:80/announce","http://tracker.publicbt.com/announce","udp://open.demonii.com:1337/announce"],"Length":2434793890,"PieceSize":524288,"PieceNum":4645},"InfoHashstr":"E25CE13FF7F09552D181A942DF561B7C14A2AB0A","SectionNum":32,"PieceNum":4645,"PieceSize":16384,"Finished":false,"SparseSize":104857600,"Bit":[{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="}]}`), 4096) count := 0 for field := iter.ReadObject(); field != ""; field = iter.ReadObject() { if field == "Bit" { @@ -45,7 +46,7 @@ func Test_iterator_use_number(t *testing.T) { for _, input := range inputs { t.Run(fmt.Sprintf("%v", input), func(t *testing.T) { should := require.New(t) - iter := ParseString(Config{UseNumber: true}.Froze(), input) + iter := jsoniter.ParseString(jsoniter.Config{UseNumber: true}.Froze(), input) expected := json.Number(input) should.Equal(expected, iter.Read()) }) @@ -57,7 +58,7 @@ func Test_iterator_without_number(t *testing.T) { for _, input := range inputs { t.Run(fmt.Sprintf("%v", input), func(t *testing.T) { should := require.New(t) - iter := ParseString(ConfigDefault, input) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, input) expected, err := strconv.ParseInt(input, 10, 32) should.Nil(err) should.Equal(float64(expected), iter.Read()) diff --git a/vendor/github.com/json-iterator/go/misc_tests/jsoniter_map_test.go b/vendor/github.com/json-iterator/go/misc_tests/jsoniter_map_test.go new file mode 100644 index 000000000..3f594b29c --- /dev/null +++ b/vendor/github.com/json-iterator/go/misc_tests/jsoniter_map_test.go @@ -0,0 +1,33 @@ +package misc_tests + +import ( + "encoding/json" + "math/big" + "testing" + + "github.com/json-iterator/go" + "github.com/stretchr/testify/require" + "strings" +) + +func Test_decode_TextMarshaler_key_map(t *testing.T) { + should := require.New(t) + var val map[*big.Float]string + should.Nil(jsoniter.UnmarshalFromString(`{"1":"2"}`, &val)) + str, err := jsoniter.MarshalToString(val) + should.Nil(err) + should.Equal(`{"1":"2"}`, str) +} + +func Test_read_map_with_reader(t *testing.T) { + should := require.New(t) + input := `{"branch":"beta","change_log":"add the rows{10}","channel":"fros","create_time":"2017-06-13 16:39:08","firmware_list":"","md5":"80dee2bf7305bcf179582088e29fd7b9","note":{"CoreServices":{"md5":"d26975c0a8c7369f70ed699f2855cc2e","package_name":"CoreServices","version_code":"76","version_name":"1.0.76"},"FrDaemon":{"md5":"6b1f0626673200bc2157422cd2103f5d","package_name":"FrDaemon","version_code":"390","version_name":"1.0.390"},"FrGallery":{"md5":"90d767f0f31bcd3c1d27281ec979ba65","package_name":"FrGallery","version_code":"349","version_name":"1.0.349"},"FrLocal":{"md5":"f15a215b2c070a80a01f07bde4f219eb","package_name":"FrLocal","version_code":"791","version_name":"1.0.791"}},"pack_region_urls":{"CN":"https://s3.cn-north-1.amazonaws.com.cn/xxx-os/ttt_xxx_android_1.5.3.344.393.zip","default":"http://192.168.8.78/ttt_xxx_android_1.5.3.344.393.zip","local":"http://192.168.8.78/ttt_xxx_android_1.5.3.344.393.zip"},"pack_version":"1.5.3.344.393","pack_version_code":393,"region":"all","release_flag":0,"revision":62,"size":38966875,"status":3}` + reader := strings.NewReader(input) + decoder := jsoniter.ConfigCompatibleWithStandardLibrary.NewDecoder(reader) + m1 := map[string]interface{}{} + should.Nil(decoder.Decode(&m1)) + m2 := map[string]interface{}{} + should.Nil(json.Unmarshal([]byte(input), &m2)) + should.Equal(m2, m1) + should.Equal("1.0.76", m1["note"].(map[string]interface{})["CoreServices"].(map[string]interface{})["version_name"]) +} diff --git a/vendor/github.com/json-iterator/go/jsoniter_nested_test.go b/vendor/github.com/json-iterator/go/misc_tests/jsoniter_nested_test.go similarity index 83% rename from vendor/github.com/json-iterator/go/jsoniter_nested_test.go rename to vendor/github.com/json-iterator/go/misc_tests/jsoniter_nested_test.go index 29f8cee84..1e4994a13 100644 --- a/vendor/github.com/json-iterator/go/jsoniter_nested_test.go +++ b/vendor/github.com/json-iterator/go/misc_tests/jsoniter_nested_test.go @@ -1,7 +1,8 @@ -package jsoniter +package misc_tests import ( "encoding/json" + "github.com/json-iterator/go" "reflect" "testing" ) @@ -15,7 +16,7 @@ type Level2 struct { } func Test_nested(t *testing.T) { - iter := ParseString(ConfigDefault, `{"hello": [{"world": "value1"}, {"world": "value2"}]}`) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `{"hello": [{"world": "value1"}, {"world": "value2"}]}`) l1 := Level1{} for l1Field := iter.ReadObject(); l1Field != ""; l1Field = iter.ReadObject() { switch l1Field { @@ -50,7 +51,7 @@ func Test_nested(t *testing.T) { func Benchmark_jsoniter_nested(b *testing.B) { for n := 0; n < b.N; n++ { - iter := ParseString(ConfigDefault, `{"hello": [{"world": "value1"}, {"world": "value2"}]}`) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `{"hello": [{"world": "value1"}, {"world": "value2"}]}`) l1 := Level1{} for l1Field := iter.ReadObject(); l1Field != ""; l1Field = iter.ReadObject() { switch l1Field { @@ -63,7 +64,7 @@ func Benchmark_jsoniter_nested(b *testing.B) { } } -func readLevel1Hello(iter *Iterator) []Level2 { +func readLevel1Hello(iter *jsoniter.Iterator) []Level2 { l2Array := make([]Level2, 0, 2) for iter.ReadArray() { l2 := Level2{} diff --git a/vendor/github.com/json-iterator/go/misc_tests/jsoniter_null_test.go b/vendor/github.com/json-iterator/go/misc_tests/jsoniter_null_test.go new file mode 100644 index 000000000..4fd2a2c13 --- /dev/null +++ b/vendor/github.com/json-iterator/go/misc_tests/jsoniter_null_test.go @@ -0,0 +1,81 @@ +package misc_tests + +import ( + "bytes" + "io" + "testing" + + "github.com/json-iterator/go" + "github.com/stretchr/testify/require" +) + +func Test_read_null(t *testing.T) { + should := require.New(t) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `null`) + should.True(iter.ReadNil()) + iter = jsoniter.ParseString(jsoniter.ConfigDefault, `null`) + should.Nil(iter.Read()) + iter = jsoniter.ParseString(jsoniter.ConfigDefault, `navy`) + iter.Read() + should.True(iter.Error != nil && iter.Error != io.EOF) + iter = jsoniter.ParseString(jsoniter.ConfigDefault, `navy`) + iter.ReadNil() + should.True(iter.Error != nil && iter.Error != io.EOF) +} + +func Test_write_null(t *testing.T) { + should := require.New(t) + buf := &bytes.Buffer{} + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) + stream.WriteNil() + stream.Flush() + should.Nil(stream.Error) + should.Equal("null", buf.String()) +} + +func Test_decode_null_object_field(t *testing.T) { + should := require.New(t) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `[null,"a"]`) + iter.ReadArray() + if iter.ReadObject() != "" { + t.FailNow() + } + iter.ReadArray() + if iter.ReadString() != "a" { + t.FailNow() + } + type TestObject struct { + Field string + } + objs := []TestObject{} + should.Nil(jsoniter.UnmarshalFromString("[null]", &objs)) + should.Len(objs, 1) +} + +func Test_decode_null_array_element(t *testing.T) { + should := require.New(t) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `[null,"a"]`) + should.True(iter.ReadArray()) + should.True(iter.ReadNil()) + should.True(iter.ReadArray()) + should.Equal("a", iter.ReadString()) +} + +func Test_decode_null_string(t *testing.T) { + should := require.New(t) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `[null,"a"]`) + should.True(iter.ReadArray()) + should.Equal("", iter.ReadString()) + should.True(iter.ReadArray()) + should.Equal("a", iter.ReadString()) +} + +func Test_decode_null_skip(t *testing.T) { + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `[null,"a"]`) + iter.ReadArray() + iter.Skip() + iter.ReadArray() + if iter.ReadString() != "a" { + t.FailNow() + } +} diff --git a/vendor/github.com/json-iterator/go/misc_tests/jsoniter_object_test.go b/vendor/github.com/json-iterator/go/misc_tests/jsoniter_object_test.go new file mode 100644 index 000000000..0ffc207a7 --- /dev/null +++ b/vendor/github.com/json-iterator/go/misc_tests/jsoniter_object_test.go @@ -0,0 +1,132 @@ +package misc_tests + +import ( + "bytes" + "testing" + + "github.com/json-iterator/go" + "github.com/stretchr/testify/require" + "strings" + "time" +) + +func Test_empty_object(t *testing.T) { + should := require.New(t) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `{}`) + field := iter.ReadObject() + should.Equal("", field) + iter = jsoniter.ParseString(jsoniter.ConfigDefault, `{}`) + iter.ReadObjectCB(func(iter *jsoniter.Iterator, field string) bool { + should.FailNow("should not call") + return true + }) +} + +func Test_one_field(t *testing.T) { + should := require.New(t) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `{"a": "stream"}`) + field := iter.ReadObject() + should.Equal("a", field) + value := iter.ReadString() + should.Equal("stream", value) + field = iter.ReadObject() + should.Equal("", field) + iter = jsoniter.ParseString(jsoniter.ConfigDefault, `{"a": "stream"}`) + should.True(iter.ReadObjectCB(func(iter *jsoniter.Iterator, field string) bool { + should.Equal("a", field) + iter.Skip() + return true + })) + +} + +func Test_two_field(t *testing.T) { + should := require.New(t) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `{ "a": "stream" , "c": "d" }`) + field := iter.ReadObject() + should.Equal("a", field) + value := iter.ReadString() + should.Equal("stream", value) + field = iter.ReadObject() + should.Equal("c", field) + value = iter.ReadString() + should.Equal("d", value) + field = iter.ReadObject() + should.Equal("", field) + iter = jsoniter.ParseString(jsoniter.ConfigDefault, `{"field1": "1", "field2": 2}`) + for field := iter.ReadObject(); field != ""; field = iter.ReadObject() { + switch field { + case "field1": + iter.ReadString() + case "field2": + iter.ReadInt64() + default: + iter.ReportError("bind object", "unexpected field") + } + } +} + +func Test_write_object(t *testing.T) { + should := require.New(t) + buf := &bytes.Buffer{} + stream := jsoniter.NewStream(jsoniter.Config{IndentionStep: 2}.Froze(), buf, 4096) + stream.WriteObjectStart() + stream.WriteObjectField("hello") + stream.WriteInt(1) + stream.WriteMore() + stream.WriteObjectField("world") + stream.WriteInt(2) + stream.WriteObjectEnd() + stream.Flush() + should.Nil(stream.Error) + should.Equal("{\n \"hello\": 1,\n \"world\": 2\n}", buf.String()) +} + +func Test_reader_and_load_more(t *testing.T) { + should := require.New(t) + type TestObject struct { + CreatedAt time.Time + } + reader := strings.NewReader(` +{ + "agency": null, + "candidateId": 0, + "candidate": "Blah Blah", + "bookingId": 0, + "shiftId": 1, + "shiftTypeId": 0, + "shift": "Standard", + "bonus": 0, + "bonusNI": 0, + "days": [], + "totalHours": 27, + "expenses": [], + "weekEndingDateSystem": "2016-10-09", + "weekEndingDateClient": "2016-10-09", + "submittedAt": null, + "submittedById": null, + "approvedAt": "2016-10-10T18:38:04Z", + "approvedById": 0, + "authorisedAt": "2016-10-10T18:38:04Z", + "authorisedById": 0, + "invoicedAt": "2016-10-10T20:00:00Z", + "revokedAt": null, + "revokedById": null, + "revokeReason": null, + "rejectedAt": null, + "rejectedById": null, + "rejectReasonCode": null, + "rejectReason": null, + "createdAt": "2016-10-03T00:00:00Z", + "updatedAt": "2016-11-09T10:26:13Z", + "updatedById": null, + "overrides": [], + "bookingApproverId": null, + "bookingApprover": null, + "status": "approved" +} + `) + decoder := jsoniter.ConfigCompatibleWithStandardLibrary.NewDecoder(reader) + obj := TestObject{} + should.Nil(decoder.Decode(&obj)) +} diff --git a/vendor/github.com/json-iterator/go/misc_tests/jsoniter_raw_message_test.go b/vendor/github.com/json-iterator/go/misc_tests/jsoniter_raw_message_test.go new file mode 100644 index 000000000..9af7cd73b --- /dev/null +++ b/vendor/github.com/json-iterator/go/misc_tests/jsoniter_raw_message_test.go @@ -0,0 +1,68 @@ +package misc_tests + +import ( + "encoding/json" + "github.com/json-iterator/go" + "github.com/stretchr/testify/require" + "strings" + "testing" +) + +func Test_jsoniter_RawMessage(t *testing.T) { + should := require.New(t) + var data jsoniter.RawMessage + should.Nil(jsoniter.Unmarshal([]byte(`[1,2,3]`), &data)) + should.Equal(`[1,2,3]`, string(data)) + str, err := jsoniter.MarshalToString(data) + should.Nil(err) + should.Equal(`[1,2,3]`, str) +} + +func Test_encode_map_of_jsoniter_raw_message(t *testing.T) { + should := require.New(t) + type RawMap map[string]*jsoniter.RawMessage + value := jsoniter.RawMessage("[]") + rawMap := RawMap{"hello": &value} + output, err := jsoniter.MarshalToString(rawMap) + should.Nil(err) + should.Equal(`{"hello":[]}`, output) +} + +func Test_marshal_invalid_json_raw_message(t *testing.T) { + type A struct { + Raw json.RawMessage `json:"raw"` + } + message := []byte(`{}`) + + a := A{} + should := require.New(t) + should.Nil(jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(message, &a)) + aout, aouterr := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(&a) + should.Equal(`{"raw":null}`, string(aout)) + should.Nil(aouterr) +} + +func Test_raw_message_memory_not_copied_issue(t *testing.T) { + jsonStream := `{"name":"xxxxx","bundle_id":"com.zonst.majiang","app_platform":"ios","app_category":"100103", "budget_day":1000,"bidding_min":1,"bidding_max":2,"bidding_type":"CPM", "freq":{"open":true,"type":"day","num":100},"speed":1, "targeting":{"vendor":{"open":true,"list":["zonst"]}, "geo_code":{"open":true,"list":["156110100"]},"app_category":{"open":true,"list":["100101"]}, "day_parting":{"open":true,"list":["100409","100410"]},"device_type":{"open":true,"list":["ipad"]}, "os_version":{"open":true,"list":[10]},"carrier":{"open":true,"list":["mobile"]}, "network":{"open":true,"list":["4G"]}},"url":{"tracking_imp_url":"http://www.baidu.com", "tracking_clk_url":"http://www.baidu.com","jump_url":"http://www.baidu.com","deep_link_url":"http://www.baidu.com"}}` + type IteratorObject struct { + Name *string `json:"name"` + BundleId *string `json:"bundle_id"` + AppCategory *string `json:"app_category"` + AppPlatform *string `json:"app_platform"` + BudgetDay *float32 `json:"budget_day"` + BiddingMax *float32 `json:"bidding_max"` + BiddingMin *float32 `json:"bidding_min"` + BiddingType *string `json:"bidding_type"` + Freq *jsoniter.RawMessage `json:"freq"` + Targeting *jsoniter.RawMessage `json:"targeting"` + Url *jsoniter.RawMessage `json:"url"` + Speed *int `json:"speed" db:"speed"` + } + + obj := &IteratorObject{} + decoder := jsoniter.NewDecoder(strings.NewReader(jsonStream)) + err := decoder.Decode(obj) + should := require.New(t) + should.Nil(err) + should.Equal(`{"open":true,"type":"day","num":100}`, string(*obj.Freq)) +} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/array/bool/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/array/bool/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/array/bool/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/array/bool/types.go b/vendor/github.com/json-iterator/go/output_tests/array/array/bool/types.go deleted file mode 100644 index 8d2753502..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/array/bool/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4][4]bool diff --git a/vendor/github.com/json-iterator/go/output_tests/array/array/byte/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/array/byte/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/array/byte/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/array/byte/types.go b/vendor/github.com/json-iterator/go/output_tests/array/array/byte/types.go deleted file mode 100644 index fa2a65542..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/array/byte/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4][4]byte diff --git a/vendor/github.com/json-iterator/go/output_tests/array/array/float64/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/array/float64/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/array/float64/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/array/float64/types.go b/vendor/github.com/json-iterator/go/output_tests/array/array/float64/types.go deleted file mode 100644 index 2adbf0eac..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/array/float64/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4][4]float64 diff --git a/vendor/github.com/json-iterator/go/output_tests/array/array/int32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/array/int32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/array/int32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/array/int32/types.go b/vendor/github.com/json-iterator/go/output_tests/array/array/int32/types.go deleted file mode 100644 index 2056d7c32..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/array/int32/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4][4]int32 diff --git a/vendor/github.com/json-iterator/go/output_tests/array/array/ptr_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/array/ptr_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/array/ptr_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/array/ptr_string/types.go b/vendor/github.com/json-iterator/go/output_tests/array/array/ptr_string/types.go deleted file mode 100644 index 80b6f4887..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/array/ptr_string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4][4]*string diff --git a/vendor/github.com/json-iterator/go/output_tests/array/array/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/array/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/array/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/array/string/types.go b/vendor/github.com/json-iterator/go/output_tests/array/array/string/types.go deleted file mode 100644 index 9ff190f14..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/array/string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4][4]string diff --git a/vendor/github.com/json-iterator/go/output_tests/array/array/uint8/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/array/uint8/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/array/uint8/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/array/uint8/types.go b/vendor/github.com/json-iterator/go/output_tests/array/array/uint8/types.go deleted file mode 100644 index 51454ca24..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/array/uint8/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4][4]uint8 diff --git a/vendor/github.com/json-iterator/go/output_tests/array/bool/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/bool/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/bool/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/bool/types.go b/vendor/github.com/json-iterator/go/output_tests/array/bool/types.go deleted file mode 100644 index 799d699b3..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/bool/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]bool diff --git a/vendor/github.com/json-iterator/go/output_tests/array/byte/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/byte/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/byte/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/byte/types.go b/vendor/github.com/json-iterator/go/output_tests/array/byte/types.go deleted file mode 100644 index 5c8d1e2c7..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/byte/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]byte diff --git a/vendor/github.com/json-iterator/go/output_tests/array/float64/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/float64/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/float64/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/float64/types.go b/vendor/github.com/json-iterator/go/output_tests/array/float64/types.go deleted file mode 100644 index d48fbe462..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/float64/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]float64 diff --git a/vendor/github.com/json-iterator/go/output_tests/array/int32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/int32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/int32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/int32/types.go b/vendor/github.com/json-iterator/go/output_tests/array/int32/types.go deleted file mode 100644 index 83c753352..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/int32/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]int32 diff --git a/vendor/github.com/json-iterator/go/output_tests/array/map/int32_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/map/int32_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/map/int32_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/map/int32_string/types.go b/vendor/github.com/json-iterator/go/output_tests/array/map/int32_string/types.go deleted file mode 100644 index 25ec7d4f0..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/map/int32_string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]map[int32]string diff --git a/vendor/github.com/json-iterator/go/output_tests/array/map/string_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/map/string_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/map/string_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/map/string_string/types.go b/vendor/github.com/json-iterator/go/output_tests/array/map/string_string/types.go deleted file mode 100644 index 62554d223..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/map/string_string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]map[string]string diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_bool/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_bool/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_bool/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_bool/types.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_bool/types.go deleted file mode 100644 index cf978b65f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_bool/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]*bool diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_float64/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_float64/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_float64/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_float64/types.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_float64/types.go deleted file mode 100644 index 499d91773..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_float64/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]*float64 diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_int32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_int32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_int32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_int32/types.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_int32/types.go deleted file mode 100644 index 6fc1ba36d..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_int32/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]*int32 diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_map/int32_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_map/int32_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_map/int32_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_map/int32_string/types.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_map/int32_string/types.go deleted file mode 100644 index c0d34450a..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_map/int32_string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]*map[int32]string diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_map/string_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_map/string_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_map/string_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_map/string_string/types.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_map/string_string/types.go deleted file mode 100644 index c9d76b502..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_map/string_string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]*map[string]string diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/bool/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/bool/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/bool/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/bool/types.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/bool/types.go deleted file mode 100644 index 50fe493ce..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/bool/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]*[4]bool diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/byte/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/byte/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/byte/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/byte/types.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/byte/types.go deleted file mode 100644 index f5eea3ae2..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/byte/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]*[4]byte diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/float64/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/float64/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/float64/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/float64/types.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/float64/types.go deleted file mode 100644 index 70e7b64ae..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/float64/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]*[4]float64 diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/int32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/int32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/int32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/int32/types.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/int32/types.go deleted file mode 100644 index 5496acbbe..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/int32/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]*[4]int32 diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/ptr_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/ptr_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/ptr_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/ptr_string/types.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/ptr_string/types.go deleted file mode 100644 index 55693a71f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/ptr_string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]*[4]*string diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/string/types.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/string/types.go deleted file mode 100644 index 4f1cc5ab4..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]*[4]string diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/uint8/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/uint8/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/uint8/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/uint8/types.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/uint8/types.go deleted file mode 100644 index a619570d5..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_slice/uint8/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]*[4]uint8 diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_string/types.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_string/types.go deleted file mode 100644 index 30064179c..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]*string diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_struct_various/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_struct_various/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_struct_various/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_struct_various/types.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_struct_various/types.go deleted file mode 100644 index 5ec347c06..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_struct_various/types.go +++ /dev/null @@ -1,12 +0,0 @@ -package test - -type typeForTest [4]*struct { - String string - Int int32 - Float float64 - Struct struct { - X string - } - Slice [4]string - Map map[string]string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_uint8/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_uint8/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_uint8/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/ptr_uint8/types.go b/vendor/github.com/json-iterator/go/output_tests/array/ptr_uint8/types.go deleted file mode 100644 index 97250b8ea..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/ptr_uint8/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]*uint8 diff --git a/vendor/github.com/json-iterator/go/output_tests/array/slice/bool/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/slice/bool/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/slice/bool/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/slice/bool/types.go b/vendor/github.com/json-iterator/go/output_tests/array/slice/bool/types.go deleted file mode 100644 index 8d2753502..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/slice/bool/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4][4]bool diff --git a/vendor/github.com/json-iterator/go/output_tests/array/slice/byte/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/slice/byte/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/slice/byte/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/slice/byte/types.go b/vendor/github.com/json-iterator/go/output_tests/array/slice/byte/types.go deleted file mode 100644 index fa2a65542..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/slice/byte/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4][4]byte diff --git a/vendor/github.com/json-iterator/go/output_tests/array/slice/float64/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/slice/float64/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/slice/float64/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/slice/float64/types.go b/vendor/github.com/json-iterator/go/output_tests/array/slice/float64/types.go deleted file mode 100644 index 2adbf0eac..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/slice/float64/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4][4]float64 diff --git a/vendor/github.com/json-iterator/go/output_tests/array/slice/int32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/slice/int32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/slice/int32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/slice/int32/types.go b/vendor/github.com/json-iterator/go/output_tests/array/slice/int32/types.go deleted file mode 100644 index 2056d7c32..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/slice/int32/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4][4]int32 diff --git a/vendor/github.com/json-iterator/go/output_tests/array/slice/ptr_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/slice/ptr_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/slice/ptr_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/slice/ptr_string/types.go b/vendor/github.com/json-iterator/go/output_tests/array/slice/ptr_string/types.go deleted file mode 100644 index 80b6f4887..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/slice/ptr_string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4][4]*string diff --git a/vendor/github.com/json-iterator/go/output_tests/array/slice/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/slice/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/slice/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/slice/string/types.go b/vendor/github.com/json-iterator/go/output_tests/array/slice/string/types.go deleted file mode 100644 index 9ff190f14..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/slice/string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4][4]string diff --git a/vendor/github.com/json-iterator/go/output_tests/array/slice/uint8/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/slice/uint8/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/slice/uint8/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/slice/uint8/types.go b/vendor/github.com/json-iterator/go/output_tests/array/slice/uint8/types.go deleted file mode 100644 index 51454ca24..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/slice/uint8/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4][4]uint8 diff --git a/vendor/github.com/json-iterator/go/output_tests/array/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/string/types.go b/vendor/github.com/json-iterator/go/output_tests/array/string/types.go deleted file mode 100644 index 20bf254b0..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]string diff --git a/vendor/github.com/json-iterator/go/output_tests/array/struct_empty/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/struct_empty/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/struct_empty/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/struct_empty/types.go b/vendor/github.com/json-iterator/go/output_tests/array/struct_empty/types.go deleted file mode 100644 index 79dbc2b92..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/struct_empty/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]struct{} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/struct_empty_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/struct_empty_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/struct_empty_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/struct_empty_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/array/struct_empty_alias/types.go deleted file mode 100644 index b72c8cfb2..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/struct_empty_alias/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeA struct{} - -type typeForTest [4]typeA diff --git a/vendor/github.com/json-iterator/go/output_tests/array/struct_ptr_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/struct_ptr_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/struct_ptr_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/struct_ptr_string/types.go b/vendor/github.com/json-iterator/go/output_tests/array/struct_ptr_string/types.go deleted file mode 100644 index fb5f2afc9..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/struct_ptr_string/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeForTest [4]struct { - F *string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/struct_various/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/struct_various/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/struct_various/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/struct_various/types.go b/vendor/github.com/json-iterator/go/output_tests/array/struct_various/types.go deleted file mode 100644 index 69b60c85a..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/struct_various/types.go +++ /dev/null @@ -1,12 +0,0 @@ -package test - -type typeForTest [4]struct { - String string - Int int32 - Float float64 - Struct struct { - X string - } - Slice [4]string - Map map[string]string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/uint8/json_test.go b/vendor/github.com/json-iterator/go/output_tests/array/uint8/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/uint8/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/array/uint8/types.go b/vendor/github.com/json-iterator/go/output_tests/array/uint8/types.go deleted file mode 100644 index 4d8b24ee0..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/array/uint8/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]uint8 diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/bool/json_test.go b/vendor/github.com/json-iterator/go/output_tests/builtins/bool/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/bool/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/bool/types.go b/vendor/github.com/json-iterator/go/output_tests/builtins/bool/types.go deleted file mode 100644 index 84f7317d0..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/bool/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest bool diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/bool_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/builtins/bool_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/bool_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/bool_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/builtins/bool_alias/types.go deleted file mode 100644 index 84f7317d0..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/bool_alias/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest bool diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/byte/json_test.go b/vendor/github.com/json-iterator/go/output_tests/builtins/byte/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/byte/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/byte/types.go b/vendor/github.com/json-iterator/go/output_tests/builtins/byte/types.go deleted file mode 100644 index e5bab2c86..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/byte/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest byte diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/byte_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/builtins/byte_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/byte_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/byte_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/builtins/byte_alias/types.go deleted file mode 100644 index e5bab2c86..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/byte_alias/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest byte diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/float32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/builtins/float32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/float32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/float32/types.go b/vendor/github.com/json-iterator/go/output_tests/builtins/float32/types.go deleted file mode 100644 index fe79a5484..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/float32/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest float32 diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/float32_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/builtins/float32_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/float32_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/float32_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/builtins/float32_alias/types.go deleted file mode 100644 index fe79a5484..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/float32_alias/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest float32 diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/float64/json_test.go b/vendor/github.com/json-iterator/go/output_tests/builtins/float64/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/float64/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/float64/types.go b/vendor/github.com/json-iterator/go/output_tests/builtins/float64/types.go deleted file mode 100644 index f77c954de..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/float64/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest float64 diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/float64_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/builtins/float64_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/float64_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/float64_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/builtins/float64_alias/types.go deleted file mode 100644 index f77c954de..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/float64_alias/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest float64 diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/int16/json_test.go b/vendor/github.com/json-iterator/go/output_tests/builtins/int16/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/int16/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/int16/types.go b/vendor/github.com/json-iterator/go/output_tests/builtins/int16/types.go deleted file mode 100644 index ea072e595..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/int16/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest int16 diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/int16_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/builtins/int16_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/int16_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/int16_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/builtins/int16_alias/types.go deleted file mode 100644 index ea072e595..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/int16_alias/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest int16 diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/int32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/builtins/int32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/int32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/int32/types.go b/vendor/github.com/json-iterator/go/output_tests/builtins/int32/types.go deleted file mode 100644 index ce6bf8dd7..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/int32/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest int32 diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/int32_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/builtins/int32_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/int32_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/int32_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/builtins/int32_alias/types.go deleted file mode 100644 index ce6bf8dd7..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/int32_alias/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest int32 diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/int64/json_test.go b/vendor/github.com/json-iterator/go/output_tests/builtins/int64/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/int64/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/int64/types.go b/vendor/github.com/json-iterator/go/output_tests/builtins/int64/types.go deleted file mode 100644 index 063f5acc8..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/int64/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest int64 diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/int8/json_test.go b/vendor/github.com/json-iterator/go/output_tests/builtins/int8/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/int8/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/int8/types.go b/vendor/github.com/json-iterator/go/output_tests/builtins/int8/types.go deleted file mode 100644 index a9531a7b7..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/int8/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest int8 diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/int8_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/builtins/int8_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/int8_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/int8_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/builtins/int8_alias/types.go deleted file mode 100644 index a9531a7b7..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/int8_alias/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest int8 diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/builtins/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/string/types.go b/vendor/github.com/json-iterator/go/output_tests/builtins/string/types.go deleted file mode 100644 index 03029998d..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest string diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/string_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/builtins/string_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/string_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/string_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/builtins/string_alias/types.go deleted file mode 100644 index 03029998d..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/string_alias/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest string diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/uint16/json_test.go b/vendor/github.com/json-iterator/go/output_tests/builtins/uint16/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/uint16/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/uint16/types.go b/vendor/github.com/json-iterator/go/output_tests/builtins/uint16/types.go deleted file mode 100644 index 0da15dc48..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/uint16/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest uint16 diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/uint16_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/builtins/uint16_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/uint16_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/uint16_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/builtins/uint16_alias/types.go deleted file mode 100644 index 0da15dc48..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/uint16_alias/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest uint16 diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/uint32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/builtins/uint32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/uint32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/uint32/types.go b/vendor/github.com/json-iterator/go/output_tests/builtins/uint32/types.go deleted file mode 100644 index 8bd36ddb6..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/uint32/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest uint32 diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/uint32_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/builtins/uint32_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/uint32_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/uint32_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/builtins/uint32_alias/types.go deleted file mode 100644 index 8bd36ddb6..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/uint32_alias/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest uint32 diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/uint8/json_test.go b/vendor/github.com/json-iterator/go/output_tests/builtins/uint8/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/uint8/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/uint8/types.go b/vendor/github.com/json-iterator/go/output_tests/builtins/uint8/types.go deleted file mode 100644 index bff2ef197..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/uint8/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest uint8 diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/uint8_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/builtins/uint8_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/uint8_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/uint8_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/builtins/uint8_alias/types.go deleted file mode 100644 index bff2ef197..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/uint8_alias/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest uint8 diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/uintptr/json_test.go b/vendor/github.com/json-iterator/go/output_tests/builtins/uintptr/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/uintptr/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/builtins/uintptr/types.go b/vendor/github.com/json-iterator/go/output_tests/builtins/uintptr/types.go deleted file mode 100644 index a9d99bda3..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/builtins/uintptr/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest uintptr diff --git a/vendor/github.com/json-iterator/go/output_tests/caseless_unmarshal/caseless_test.go b/vendor/github.com/json-iterator/go/output_tests/caseless_unmarshal/caseless_test.go deleted file mode 100644 index 9343b68c4..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/caseless_unmarshal/caseless_test.go +++ /dev/null @@ -1,84 +0,0 @@ -// NOTE: This test is different than most of the other JSON roundtrip tests. -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_CaselessUnmarshal(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest1 - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest2 - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest2 - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} diff --git a/vendor/github.com/json-iterator/go/output_tests/caseless_unmarshal/types.go b/vendor/github.com/json-iterator/go/output_tests/caseless_unmarshal/types.go deleted file mode 100644 index beb817e18..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/caseless_unmarshal/types.go +++ /dev/null @@ -1,9 +0,0 @@ -package test - -type typeForTest1 struct { - Field string -} - -type typeForTest2 struct { - FIELD string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/json_marshal/string_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/json_marshal/string_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/json_marshal/string_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/json_marshal/string_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/json_marshal/string_alias/types.go deleted file mode 100644 index 1f0452992..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/json_marshal/string_alias/types.go +++ /dev/null @@ -1,50 +0,0 @@ -package test - -import ( - "bytes" - "encoding/base64" - "encoding/json" - "strings" -) - -type marshalerForTest string - -func encode(str string) string { - buf := bytes.Buffer{} - b64 := base64.NewEncoder(base64.StdEncoding, &buf) - if _, err := b64.Write([]byte(str)); err != nil { - panic(err) - } - if err := b64.Close(); err != nil { - panic(err) - } - return buf.String() -} - -func decode(str string) string { - if len(str) == 0 { - return "" - } - b64 := base64.NewDecoder(base64.StdEncoding, strings.NewReader(str)) - bs := make([]byte, len(str)) - if n, err := b64.Read(bs); err != nil { - panic(err) - } else { - bs = bs[:n] - } - return string(bs) -} - -func (m marshalerForTest) MarshalJSON() ([]byte, error) { - return []byte(`"MANUAL__` + encode(string(m)) + `"`), nil -} - -func (m *marshalerForTest) UnmarshalJSON(text []byte) error { - *m = marshalerForTest(decode(strings.TrimPrefix(strings.Trim(string(text), `"`), "MANUAL__"))) - return nil -} - -var _ json.Marshaler = *new(marshalerForTest) -var _ json.Unmarshaler = new(marshalerForTest) - -type typeForTest marshalerForTest diff --git a/vendor/github.com/json-iterator/go/output_tests/json_marshal/struct/json_test.go b/vendor/github.com/json-iterator/go/output_tests/json_marshal/struct/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/json_marshal/struct/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/json_marshal/struct/types.go b/vendor/github.com/json-iterator/go/output_tests/json_marshal/struct/types.go deleted file mode 100644 index 8480c2abf..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/json_marshal/struct/types.go +++ /dev/null @@ -1,52 +0,0 @@ -package test - -import ( - "bytes" - "encoding/base64" - "encoding/json" - "strings" -) - -type marshalerForTest struct { - X string -} - -func encode(str string) string { - buf := bytes.Buffer{} - b64 := base64.NewEncoder(base64.StdEncoding, &buf) - if _, err := b64.Write([]byte(str)); err != nil { - panic(err) - } - if err := b64.Close(); err != nil { - panic(err) - } - return buf.String() -} - -func decode(str string) string { - if len(str) == 0 { - return "" - } - b64 := base64.NewDecoder(base64.StdEncoding, strings.NewReader(str)) - bs := make([]byte, len(str)) - if n, err := b64.Read(bs); err != nil { - panic(err) - } else { - bs = bs[:n] - } - return string(bs) -} - -func (m marshalerForTest) MarshalJSON() ([]byte, error) { - return []byte(`"MANUAL__` + encode(m.X) + `"`), nil -} - -func (m *marshalerForTest) UnmarshalJSON(text []byte) error { - m.X = decode(strings.TrimPrefix(strings.Trim(string(text), `"`), "MANUAL__")) - return nil -} - -var _ json.Marshaler = marshalerForTest{} -var _ json.Unmarshaler = &marshalerForTest{} - -type typeForTest marshalerForTest diff --git a/vendor/github.com/json-iterator/go/output_tests/json_marshal/struct_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/json_marshal/struct_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/json_marshal/struct_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/json_marshal/struct_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/json_marshal/struct_alias/types.go deleted file mode 100644 index 993b63f85..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/json_marshal/struct_alias/types.go +++ /dev/null @@ -1,54 +0,0 @@ -package test - -import ( - "bytes" - "encoding/base64" - "encoding/json" - "strings" -) - -type marshalerForTest struct { - X string -} - -func encode(str string) string { - buf := bytes.Buffer{} - b64 := base64.NewEncoder(base64.StdEncoding, &buf) - if _, err := b64.Write([]byte(str)); err != nil { - panic(err) - } - if err := b64.Close(); err != nil { - panic(err) - } - return buf.String() -} - -func decode(str string) string { - if len(str) == 0 { - return "" - } - b64 := base64.NewDecoder(base64.StdEncoding, strings.NewReader(str)) - bs := make([]byte, len(str)) - if n, err := b64.Read(bs); err != nil { - panic(err) - } else { - bs = bs[:n] - } - return string(bs) -} - -func (m marshalerForTest) MarshalJSON() ([]byte, error) { - return []byte(`"MANUAL__` + encode(m.X) + `"`), nil -} - -func (m *marshalerForTest) UnmarshalJSON(text []byte) error { - m.X = decode(strings.TrimPrefix(strings.Trim(string(text), `"`), "MANUAL__")) - return nil -} - -var _ json.Marshaler = marshalerForTest{} -var _ json.Unmarshaler = &marshalerForTest{} - -type typeA marshalerForTest - -type typeForTest typeA diff --git a/vendor/github.com/json-iterator/go/output_tests/json_marshal/struct_field/json_test.go b/vendor/github.com/json-iterator/go/output_tests/json_marshal/struct_field/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/json_marshal/struct_field/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/json_marshal/struct_field/types.go b/vendor/github.com/json-iterator/go/output_tests/json_marshal/struct_field/types.go deleted file mode 100644 index 58cb52ba2..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/json_marshal/struct_field/types.go +++ /dev/null @@ -1,56 +0,0 @@ -package test - -import ( - "bytes" - "encoding/base64" - "encoding/json" - "strings" -) - -type marshalerForTest struct { - X string -} - -func encode(str string) string { - buf := bytes.Buffer{} - b64 := base64.NewEncoder(base64.StdEncoding, &buf) - if _, err := b64.Write([]byte(str)); err != nil { - panic(err) - } - if err := b64.Close(); err != nil { - panic(err) - } - return buf.String() -} - -func decode(str string) string { - if len(str) == 0 { - return "" - } - b64 := base64.NewDecoder(base64.StdEncoding, strings.NewReader(str)) - bs := make([]byte, len(str)) - if n, err := b64.Read(bs); err != nil { - panic(err) - } else { - bs = bs[:n] - } - return string(bs) -} - -func (m marshalerForTest) MarshalJSON() ([]byte, error) { - return []byte(`"MANUAL__` + encode(m.X) + `"`), nil -} - -func (m *marshalerForTest) UnmarshalJSON(text []byte) error { - m.X = decode(strings.TrimPrefix(strings.Trim(string(text), `"`), "MANUAL__")) - return nil -} - -var _ json.Marshaler = marshalerForTest{} -var _ json.Unmarshaler = &marshalerForTest{} - -type typeForTest struct { - S string - M marshalerForTest - I int8 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/json_marshal/struct_field_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/json_marshal/struct_field_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/json_marshal/struct_field_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/json_marshal/struct_field_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/json_marshal/struct_field_alias/types.go deleted file mode 100644 index 7c0bf2b4a..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/json_marshal/struct_field_alias/types.go +++ /dev/null @@ -1,58 +0,0 @@ -package test - -import ( - "bytes" - "encoding/base64" - "encoding/json" - "strings" -) - -type marshalerForTest struct { - X string -} - -func encode(str string) string { - buf := bytes.Buffer{} - b64 := base64.NewEncoder(base64.StdEncoding, &buf) - if _, err := b64.Write([]byte(str)); err != nil { - panic(err) - } - if err := b64.Close(); err != nil { - panic(err) - } - return buf.String() -} - -func decode(str string) string { - if len(str) == 0 { - return "" - } - b64 := base64.NewDecoder(base64.StdEncoding, strings.NewReader(str)) - bs := make([]byte, len(str)) - if n, err := b64.Read(bs); err != nil { - panic(err) - } else { - bs = bs[:n] - } - return string(bs) -} - -func (m marshalerForTest) MarshalJSON() ([]byte, error) { - return []byte(`"MANUAL__` + encode(m.X) + `"`), nil -} - -func (m *marshalerForTest) UnmarshalJSON(text []byte) error { - m.X = decode(strings.TrimPrefix(strings.Trim(string(text), `"`), "MANUAL__")) - return nil -} - -var _ json.Marshaler = marshalerForTest{} -var _ json.Unmarshaler = &marshalerForTest{} - -type typeA marshalerForTest - -type typeForTest struct { - S string - M typeA - I int8 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/int16/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/int16/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/int16/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/int16/string/types.go b/vendor/github.com/json-iterator/go/output_tests/map/int16/string/types.go deleted file mode 100644 index bee52d31d..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/int16/string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[int16]string diff --git a/vendor/github.com/json-iterator/go/output_tests/map/int32/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/int32/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/int32/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/int32/string/types.go b/vendor/github.com/json-iterator/go/output_tests/map/int32/string/types.go deleted file mode 100644 index 1c31f192b..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/int32/string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[int32]string diff --git a/vendor/github.com/json-iterator/go/output_tests/map/int64/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/int64/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/int64/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/int64/string/types.go b/vendor/github.com/json-iterator/go/output_tests/map/int64/string/types.go deleted file mode 100644 index c5e915d23..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/int64/string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[int64]string diff --git a/vendor/github.com/json-iterator/go/output_tests/map/int8/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/int8/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/int8/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/int8/string/types.go b/vendor/github.com/json-iterator/go/output_tests/map/int8/string/types.go deleted file mode 100644 index 7b388ea13..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/int8/string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[int8]string diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/array_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string/array_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/array_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/array_string/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string/array_string/types.go deleted file mode 100644 index 2fe206e59..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/array_string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[string][4]string diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/bool/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string/bool/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/bool/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/bool/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string/bool/types.go deleted file mode 100644 index 0228ada57..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/bool/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[string]bool diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/byte/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string/byte/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/byte/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/byte/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string/byte/types.go deleted file mode 100644 index 6a29b7cf5..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/byte/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[string]byte diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/float64/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string/float64/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/float64/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/float64/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string/float64/types.go deleted file mode 100644 index 1b7e838ec..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/float64/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[string]float64 diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/int32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string/int32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/int32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/int32/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string/int32/types.go deleted file mode 100644 index 9bddb99d9..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/int32/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[string]int32 diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/map_string_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string/map_string_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/map_string_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/map_string_string/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string/map_string_string/types.go deleted file mode 100644 index 21f623153..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/map_string_string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[string]map[string]string diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_array_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_array_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_array_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_array_string/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_array_string/types.go deleted file mode 100644 index a75c203a8..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_array_string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[string]*[4]string diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_bool/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_bool/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_bool/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_bool/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_bool/types.go deleted file mode 100644 index 92f4a6ca1..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_bool/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[string]*bool diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_float64/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_float64/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_float64/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_float64/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_float64/types.go deleted file mode 100644 index 21773af13..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_float64/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[string]*float64 diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_int32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_int32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_int32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_int32/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_int32/types.go deleted file mode 100644 index 8e797e358..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_int32/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[string]*int32 diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_map_string_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_map_string_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_map_string_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_map_string_string/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_map_string_string/types.go deleted file mode 100644 index bcd466661..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_map_string_string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[string]*map[string]string diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_slice_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_slice_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_slice_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_slice_string/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_slice_string/types.go deleted file mode 100644 index 150d0be38..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_slice_string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[string]*[]string diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_string/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_string/types.go deleted file mode 100644 index d83a03cd4..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[string]*string diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_struct_various/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_struct_various/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_struct_various/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_struct_various/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_struct_various/types.go deleted file mode 100644 index 0eca3cfd4..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_struct_various/types.go +++ /dev/null @@ -1,14 +0,0 @@ -package test - -type typeA struct { - String string - Int int32 - Float float64 - Struct struct { - X string - } - Slice []string - Map map[string]string -} - -type typeForTest map[string]*typeA diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_uint8/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_uint8/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_uint8/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_uint8/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_uint8/types.go deleted file mode 100644 index 4fb32103c..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/ptr_uint8/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[string]*uint8 diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/slice_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string/slice_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/slice_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/slice_string/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string/slice_string/types.go deleted file mode 100644 index 99dc4872c..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/slice_string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[string][]string diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/string/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string/string/types.go deleted file mode 100644 index 14db5d7cd..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[string]string diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/string_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string/string_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/string_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/string_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string/string_alias/types.go deleted file mode 100644 index a5552fe2c..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/string_alias/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type stringAlias string - -type typeForTest map[string]stringAlias diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/struct_empty/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string/struct_empty/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/struct_empty/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/struct_empty/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string/struct_empty/types.go deleted file mode 100644 index 0ab2a52ff..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/struct_empty/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[string]struct{} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/struct_empty_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string/struct_empty_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/struct_empty_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/struct_empty_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string/struct_empty_alias/types.go deleted file mode 100644 index 549163880..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/struct_empty_alias/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeA struct{} - -type typeForTest map[string]typeA diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/struct_ptr_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string/struct_ptr_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/struct_ptr_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/struct_ptr_string/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string/struct_ptr_string/types.go deleted file mode 100644 index cfb2fd6bf..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/struct_ptr_string/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeForTest map[string]struct { - F *string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/struct_various/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string/struct_various/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/struct_various/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/struct_various/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string/struct_various/types.go deleted file mode 100644 index 8fbf9afa8..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/struct_various/types.go +++ /dev/null @@ -1,12 +0,0 @@ -package test - -type typeForTest map[string]struct { - String string - Int int32 - Float float64 - Struct struct { - X string - } - Slice []string - Map map[string]string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/uint8/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string/uint8/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/uint8/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string/uint8/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string/uint8/types.go deleted file mode 100644 index 76bd60591..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string/uint8/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[string]uint8 diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string_alias/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string_alias/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string_alias/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string_alias/string/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string_alias/string/types.go deleted file mode 100644 index e10daa2a3..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string_alias/string/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type stringAlias string - -type typeForTest map[stringAlias]string diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string_alias/string_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/string_alias/string_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string_alias/string_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/string_alias/string_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/map/string_alias/string_alias/types.go deleted file mode 100644 index d50ce505c..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/string_alias/string_alias/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type stringAlias string - -type typeForTest map[stringAlias]stringAlias diff --git a/vendor/github.com/json-iterator/go/output_tests/map/uint16/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/uint16/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/uint16/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/uint16/string/types.go b/vendor/github.com/json-iterator/go/output_tests/map/uint16/string/types.go deleted file mode 100644 index 6fe429c0b..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/uint16/string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[uint16]string diff --git a/vendor/github.com/json-iterator/go/output_tests/map/uint32/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/uint32/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/uint32/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/uint32/string/types.go b/vendor/github.com/json-iterator/go/output_tests/map/uint32/string/types.go deleted file mode 100644 index 0b107a51f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/uint32/string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[uint32]string diff --git a/vendor/github.com/json-iterator/go/output_tests/map/uint8/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map/uint8/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/uint8/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map/uint8/string/types.go b/vendor/github.com/json-iterator/go/output_tests/map/uint8/string/types.go deleted file mode 100644 index 5d11b147d..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map/uint8/string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest map[uint8]string diff --git a/vendor/github.com/json-iterator/go/output_tests/map_key_text_marshal/string_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map_key_text_marshal/string_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map_key_text_marshal/string_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map_key_text_marshal/string_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/map_key_text_marshal/string_alias/types.go deleted file mode 100644 index f12da3975..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map_key_text_marshal/string_alias/types.go +++ /dev/null @@ -1,22 +0,0 @@ -package test - -import ( - "encoding" - "strings" -) - -type keyType string - -func (k keyType) MarshalText() ([]byte, error) { - return []byte("MANUAL__" + k), nil -} - -func (k *keyType) UnmarshalText(text []byte) error { - *k = keyType(strings.TrimPrefix(string(text), "MANUAL__")) - return nil -} - -var _ encoding.TextMarshaler = keyType("") -var _ encoding.TextUnmarshaler = new(keyType) - -type typeForTest map[keyType]string diff --git a/vendor/github.com/json-iterator/go/output_tests/map_key_text_marshal/struct/json_test.go b/vendor/github.com/json-iterator/go/output_tests/map_key_text_marshal/struct/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map_key_text_marshal/struct/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/map_key_text_marshal/struct/types.go b/vendor/github.com/json-iterator/go/output_tests/map_key_text_marshal/struct/types.go deleted file mode 100644 index 1944c1eea..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/map_key_text_marshal/struct/types.go +++ /dev/null @@ -1,24 +0,0 @@ -package test - -import ( - "encoding" - "strings" -) - -type keyType struct { - X string -} - -func (k keyType) MarshalText() ([]byte, error) { - return []byte("MANUAL__" + k.X), nil -} - -func (k *keyType) UnmarshalText(text []byte) error { - k.X = strings.TrimPrefix(string(text), "MANUAL__") - return nil -} - -var _ encoding.TextMarshaler = keyType{} -var _ encoding.TextUnmarshaler = &keyType{} - -type typeForTest map[keyType]string diff --git a/vendor/github.com/json-iterator/go/output_tests/marshal_fail_case.go b/vendor/github.com/json-iterator/go/output_tests/marshal_fail_case.go deleted file mode 100644 index 2e20041c4..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/marshal_fail_case.go +++ /dev/null @@ -1,23 +0,0 @@ -package main - -import ( - "encoding/json" - "fmt" - "reflect" - - jsoniter "github.com/json-iterator/go" -) - -type typeForTest struct { - F *float64 -} - -func main() { - var obj typeForTest - - jb1, _ := json.Marshal(obj) - jb2, _ := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(obj) - if !reflect.DeepEqual(jb1, jb2) { - fmt.Printf("results differ:\n expected: `%s`\n got: `%s`\n", string(jb1), string(jb2)) - } -} diff --git a/vendor/github.com/json-iterator/go/output_tests/partial_unmarshal/partial_test.go b/vendor/github.com/json-iterator/go/output_tests/partial_unmarshal/partial_test.go deleted file mode 100644 index a30b5c46b..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/partial_unmarshal/partial_test.go +++ /dev/null @@ -1,84 +0,0 @@ -// NOTE: This test is different than most of the other JSON roundtrip tests. -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_PartialUnmarshal(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest1 - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest2 - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest2 - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} diff --git a/vendor/github.com/json-iterator/go/output_tests/partial_unmarshal/types.go b/vendor/github.com/json-iterator/go/output_tests/partial_unmarshal/types.go deleted file mode 100644 index 00282d470..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/partial_unmarshal/types.go +++ /dev/null @@ -1,11 +0,0 @@ -package test - -type typeForTest1 struct { - F1 string - F2 string - F3 string -} - -type typeForTest2 struct { - F1 string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/array/bool/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/array/bool/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/array/bool/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/array/bool/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/array/bool/types.go deleted file mode 100644 index 8d2753502..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/array/bool/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4][4]bool diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/array/byte/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/array/byte/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/array/byte/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/array/byte/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/array/byte/types.go deleted file mode 100644 index fa2a65542..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/array/byte/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4][4]byte diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/array/float64/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/array/float64/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/array/float64/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/array/float64/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/array/float64/types.go deleted file mode 100644 index 2adbf0eac..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/array/float64/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4][4]float64 diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/array/int32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/array/int32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/array/int32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/array/int32/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/array/int32/types.go deleted file mode 100644 index 2056d7c32..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/array/int32/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4][4]int32 diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/array/ptr_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/array/ptr_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/array/ptr_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/array/ptr_string/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/array/ptr_string/types.go deleted file mode 100644 index 80b6f4887..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/array/ptr_string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4][4]*string diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/array/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/array/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/array/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/array/string/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/array/string/types.go deleted file mode 100644 index 9ff190f14..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/array/string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4][4]string diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/array/uint8/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/array/uint8/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/array/uint8/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/array/uint8/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/array/uint8/types.go deleted file mode 100644 index 51454ca24..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/array/uint8/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4][4]uint8 diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/bool/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/bool/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/bool/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/bool/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/bool/types.go deleted file mode 100644 index 916a7dfff..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/bool/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest []bool diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/byte/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/byte/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/byte/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/byte/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/byte/types.go deleted file mode 100644 index 0a052a238..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/byte/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest []byte diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/float64/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/float64/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/float64/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/float64/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/float64/types.go deleted file mode 100644 index 16e06363d..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/float64/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest []float64 diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/int32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/int32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/int32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/int32/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/int32/types.go deleted file mode 100644 index 9b1af87cc..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/int32/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest []int32 diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/int64/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/int64/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/int64/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/int64/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/int64/types.go deleted file mode 100644 index 335616cad..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/int64/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest []int64 diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/map/int32_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/map/int32_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/map/int32_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/map/int32_string/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/map/int32_string/types.go deleted file mode 100644 index 419e85a82..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/map/int32_string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest []map[int32]string diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/map/string_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/map/string_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/map/string_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/map/string_string/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/map/string_string/types.go deleted file mode 100644 index 56ab1fbcb..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/map/string_string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest []map[string]string diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/bool/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/bool/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/bool/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/bool/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/bool/types.go deleted file mode 100644 index 50fe493ce..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/bool/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]*[4]bool diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/byte/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/byte/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/byte/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/byte/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/byte/types.go deleted file mode 100644 index f5eea3ae2..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/byte/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]*[4]byte diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/float64/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/float64/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/float64/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/float64/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/float64/types.go deleted file mode 100644 index 70e7b64ae..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/float64/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]*[4]float64 diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/int32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/int32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/int32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/int32/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/int32/types.go deleted file mode 100644 index 5496acbbe..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/int32/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]*[4]int32 diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/ptr_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/ptr_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/ptr_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/ptr_string/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/ptr_string/types.go deleted file mode 100644 index 55693a71f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/ptr_string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]*[4]*string diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/string/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/string/types.go deleted file mode 100644 index 4f1cc5ab4..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]*[4]string diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/uint8/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/uint8/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/uint8/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/uint8/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/uint8/types.go deleted file mode 100644 index a619570d5..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_array/uint8/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [4]*[4]uint8 diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_bool/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_bool/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_bool/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_bool/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_bool/types.go deleted file mode 100644 index 2086a57f1..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_bool/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest []*bool diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_float64/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_float64/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_float64/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_float64/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_float64/types.go deleted file mode 100644 index 9d58400f0..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_float64/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest []*float64 diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_int32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_int32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_int32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_int32/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_int32/types.go deleted file mode 100644 index 522a5912d..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_int32/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest []*int32 diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_map/int32_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_map/int32_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_map/int32_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_map/int32_string/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_map/int32_string/types.go deleted file mode 100644 index 00e90409e..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_map/int32_string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest []*map[int32]string diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_map/string_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_map/string_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_map/string_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_map/string_string/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_map/string_string/types.go deleted file mode 100644 index 0ab1c964c..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_map/string_string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest []*map[string]string diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/bool/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/bool/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/bool/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/bool/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/bool/types.go deleted file mode 100644 index 0a4db3547..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/bool/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest []*[]bool diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/byte/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/byte/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/byte/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/byte/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/byte/types.go deleted file mode 100644 index 57fcb27da..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/byte/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest []*[]byte diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/float64/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/float64/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/float64/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/float64/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/float64/types.go deleted file mode 100644 index fcc2cc96b..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/float64/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest []*[]float64 diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/int32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/int32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/int32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/int32/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/int32/types.go deleted file mode 100644 index 85d6806c9..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/int32/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest []*[]int32 diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/ptr_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/ptr_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/ptr_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/ptr_string/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/ptr_string/types.go deleted file mode 100644 index 4089e39de..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/ptr_string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest []*[]*string diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/string/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/string/types.go deleted file mode 100644 index d9952b650..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest []*[]string diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/uint8/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/uint8/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/uint8/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/uint8/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/uint8/types.go deleted file mode 100644 index 509847a41..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_slice/uint8/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest []*[]uint8 diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_string/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_string/types.go deleted file mode 100644 index 1abfc6d15..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest []*string diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_struct_various/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_struct_various/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_struct_various/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_struct_various/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_struct_various/types.go deleted file mode 100644 index d01bed91f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_struct_various/types.go +++ /dev/null @@ -1,12 +0,0 @@ -package test - -type typeForTest []*struct { - String string - Int int32 - Float float64 - Struct struct { - X string - } - Slice []string - Map map[string]string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_uint8/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_uint8/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_uint8/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_uint8/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/ptr_uint8/types.go deleted file mode 100644 index 922822c2d..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/ptr_uint8/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest []*uint8 diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/slice/bool/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/slice/bool/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/slice/bool/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/slice/bool/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/slice/bool/types.go deleted file mode 100644 index 498785d5e..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/slice/bool/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [][]bool diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/slice/byte/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/slice/byte/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/slice/byte/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/slice/byte/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/slice/byte/types.go deleted file mode 100644 index ef66dbfaa..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/slice/byte/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [][]byte diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/slice/float64/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/slice/float64/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/slice/float64/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/slice/float64/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/slice/float64/types.go deleted file mode 100644 index 4d4712694..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/slice/float64/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [][]float64 diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/slice/int32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/slice/int32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/slice/int32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/slice/int32/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/slice/int32/types.go deleted file mode 100644 index 9c1ebc1a5..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/slice/int32/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [][]int32 diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/slice/ptr_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/slice/ptr_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/slice/ptr_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/slice/ptr_string/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/slice/ptr_string/types.go deleted file mode 100644 index 28f0e8943..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/slice/ptr_string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [][]*string diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/slice/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/slice/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/slice/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/slice/string/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/slice/string/types.go deleted file mode 100644 index a6ef45abd..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/slice/string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [][]string diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/slice/uint8/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/slice/uint8/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/slice/uint8/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/slice/uint8/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/slice/uint8/types.go deleted file mode 100644 index e3b4ed190..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/slice/uint8/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest [][]uint8 diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/string/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/string/types.go deleted file mode 100644 index 91244aa38..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/string/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest []string diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/struct_empty/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/struct_empty/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/struct_empty/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/struct_empty/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/struct_empty/types.go deleted file mode 100644 index 3bf96bccb..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/struct_empty/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest []struct{} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/struct_empty_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/struct_empty_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/struct_empty_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/struct_empty_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/struct_empty_alias/types.go deleted file mode 100644 index 8d150ef40..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/struct_empty_alias/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeA struct{} - -type typeForTest []typeA diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/struct_ptr_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/struct_ptr_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/struct_ptr_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/struct_ptr_string/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/struct_ptr_string/types.go deleted file mode 100644 index 13fe6b14e..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/struct_ptr_string/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeForTest []struct { - F *string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/struct_various/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/struct_various/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/struct_various/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/struct_various/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/struct_various/types.go deleted file mode 100644 index f822b5794..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/struct_various/types.go +++ /dev/null @@ -1,12 +0,0 @@ -package test - -type typeForTest []struct { - String string - Int int32 - Float float64 - Struct struct { - X string - } - Slice []string - Map map[string]string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/uint8/json_test.go b/vendor/github.com/json-iterator/go/output_tests/slice/uint8/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/uint8/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/slice/uint8/types.go b/vendor/github.com/json-iterator/go/output_tests/slice/uint8/types.go deleted file mode 100644 index 7793de693..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/slice/uint8/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest []uint8 diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/alias/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/alias/types.go deleted file mode 100644 index 947ada6fb..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/alias/types.go +++ /dev/null @@ -1,20 +0,0 @@ -package test - -type typeA struct { - Byte1 byte - Byte2 byte - Bool1 bool - Bool2 bool - Int8 int8 - Int16 int16 - Int32 int32 - Uint8 uint8 - Uint16 uint16 - Uint32 uint32 - Float32 float32 - Float64 float64 - String1 string - String2 string -} - -type typeForTest typeA diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/float64/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/float64/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/float64/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/float64/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/float64/types.go deleted file mode 100644 index 1f454820f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/float64/types.go +++ /dev/null @@ -1,8 +0,0 @@ -package test - -// Embedded TEST ONLY -type Embedded float64 - -type typeForTest struct { - Embedded -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/int32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/int32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/int32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/int32/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/int32/types.go deleted file mode 100644 index a7275edfb..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/int32/types.go +++ /dev/null @@ -1,8 +0,0 @@ -package test - -// Embedded TEST ONLY -type Embedded int32 - -type typeForTest struct { - Embedded -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/json_marshal/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/json_marshal/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/json_marshal/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/json_marshal/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/json_marshal/types.go deleted file mode 100644 index 36c5e5770..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/json_marshal/types.go +++ /dev/null @@ -1,57 +0,0 @@ -package test - -import ( - "bytes" - "encoding/base64" - "encoding/json" - "strings" -) - -// MarshalerForTest TEST ONLY -type MarshalerForTest string - -func encode(str string) string { - buf := bytes.Buffer{} - b64 := base64.NewEncoder(base64.StdEncoding, &buf) - if _, err := b64.Write([]byte(str)); err != nil { - panic(err) - } - if err := b64.Close(); err != nil { - panic(err) - } - return buf.String() -} - -func decode(str string) string { - if len(str) == 0 { - return "" - } - b64 := base64.NewDecoder(base64.StdEncoding, strings.NewReader(str)) - bs := make([]byte, len(str)) - if n, err := b64.Read(bs); err != nil { - panic(err) - } else { - bs = bs[:n] - } - return string(bs) -} - -// MarshalJSON TEST ONLY -func (m MarshalerForTest) MarshalJSON() ([]byte, error) { - return []byte(`"MANUAL__` + encode(string(m)) + `"`), nil -} - -// UnmarshalJSON TEST ONLY -func (m *MarshalerForTest) UnmarshalJSON(text []byte) error { - *m = MarshalerForTest(decode(strings.TrimPrefix(strings.Trim(string(text), `"`), "MANUAL__"))) - return nil -} - -var _ json.Marshaler = *new(MarshalerForTest) -var _ json.Unmarshaler = new(MarshalerForTest) - -type typeForTest struct { - F1 float64 - MarshalerForTest - F2 int32 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/map_string_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/map_string_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/map_string_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/map_string_string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/map_string_string/types.go deleted file mode 100644 index d56ee0a81..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/map_string_string/types.go +++ /dev/null @@ -1,8 +0,0 @@ -package test - -// Embedded TEST ONLY -type Embedded map[string]string - -type typeForTest struct { - Embedded -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_float64/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_float64/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_float64/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_float64/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_float64/types.go deleted file mode 100644 index dbf04923e..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_float64/types.go +++ /dev/null @@ -1,8 +0,0 @@ -package test - -// Embedded TEST ONLY -type Embedded float64 - -type typeForTest struct { - *Embedded -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_int32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_int32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_int32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_int32/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_int32/types.go deleted file mode 100644 index 24294e201..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_int32/types.go +++ /dev/null @@ -1,8 +0,0 @@ -package test - -// Embedded TEST ONLY -type Embedded int32 - -type typeForTest struct { - *Embedded -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_map_string_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_map_string_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_map_string_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_map_string_string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_map_string_string/types.go deleted file mode 100644 index 40dbec6ab..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_map_string_string/types.go +++ /dev/null @@ -1,8 +0,0 @@ -package test - -// Embedded TEST ONLY -type Embedded map[string]string - -type typeForTest struct { - *Embedded -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_slice_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_slice_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_slice_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_slice_string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_slice_string/types.go deleted file mode 100644 index 297b6aff1..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_slice_string/types.go +++ /dev/null @@ -1,8 +0,0 @@ -package test - -// Embedded TEST ONLY -type Embedded []string - -type typeForTest struct { - *Embedded -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_string/types.go deleted file mode 100644 index 06f4138af..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_string/types.go +++ /dev/null @@ -1,8 +0,0 @@ -package test - -// Embedded TEST ONLY -type Embedded string - -type typeForTest struct { - *Embedded -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_struct_various/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_struct_various/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_struct_various/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_struct_various/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_struct_various/types.go deleted file mode 100644 index 6a30819c5..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/ptr_struct_various/types.go +++ /dev/null @@ -1,17 +0,0 @@ -package test - -// Embedded TEST ONLY -type Embedded struct { - String string - Int int32 - Float float64 - Struct struct { - X string - } - Slice []string - Map map[string]string -} - -type typeForTest struct { - *Embedded -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/slice_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/slice_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/slice_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/slice_string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/slice_string/types.go deleted file mode 100644 index 9c20be3d0..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/slice_string/types.go +++ /dev/null @@ -1,8 +0,0 @@ -package test - -// Embedded TEST ONLY -type Embedded []string - -type typeForTest struct { - Embedded -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/string/types.go deleted file mode 100644 index 7b153fa2c..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/string/types.go +++ /dev/null @@ -1,8 +0,0 @@ -package test - -// Embedded TEST ONLY -type Embedded string - -type typeForTest struct { - Embedded -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/string_with_tag/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/string_with_tag/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/string_with_tag/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/string_with_tag/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/string_with_tag/types.go deleted file mode 100644 index 3e0919abf..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/string_with_tag/types.go +++ /dev/null @@ -1,8 +0,0 @@ -package test - -// Embedded TEST ONLY -type Embedded string - -type typeForTest struct { - Embedded `json:"othername"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/struct_various/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/struct_various/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/struct_various/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/struct_various/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/struct_various/types.go deleted file mode 100644 index d7eaeaa03..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/struct_various/types.go +++ /dev/null @@ -1,17 +0,0 @@ -package test - -// Embedded TEST ONLY -type Embedded struct { - String string - Int int32 - Float float64 - Struct struct { - X string - } - Slice []string - Map map[string]string -} - -type typeForTest struct { - Embedded -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/text_marshal/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/text_marshal/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/text_marshal/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/text_marshal/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/text_marshal/types.go deleted file mode 100644 index d8ad178a0..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/no_overlap/text_marshal/types.go +++ /dev/null @@ -1,57 +0,0 @@ -package test - -import ( - "bytes" - "encoding" - "encoding/base64" - "strings" -) - -// MarshalerForTest TEST ONLY -type MarshalerForTest string - -func encode(str string) string { - buf := bytes.Buffer{} - b64 := base64.NewEncoder(base64.StdEncoding, &buf) - if _, err := b64.Write([]byte(str)); err != nil { - panic(err) - } - if err := b64.Close(); err != nil { - panic(err) - } - return buf.String() -} - -func decode(str string) string { - if len(str) == 0 { - return "" - } - b64 := base64.NewDecoder(base64.StdEncoding, strings.NewReader(str)) - bs := make([]byte, len(str)) - if n, err := b64.Read(bs); err != nil { - panic(err) - } else { - bs = bs[:n] - } - return string(bs) -} - -// MarshalText TEST ONLY -func (m MarshalerForTest) MarshalText() ([]byte, error) { - return []byte(`MANUAL__` + encode(string(m))), nil -} - -// UnmarshalText TEST ONLY -func (m *MarshalerForTest) UnmarshalText(text []byte) error { - *m = MarshalerForTest(decode(strings.TrimPrefix(string(text), "MANUAL__"))) - return nil -} - -var _ encoding.TextMarshaler = *new(MarshalerForTest) -var _ encoding.TextUnmarshaler = new(MarshalerForTest) - -type typeForTest struct { - F1 float64 - MarshalerForTest - F2 int32 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/different_levels/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/different_levels/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/different_levels/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/different_levels/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/different_levels/types.go deleted file mode 100644 index 4c169aec0..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/different_levels/types.go +++ /dev/null @@ -1,17 +0,0 @@ -package test - -// E1 TEST ONLY -type E1 struct { - F1 int32 -} - -// E2 TEST ONLY -type E2 struct { - F2 string -} - -type typeForTest struct { - E1 - E2 - F1 string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/ignore_deeper_level/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/ignore_deeper_level/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/ignore_deeper_level/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/ignore_deeper_level/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/ignore_deeper_level/types.go deleted file mode 100644 index 3da8950d2..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/ignore_deeper_level/types.go +++ /dev/null @@ -1,23 +0,0 @@ -package test - -// DoubleEmbedded TEST ONLY -type DoubleEmbedded struct { - F1 int32 `json:"F1"` -} - -// Embedded1 TEST ONLY -type Embedded1 struct { - DoubleEmbedded - F1 int32 -} - -// Embedded2 TEST ONLY -type Embedded2 struct { - F1 int32 `json:"F1"` - DoubleEmbedded -} - -type typeForTest struct { - Embedded1 - Embedded2 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_1_both_tagged/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_1_both_tagged/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_1_both_tagged/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_1_both_tagged/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_1_both_tagged/types.go deleted file mode 100644 index 4ef30d69a..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_1_both_tagged/types.go +++ /dev/null @@ -1,16 +0,0 @@ -package test - -// Embedded1 TEST ONLY -type Embedded1 struct { - F1 int32 `json:"F1"` -} - -// Embedded2 TEST ONLY -type Embedded2 struct { - F1 int32 `json:"F1"` -} - -type typeForTest struct { - Embedded1 - Embedded2 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_1_no_tags/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_1_no_tags/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_1_no_tags/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_1_no_tags/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_1_no_tags/types.go deleted file mode 100644 index 88f359677..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_1_no_tags/types.go +++ /dev/null @@ -1,16 +0,0 @@ -package test - -// Embedded1 TEST ONLY -type Embedded1 struct { - F1 int32 -} - -// Embedded2 TEST ONLY -type Embedded2 struct { - F1 int32 -} - -type typeForTest struct { - Embedded1 - Embedded2 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_1_tagged/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_1_tagged/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_1_tagged/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_1_tagged/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_1_tagged/types.go deleted file mode 100644 index 180b9b783..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_1_tagged/types.go +++ /dev/null @@ -1,16 +0,0 @@ -package test - -// Embedded1 TEST ONLY -type Embedded1 struct { - F1 int32 -} - -// Embedded2 TEST ONLY -type Embedded2 struct { - F1 int32 `json:"F1"` -} - -type typeForTest struct { - Embedded1 - Embedded2 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_2_both_tagged/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_2_both_tagged/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_2_both_tagged/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_2_both_tagged/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_2_both_tagged/types.go deleted file mode 100644 index 3265085e9..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_2_both_tagged/types.go +++ /dev/null @@ -1,26 +0,0 @@ -package test - -// DoubleEmbedded1 TEST ONLY -type DoubleEmbedded1 struct { - F1 int32 `json:"F1"` -} - -// Embedded1 TEST ONLY -type Embedded1 struct { - DoubleEmbedded1 -} - -// DoubleEmbedded2 TEST ONLY -type DoubleEmbedded2 struct { - F1 int32 `json:"F1"` -} - -// Embedded2 TEST ONLY -type Embedded2 struct { - DoubleEmbedded2 -} - -type typeForTest struct { - Embedded1 - Embedded2 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_2_no_tags/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_2_no_tags/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_2_no_tags/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_2_no_tags/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_2_no_tags/types.go deleted file mode 100644 index 5b20d89a1..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_2_no_tags/types.go +++ /dev/null @@ -1,26 +0,0 @@ -package test - -// DoubleEmbedded1 TEST ONLY -type DoubleEmbedded1 struct { - F1 int32 -} - -// Embedded1 TEST ONLY -type Embedded1 struct { - DoubleEmbedded1 -} - -// DoubleEmbedded2 TEST ONLY -type DoubleEmbedded2 struct { - F1 int32 -} - -// Embedded2 TEST ONLY -type Embedded2 struct { - DoubleEmbedded2 -} - -type typeForTest struct { - Embedded1 - Embedded2 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_2_tagged/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_2_tagged/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_2_tagged/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_2_tagged/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_2_tagged/types.go deleted file mode 100644 index 97f9e23ff..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/anonymous/overlap/same_level_2_tagged/types.go +++ /dev/null @@ -1,26 +0,0 @@ -package test - -// DoubleEmbedded1 TEST ONLY -type DoubleEmbedded1 struct { - F1 int32 -} - -// Embedded1 TEST ONLY -type Embedded1 struct { - DoubleEmbedded1 -} - -// DoubleEmbedded2 TEST ONLY -type DoubleEmbedded2 struct { - F1 int32 `json:"F1"` -} - -// Embedded2 TEST ONLY -type Embedded2 struct { - DoubleEmbedded2 -} - -type typeForTest struct { - Embedded1 - Embedded2 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/array/ptr_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/array/ptr_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/array/ptr_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/array/ptr_string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/array/ptr_string/types.go deleted file mode 100644 index 77b3235e8..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/array/ptr_string/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeForTest struct { - F [4]*string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/array/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/array/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/array/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/array/string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/array/string/types.go deleted file mode 100644 index 6652ad8c3..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/array/string/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeForTest struct { - F [4]string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/array/string_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/array/string_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/array/string_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/array/string_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/array/string_alias/types.go deleted file mode 100644 index 1d4ce4918..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/array/string_alias/types.go +++ /dev/null @@ -1,9 +0,0 @@ -package test - -type typeA1 string -type typeA2 [4]typeA1 - -type typeForTest struct { - F1 [4]typeA1 - F2 typeA2 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/array/strings/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/array/strings/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/array/strings/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/array/strings/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/array/strings/types.go deleted file mode 100644 index 9217b5d36..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/array/strings/types.go +++ /dev/null @@ -1,7 +0,0 @@ -package test - -type typeForTest struct { - F1 [4]string - F2 [4]string - F3 [4]string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/array/struct_strings/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/array/struct_strings/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/array/struct_strings/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/array/struct_strings/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/array/struct_strings/types.go deleted file mode 100644 index 87fc996de..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/array/struct_strings/types.go +++ /dev/null @@ -1,9 +0,0 @@ -package test - -type typeForTest struct { - F [4]struct { - F1 string - F2 string - F3 string - } -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/empty/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/empty/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/empty/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/empty/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/empty/types.go deleted file mode 100644 index b6b45dfe4..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/empty/types.go +++ /dev/null @@ -1,3 +0,0 @@ -package test - -type typeForTest struct{} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/empty_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/empty_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/empty_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/empty_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/empty_alias/types.go deleted file mode 100644 index c50475abf..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/empty_alias/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeA struct{} - -type typeForTest typeA diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/everything/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/everything/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/everything/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/everything/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/everything/types.go deleted file mode 100644 index c287fa40e..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/everything/types.go +++ /dev/null @@ -1,20 +0,0 @@ -package test - -type typeForTest struct { - Byte1 byte - Byte2 byte - Bool1 bool - Bool2 bool - Int8 int8 - Int16 int16 - Int32 int32 - Int64 int64 - Uint8 uint8 - Uint16 uint16 - Uint32 uint32 - Uint64 uint64 - Float32 float32 - Float64 float64 - String1 string - String2 string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/float64/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/float64/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/float64/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/float64/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/float64/types.go deleted file mode 100644 index c8873ea48..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/float64/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeForTest struct { - F float64 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/float64_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/float64_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/float64_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/float64_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/float64_alias/types.go deleted file mode 100644 index 88a8ad18a..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/float64_alias/types.go +++ /dev/null @@ -1,7 +0,0 @@ -package test - -type typeA float64 - -type typeForTest struct { - F typeA -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/float64s/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/float64s/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/float64s/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/float64s/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/float64s/types.go deleted file mode 100644 index d9d5682b3..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/float64s/types.go +++ /dev/null @@ -1,7 +0,0 @@ -package test - -type typeForTest struct { - F1 float64 - F2 float64 - F3 float64 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/float64s_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/float64s_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/float64s_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/float64s_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/float64s_alias/types.go deleted file mode 100644 index dfb4b566a..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/float64s_alias/types.go +++ /dev/null @@ -1,9 +0,0 @@ -package test - -type typeA float64 - -type typeForTest struct { - F1 typeA - F2 typeA - F3 typeA -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/int32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/int32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/int32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/int32/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/int32/types.go deleted file mode 100644 index ea5481bc9..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/int32/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeForTest struct { - F int32 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/int32_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/int32_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/int32_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/int32_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/int32_alias/types.go deleted file mode 100644 index fcafa26e1..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/int32_alias/types.go +++ /dev/null @@ -1,7 +0,0 @@ -package test - -type typeA int32 - -type typeForTest struct { - F typeA -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/int32s/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/int32s/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/int32s/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/int32s/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/int32s/types.go deleted file mode 100644 index f7c078b37..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/int32s/types.go +++ /dev/null @@ -1,7 +0,0 @@ -package test - -type typeForTest struct { - F1 int32 - F2 int32 - F3 int32 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/int32s_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/int32s_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/int32s_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/int32s_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/int32s_alias/types.go deleted file mode 100644 index d168647e2..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/int32s_alias/types.go +++ /dev/null @@ -1,9 +0,0 @@ -package test - -type typeA int32 - -type typeForTest struct { - F1 typeA - F2 typeA - F3 typeA -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/int64/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/int64/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/int64/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/int64/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/int64/types.go deleted file mode 100644 index cf7701629..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/int64/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeForTest struct { - F int64 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/map/int32_ptr_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/map/int32_ptr_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/map/int32_ptr_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/map/int32_ptr_string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/map/int32_ptr_string/types.go deleted file mode 100644 index 17d7a1f26..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/map/int32_ptr_string/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeForTest struct { - F map[int32]*string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/map/int32_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/map/int32_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/map/int32_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/map/int32_string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/map/int32_string/types.go deleted file mode 100644 index f800fc1a4..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/map/int32_string/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeForTest struct { - F map[int32]string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/map/int32_struct_strings/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/map/int32_struct_strings/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/map/int32_struct_strings/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/map/int32_struct_strings/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/map/int32_struct_strings/types.go deleted file mode 100644 index 03c7ba331..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/map/int32_struct_strings/types.go +++ /dev/null @@ -1,9 +0,0 @@ -package test - -type typeForTest struct { - F map[int32]struct { - F1 string - F2 string - F3 string - } -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/map/string_ptr_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/map/string_ptr_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/map/string_ptr_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/map/string_ptr_string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/map/string_ptr_string/types.go deleted file mode 100644 index 239b86d14..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/map/string_ptr_string/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeForTest struct { - F map[string]*string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/map/string_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/map/string_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/map/string_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/map/string_string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/map/string_string/types.go deleted file mode 100644 index 4f4036722..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/map/string_string/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeForTest struct { - F map[string]string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/map/string_struct_strings/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/map/string_struct_strings/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/map/string_struct_strings/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/map/string_struct_strings/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/map/string_struct_strings/types.go deleted file mode 100644 index a65d76d34..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/map/string_struct_strings/types.go +++ /dev/null @@ -1,9 +0,0 @@ -package test - -type typeForTest struct { - F map[string]struct { - F1 string - F2 string - F3 string - } -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_float64/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptr_float64/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_float64/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_float64/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptr_float64/types.go deleted file mode 100644 index f9fe8f8ee..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_float64/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeForTest struct { - F *float64 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_float64_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptr_float64_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_float64_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_float64_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptr_float64_alias/types.go deleted file mode 100644 index fdcc1df5a..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_float64_alias/types.go +++ /dev/null @@ -1,10 +0,0 @@ -package test - -type typeA1 float64 -type typeA2 *float64 - -type typeForTest struct { - F1 *typeA1 - F2 typeA2 - F3 *typeA2 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_int32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptr_int32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_int32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_int32/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptr_int32/types.go deleted file mode 100644 index 2e0a1d83f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_int32/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeForTest struct { - F *int32 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_int32_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptr_int32_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_int32_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_int32_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptr_int32_alias/types.go deleted file mode 100644 index 96b1fff71..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_int32_alias/types.go +++ /dev/null @@ -1,11 +0,0 @@ -package test - -type typeA1 int32 - -type typeA2 *int32 - -type typeForTest struct { - F1 *typeA1 - F2 typeA2 - F3 *typeA2 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_ptr_struct_empty/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptr_ptr_struct_empty/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_ptr_struct_empty/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_ptr_struct_empty/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptr_ptr_struct_empty/types.go deleted file mode 100644 index 365ad5552..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_ptr_struct_empty/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeForTest struct { - F **struct{} -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_ptr_struct_strings/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptr_ptr_struct_strings/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_ptr_struct_strings/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_ptr_struct_strings/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptr_ptr_struct_strings/types.go deleted file mode 100644 index a56eb2032..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_ptr_struct_strings/types.go +++ /dev/null @@ -1,9 +0,0 @@ -package test - -type typeForTest struct { - F **struct { - F1 string - F2 string - F3 string - } -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptr_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptr_string/types.go deleted file mode 100644 index 3b7d5b38f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_string/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeForTest struct { - F *string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_string_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptr_string_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_string_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_string_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptr_string_alias/types.go deleted file mode 100644 index cc19b973a..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_string_alias/types.go +++ /dev/null @@ -1,10 +0,0 @@ -package test - -type typeA1 string -type typeA2 *string - -type typeForTest struct { - F1 *typeA1 - F2 typeA2 - F3 *typeA2 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_struct_empty/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptr_struct_empty/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_struct_empty/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_struct_empty/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptr_struct_empty/types.go deleted file mode 100644 index 578378272..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_struct_empty/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeForTest struct { - F *struct{} -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_struct_strings/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptr_struct_strings/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_struct_strings/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_struct_strings/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptr_struct_strings/types.go deleted file mode 100644 index 6f3105187..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptr_struct_strings/types.go +++ /dev/null @@ -1,9 +0,0 @@ -package test - -type typeForTest struct { - F *struct { - F1 string - F2 string - F3 string - } -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptrs_float64/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptrs_float64/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptrs_float64/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptrs_float64/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptrs_float64/types.go deleted file mode 100644 index 3972cfac9..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptrs_float64/types.go +++ /dev/null @@ -1,7 +0,0 @@ -package test - -type typeForTest struct { - F1 *float64 - F2 *float64 - F3 *float64 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptrs_int32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptrs_int32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptrs_int32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptrs_int32/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptrs_int32/types.go deleted file mode 100644 index 46e04dbb1..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptrs_int32/types.go +++ /dev/null @@ -1,7 +0,0 @@ -package test - -type typeForTest struct { - F1 *int32 - F2 *int32 - F3 *int32 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptrs_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptrs_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptrs_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/ptrs_string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/ptrs_string/types.go deleted file mode 100644 index 0030442c1..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/ptrs_string/types.go +++ /dev/null @@ -1,7 +0,0 @@ -package test - -type typeForTest struct { - F1 *string - F2 *string - F3 *string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/slice/ptr_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/slice/ptr_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/slice/ptr_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/slice/ptr_string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/slice/ptr_string/types.go deleted file mode 100644 index dd839585a..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/slice/ptr_string/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeForTest struct { - F []*string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/slice/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/slice/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/slice/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/slice/string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/slice/string/types.go deleted file mode 100644 index ef61564ca..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/slice/string/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeForTest struct { - F []string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/slice/string_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/slice/string_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/slice/string_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/slice/string_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/slice/string_alias/types.go deleted file mode 100644 index 3a95f533e..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/slice/string_alias/types.go +++ /dev/null @@ -1,9 +0,0 @@ -package test - -type typeA1 string -type typeA2 []typeA1 - -type typeForTest struct { - F1 []typeA1 - F2 typeA2 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/slice/strings/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/slice/strings/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/slice/strings/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/slice/strings/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/slice/strings/types.go deleted file mode 100644 index 7565c1332..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/slice/strings/types.go +++ /dev/null @@ -1,7 +0,0 @@ -package test - -type typeForTest struct { - F1 []string - F2 []string - F3 []string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/slice/struct_strings/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/slice/struct_strings/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/slice/struct_strings/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/slice/struct_strings/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/slice/struct_strings/types.go deleted file mode 100644 index 25fd4645e..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/slice/struct_strings/types.go +++ /dev/null @@ -1,9 +0,0 @@ -package test - -type typeForTest struct { - F []struct { - F1 string - F2 string - F3 string - } -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/string/types.go deleted file mode 100644 index a4356570e..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/string/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeForTest struct { - F string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/string_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/string_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/string_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/string_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/string_alias/types.go deleted file mode 100644 index e4e785abc..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/string_alias/types.go +++ /dev/null @@ -1,7 +0,0 @@ -package test - -type typeA string - -type typeForTest struct { - F typeA -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/strings/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/strings/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/strings/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/strings/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/strings/types.go deleted file mode 100644 index fd978caf3..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/strings/types.go +++ /dev/null @@ -1,7 +0,0 @@ -package test - -type typeForTest struct { - F1 string - F2 string - F3 string -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/strings_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/strings_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/strings_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/strings_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/strings_alias/types.go deleted file mode 100644 index e33976674..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/strings_alias/types.go +++ /dev/null @@ -1,9 +0,0 @@ -package test - -type typeA string - -type typeForTest struct { - F1 typeA - F2 typeA - F3 typeA -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/struct/empties/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/struct/empties/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/struct/empties/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/struct/empties/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/struct/empties/types.go deleted file mode 100644 index 7eeb53dd0..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/struct/empties/types.go +++ /dev/null @@ -1,7 +0,0 @@ -package test - -type typeForTest struct { - F1 struct{} - F2 struct{} - F3 struct{} -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/struct/empty/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/struct/empty/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/struct/empty/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/struct/empty/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/struct/empty/types.go deleted file mode 100644 index 319f1e413..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/struct/empty/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeForTest struct { - F struct{} -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/struct/empty_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/struct/empty_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/struct/empty_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/struct/empty_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/struct/empty_alias/types.go deleted file mode 100644 index ee8002ebf..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/struct/empty_alias/types.go +++ /dev/null @@ -1,7 +0,0 @@ -package test - -type typeA struct{} - -type typeForTest struct { - F typeA -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/struct/float32s/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/struct/float32s/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/struct/float32s/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/struct/float32s/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/struct/float32s/types.go deleted file mode 100644 index 5ee59c423..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/struct/float32s/types.go +++ /dev/null @@ -1,9 +0,0 @@ -package test - -type typeForTest struct { - F struct { - F1 float32 - F2 float32 - F3 float32 - } -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/struct/float64/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/struct/float64/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/struct/float64/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/struct/float64/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/struct/float64/types.go deleted file mode 100644 index e7e46395d..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/struct/float64/types.go +++ /dev/null @@ -1,7 +0,0 @@ -package test - -type typeForTest struct { - F struct { - F float32 - } -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/struct/float64_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/struct/float64_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/struct/float64_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/struct/float64_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/struct/float64_alias/types.go deleted file mode 100644 index 8c3842430..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/struct/float64_alias/types.go +++ /dev/null @@ -1,9 +0,0 @@ -package test - -type typeA struct { - F float64 -} - -type typeForTest struct { - F typeA -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/struct/int32s/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/struct/int32s/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/struct/int32s/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/struct/int32s/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/struct/int32s/types.go deleted file mode 100644 index 8fe6faf97..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/struct/int32s/types.go +++ /dev/null @@ -1,9 +0,0 @@ -package test - -type typeForTest struct { - F struct { - F1 int32 - F2 int32 - F3 int32 - } -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/struct/strings/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/struct/strings/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/struct/strings/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/struct/strings/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/struct/strings/types.go deleted file mode 100644 index a3e403a8e..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/struct/strings/types.go +++ /dev/null @@ -1,9 +0,0 @@ -package test - -type typeForTest struct { - F struct { - F1 string - F2 string - F3 string - } -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/struct/strings_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct/struct/strings_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/struct/strings_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct/struct/strings_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/struct/struct/strings_alias/types.go deleted file mode 100644 index 6468df314..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct/struct/strings_alias/types.go +++ /dev/null @@ -1,13 +0,0 @@ -package test - -type typeS string - -type typeA struct { - F1 typeS - F2 typeS - F3 typeS -} - -type typeForTest struct { - F typeA -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/fieldname/embedded/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/fieldname/embedded/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/fieldname/embedded/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/fieldname/embedded/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/fieldname/embedded/types.go deleted file mode 100644 index ec596be31..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/fieldname/embedded/types.go +++ /dev/null @@ -1,40 +0,0 @@ -package test - -// S1 TEST ONLY -type S1 struct { - S1F string -} - -// S2 TEST ONLY -type S2 struct { - S2F string -} - -// S3 TEST ONLY -type S3 struct { - S3F string -} - -// S4 TEST ONLY -type S4 struct { - S4F string -} - -// S5 TEST ONLY -type S5 struct { - S5F string -} - -// S6 TEST ONLY -type S6 struct { - S6F string -} - -type typeForTest struct { - S1 `json:"F1"` - S2 `json:"f2"` - S3 `json:"-"` - S4 `json:"-,"` - S5 `json:","` - S6 `json:""` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/fieldname/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/fieldname/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/fieldname/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/fieldname/string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/fieldname/string/types.go deleted file mode 100644 index b279bac62..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/fieldname/string/types.go +++ /dev/null @@ -1,16 +0,0 @@ -package test - -// E TEST ONLY -type E struct { - E1 string -} - -type typeForTest struct { - F1 string `json:"F1"` - F2 string `json:"f2"` - F3 string `json:"-"` - F4 string `json:"-,"` - F5 string `json:","` - F6 string `json:""` - E `json:"e"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/fieldname/struct/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/fieldname/struct/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/fieldname/struct/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/fieldname/struct/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/fieldname/struct/types.go deleted file mode 100644 index fb7d3e56f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/fieldname/struct/types.go +++ /dev/null @@ -1,40 +0,0 @@ -package test - -// S1 TEST ONLY -type S1 struct { - S1F string -} - -// S2 TEST ONLY -type S2 struct { - S2F string -} - -// S3 TEST ONLY -type S3 struct { - S3F string -} - -// S4 TEST ONLY -type S4 struct { - S4F string -} - -// S5 TEST ONLY -type S5 struct { - S5F string -} - -// S6 TEST ONLY -type S6 struct { - S6F string -} - -type typeForTest struct { - F1 S1 `json:"F1"` - F2 S2 `json:"f2"` - F3 S3 `json:"-"` - F4 S4 `json:"-,"` - F5 S5 `json:","` - F6 S6 `json:""` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/bool/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/bool/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/bool/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/bool/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/bool/types.go deleted file mode 100644 index 90168e710..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/bool/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 bool `json:"F1"` - F2 bool `json:"F2,omitempty"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/embedded/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/embedded/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/embedded/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/embedded/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/embedded/types.go deleted file mode 100644 index e53a6adb4..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/embedded/types.go +++ /dev/null @@ -1,10 +0,0 @@ -package test - -// E TEST ONLY -type E struct { - F string `json:"F,omitempty"` -} - -type typeForTest struct { - E -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/float32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/float32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/float32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/float32/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/float32/types.go deleted file mode 100644 index 021851d99..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/float32/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 float32 `json:"F1"` - F2 float32 `json:"F2,omitempty"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/int32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/int32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/int32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/int32/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/int32/types.go deleted file mode 100644 index c0cd68f65..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/int32/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 int32 `json:"F1"` - F2 int32 `json:"F2,omitempty"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/map_string_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/map_string_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/map_string_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/map_string_string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/map_string_string/types.go deleted file mode 100644 index 1039d8bec..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/map_string_string/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 map[string]string `json:"F1"` - F2 map[string]string `json:"F2,omitempty"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_bool/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_bool/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_bool/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_bool/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_bool/types.go deleted file mode 100644 index e3bdac65e..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_bool/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 *bool `json:"F1"` - F2 *bool `json:"F2,omitempty"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_float32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_float32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_float32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_float32/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_float32/types.go deleted file mode 100644 index e722d2cbf..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_float32/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 *float32 `json:"F1"` - F2 *float32 `json:"F2,omitempty"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_int32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_int32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_int32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_int32/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_int32/types.go deleted file mode 100644 index d9b9ff4e8..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_int32/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 *int32 `json:"F1"` - F2 *int32 `json:"F2,omitempty"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_map_string_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_map_string_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_map_string_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_map_string_string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_map_string_string/types.go deleted file mode 100644 index 908f2f55c..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_map_string_string/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 *map[string]string `json:"F1"` - F2 *map[string]string `json:"F2,omitempty"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_slice_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_slice_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_slice_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_slice_string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_slice_string/types.go deleted file mode 100644 index ffd363e52..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_slice_string/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 *[]string `json:"F1"` - F2 *[]string `json:"F2,omitempty"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string/string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string/string/types.go deleted file mode 100644 index f864bce67..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string/string/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 string `json:"F1"` - F2 string `json:"F2,omitempty"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string/types.go deleted file mode 100644 index 5bf9540e5..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 *string `json:"F1"` - F2 *string `json:"F2,omitempty"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string_json_marshal/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string_json_marshal/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string_json_marshal/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string_json_marshal/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string_json_marshal/types.go deleted file mode 100644 index 25077cb36..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string_json_marshal/types.go +++ /dev/null @@ -1,15 +0,0 @@ -package test - -type typeForTest struct { - F *jm `json:"f,omitempty"` -} - -type jm string - -func (t *jm) UnmarshalJSON(b []byte) error { - return nil -} - -func (t jm) MarshalJSON() ([]byte, error) { - return []byte(`""`), nil -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string_text_marshal/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string_text_marshal/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string_text_marshal/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string_text_marshal/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string_text_marshal/types.go deleted file mode 100644 index f604c10b9..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_string_text_marshal/types.go +++ /dev/null @@ -1,15 +0,0 @@ -package test - -type typeForTest struct { - F *tm `json:"f,omitempty"` -} - -type tm string - -func (t *tm) UnmarshalText(b []byte) error { - return nil -} - -func (t tm) MarshalText() ([]byte, error) { - return []byte(`""`), nil -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_struct_json_marshal/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_struct_json_marshal/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_struct_json_marshal/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_struct_json_marshal/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_struct_json_marshal/types.go deleted file mode 100644 index f17277853..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_struct_json_marshal/types.go +++ /dev/null @@ -1,15 +0,0 @@ -package test - -type typeForTest struct { - F *jm `json:"f,omitempty"` -} - -type jm struct{} - -func (t *jm) UnmarshalJSON(b []byte) error { - return nil -} - -func (t jm) MarshalJSON() ([]byte, error) { - return []byte(`""`), nil -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_struct_text_marshal/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_struct_text_marshal/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_struct_text_marshal/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_struct_text_marshal/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_struct_text_marshal/types.go deleted file mode 100644 index c89a3b8a7..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_struct_text_marshal/types.go +++ /dev/null @@ -1,15 +0,0 @@ -package test - -type typeForTest struct { - F *tm `json:"f,omitempty"` -} - -type tm struct{} - -func (t *tm) UnmarshalText(b []byte) error { - return nil -} - -func (t tm) MarshalText() ([]byte, error) { - return []byte(`""`), nil -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_uint32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_uint32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_uint32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_uint32/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_uint32/types.go deleted file mode 100644 index da63009d3..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/ptr_uint32/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 *uint32 `json:"F1"` - F2 *uint32 `json:"F2,omitempty"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/slice_string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/slice_string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/slice_string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/slice_string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/slice_string/types.go deleted file mode 100644 index 743a8a407..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/slice_string/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 []string `json:"F1"` - F2 []string `json:"F2,omitempty"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/string/types.go deleted file mode 100644 index f864bce67..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/string/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 string `json:"F1"` - F2 string `json:"F2,omitempty"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/string_json_marshal/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/string_json_marshal/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/string_json_marshal/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/string_json_marshal/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/string_json_marshal/types.go deleted file mode 100644 index 6a33ddf1f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/string_json_marshal/types.go +++ /dev/null @@ -1,15 +0,0 @@ -package test - -type typeForTest struct { - F jm `json:"f,omitempty"` -} - -type jm string - -func (t *jm) UnmarshalJSON(b []byte) error { - return nil -} - -func (t jm) MarshalJSON() ([]byte, error) { - return []byte(`""`), nil -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/string_text_marshal/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/string_text_marshal/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/string_text_marshal/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/string_text_marshal/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/string_text_marshal/types.go deleted file mode 100644 index 4eb96121e..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/string_text_marshal/types.go +++ /dev/null @@ -1,15 +0,0 @@ -package test - -type typeForTest struct { - F tm `json:"f,omitempty"` -} - -type tm string - -func (t *tm) UnmarshalText(b []byte) error { - return nil -} - -func (t tm) MarshalText() ([]byte, error) { - return []byte(`""`), nil -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/struct/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/struct/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/struct/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/struct/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/struct/types.go deleted file mode 100644 index d3a5b3975..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/struct/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package test - -type typeForTest struct { - F struct{} `json:"f,omitempty"` // omitempty is meaningless here -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/struct_json_marshal/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/struct_json_marshal/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/struct_json_marshal/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/struct_json_marshal/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/struct_json_marshal/types.go deleted file mode 100644 index f6fb4375d..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/struct_json_marshal/types.go +++ /dev/null @@ -1,15 +0,0 @@ -package test - -type typeForTest struct { - F jm `json:"f,omitempty"` -} - -type jm struct{} - -func (t *jm) UnmarshalJSON(b []byte) error { - return nil -} - -func (t jm) MarshalJSON() ([]byte, error) { - return []byte(`""`), nil -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/struct_text_marshal/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/struct_text_marshal/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/struct_text_marshal/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/struct_text_marshal/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/struct_text_marshal/types.go deleted file mode 100644 index 112f14ebf..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/struct_text_marshal/types.go +++ /dev/null @@ -1,15 +0,0 @@ -package test - -type typeForTest struct { - F tm `json:"f,omitempty"` -} - -type tm struct{} - -func (t *tm) UnmarshalText(b []byte) error { - return nil -} - -func (t tm) MarshalText() ([]byte, error) { - return []byte(`""`), nil -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/uint32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/uint32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/uint32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/uint32/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/uint32/types.go deleted file mode 100644 index ec5148077..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/omitempty/uint32/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 uint32 `json:"F1"` - F2 uint32 `json:"F2,omitempty"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/bool/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/bool/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/bool/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/bool/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/bool/types.go deleted file mode 100644 index e2e8595b0..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/bool/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 bool `json:"F1"` - F2 bool `json:"F2,string"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/byte/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/byte/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/byte/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/byte/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/byte/types.go deleted file mode 100644 index 77fbfc67e..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/byte/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 byte `json:"F1"` - F2 byte `json:"F2,string"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/float32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/float32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/float32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/float32/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/float32/types.go deleted file mode 100644 index 51ed9f258..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/float32/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 float32 `json:"F1"` - F2 float32 `json:"F2,string"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/float64/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/float64/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/float64/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/float64/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/float64/types.go deleted file mode 100644 index 2d5860299..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/float64/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 float64 `json:"F1"` - F2 float64 `json:"F2,string"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/int16/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/int16/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/int16/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/int16/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/int16/types.go deleted file mode 100644 index 717aa63e3..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/int16/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 int16 `json:"F1"` - F2 int16 `json:"F2,string"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/int32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/int32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/int32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/int32/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/int32/types.go deleted file mode 100644 index 2abeb7f08..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/int32/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 int32 `json:"F1"` - F2 int32 `json:"F2,string"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/int8/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/int8/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/int8/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/int8/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/int8/types.go deleted file mode 100644 index aee47fb46..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/int8/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 int8 `json:"F1"` - F2 int8 `json:"F2,string"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/string/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/string/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/string/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/string/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/string/types.go deleted file mode 100644 index 49d2ca7cc..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/string/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 string `json:"F1"` - F2 string `json:"F2,string"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/uint16/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/uint16/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/uint16/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/uint16/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/uint16/types.go deleted file mode 100644 index f14736964..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/uint16/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 uint16 `json:"F1"` - F2 uint16 `json:"F2,string"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/uint32/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/uint32/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/uint32/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/uint32/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/uint32/types.go deleted file mode 100644 index 39d3a8f36..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/uint32/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 uint32 `json:"F1"` - F2 uint32 `json:"F2,string"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/uint8/json_test.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/uint8/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/uint8/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/uint8/types.go b/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/uint8/types.go deleted file mode 100644 index f3653ae70..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/struct_tags/string/uint8/types.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -type typeForTest struct { - F1 uint8 `json:"F1"` - F2 uint8 `json:"F2,string"` -} diff --git a/vendor/github.com/json-iterator/go/output_tests/text_marshal/string_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/text_marshal/string_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/text_marshal/string_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/text_marshal/string_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/text_marshal/string_alias/types.go deleted file mode 100644 index 0dd9ba9f8..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/text_marshal/string_alias/types.go +++ /dev/null @@ -1,50 +0,0 @@ -package test - -import ( - "bytes" - "encoding" - "encoding/base64" - "strings" -) - -type marshalerForTest string - -func encode(str string) string { - buf := bytes.Buffer{} - b64 := base64.NewEncoder(base64.StdEncoding, &buf) - if _, err := b64.Write([]byte(str)); err != nil { - panic(err) - } - if err := b64.Close(); err != nil { - panic(err) - } - return buf.String() -} - -func decode(str string) string { - if len(str) == 0 { - return "" - } - b64 := base64.NewDecoder(base64.StdEncoding, strings.NewReader(str)) - bs := make([]byte, len(str)) - if n, err := b64.Read(bs); err != nil { - panic(err) - } else { - bs = bs[:n] - } - return string(bs) -} - -func (m marshalerForTest) MarshalText() ([]byte, error) { - return []byte(`MANUAL__` + encode(string(m))), nil -} - -func (m *marshalerForTest) UnmarshalText(text []byte) error { - *m = marshalerForTest(decode(strings.TrimPrefix(string(text), "MANUAL__"))) - return nil -} - -var _ encoding.TextMarshaler = *new(marshalerForTest) -var _ encoding.TextUnmarshaler = new(marshalerForTest) - -type typeForTest marshalerForTest diff --git a/vendor/github.com/json-iterator/go/output_tests/text_marshal/struct/json_test.go b/vendor/github.com/json-iterator/go/output_tests/text_marshal/struct/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/text_marshal/struct/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/text_marshal/struct/types.go b/vendor/github.com/json-iterator/go/output_tests/text_marshal/struct/types.go deleted file mode 100644 index 482f41f1a..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/text_marshal/struct/types.go +++ /dev/null @@ -1,52 +0,0 @@ -package test - -import ( - "bytes" - "encoding" - "encoding/base64" - "strings" -) - -type marshalerForTest struct { - X string -} - -func encode(str string) string { - buf := bytes.Buffer{} - b64 := base64.NewEncoder(base64.StdEncoding, &buf) - if _, err := b64.Write([]byte(str)); err != nil { - panic(err) - } - if err := b64.Close(); err != nil { - panic(err) - } - return buf.String() -} - -func decode(str string) string { - if len(str) == 0 { - return "" - } - b64 := base64.NewDecoder(base64.StdEncoding, strings.NewReader(str)) - bs := make([]byte, len(str)) - if n, err := b64.Read(bs); err != nil { - panic(err) - } else { - bs = bs[:n] - } - return string(bs) -} - -func (m marshalerForTest) MarshalText() ([]byte, error) { - return []byte(`MANUAL__` + encode(m.X)), nil -} - -func (m *marshalerForTest) UnmarshalText(text []byte) error { - m.X = decode(strings.TrimPrefix(string(text), "MANUAL__")) - return nil -} - -var _ encoding.TextMarshaler = marshalerForTest{} -var _ encoding.TextUnmarshaler = &marshalerForTest{} - -type typeForTest marshalerForTest diff --git a/vendor/github.com/json-iterator/go/output_tests/text_marshal/struct_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/text_marshal/struct_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/text_marshal/struct_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/text_marshal/struct_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/text_marshal/struct_alias/types.go deleted file mode 100644 index 9cf60302a..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/text_marshal/struct_alias/types.go +++ /dev/null @@ -1,54 +0,0 @@ -package test - -import ( - "bytes" - "encoding" - "encoding/base64" - "strings" -) - -type marshalerForTest struct { - X string -} - -func encode(str string) string { - buf := bytes.Buffer{} - b64 := base64.NewEncoder(base64.StdEncoding, &buf) - if _, err := b64.Write([]byte(str)); err != nil { - panic(err) - } - if err := b64.Close(); err != nil { - panic(err) - } - return buf.String() -} - -func decode(str string) string { - if len(str) == 0 { - return "" - } - b64 := base64.NewDecoder(base64.StdEncoding, strings.NewReader(str)) - bs := make([]byte, len(str)) - if n, err := b64.Read(bs); err != nil { - panic(err) - } else { - bs = bs[:n] - } - return string(bs) -} - -func (m marshalerForTest) MarshalText() ([]byte, error) { - return []byte(`MANUAL__` + encode(m.X)), nil -} - -func (m *marshalerForTest) UnmarshalText(text []byte) error { - m.X = decode(strings.TrimPrefix(string(text), "MANUAL__")) - return nil -} - -var _ encoding.TextMarshaler = marshalerForTest{} -var _ encoding.TextUnmarshaler = &marshalerForTest{} - -type marshalerAlias marshalerForTest - -type typeForTest marshalerAlias diff --git a/vendor/github.com/json-iterator/go/output_tests/text_marshal/struct_field/json_test.go b/vendor/github.com/json-iterator/go/output_tests/text_marshal/struct_field/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/text_marshal/struct_field/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/text_marshal/struct_field/types.go b/vendor/github.com/json-iterator/go/output_tests/text_marshal/struct_field/types.go deleted file mode 100644 index 371aacbc8..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/text_marshal/struct_field/types.go +++ /dev/null @@ -1,56 +0,0 @@ -package test - -import ( - "bytes" - "encoding" - "encoding/base64" - "strings" -) - -type marshalerForTest struct { - X string -} - -func encode(str string) string { - buf := bytes.Buffer{} - b64 := base64.NewEncoder(base64.StdEncoding, &buf) - if _, err := b64.Write([]byte(str)); err != nil { - panic(err) - } - if err := b64.Close(); err != nil { - panic(err) - } - return buf.String() -} - -func decode(str string) string { - if len(str) == 0 { - return "" - } - b64 := base64.NewDecoder(base64.StdEncoding, strings.NewReader(str)) - bs := make([]byte, len(str)) - if n, err := b64.Read(bs); err != nil { - panic(err) - } else { - bs = bs[:n] - } - return string(bs) -} - -func (m marshalerForTest) MarshalText() ([]byte, error) { - return []byte(`MANUAL__` + encode(m.X)), nil -} - -func (m *marshalerForTest) UnmarshalText(text []byte) error { - m.X = decode(strings.TrimPrefix(string(text), "MANUAL__")) - return nil -} - -var _ encoding.TextMarshaler = marshalerForTest{} -var _ encoding.TextUnmarshaler = &marshalerForTest{} - -type typeForTest struct { - S string - M marshalerForTest - I int8 -} diff --git a/vendor/github.com/json-iterator/go/output_tests/text_marshal/struct_field_alias/json_test.go b/vendor/github.com/json-iterator/go/output_tests/text_marshal/struct_field_alias/json_test.go deleted file mode 100644 index 3c35ffe5f..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/text_marshal/struct_field_alias/json_test.go +++ /dev/null @@ -1,152 +0,0 @@ -package test - -import ( - "bytes" - "encoding/json" - "fmt" - "strings" - "testing" - - "github.com/davecgh/go-spew/spew" - fuzz "github.com/google/gofuzz" - jsoniter "github.com/json-iterator/go" -) - -func Test_Roundtrip(t *testing.T) { - fz := fuzz.New().MaxDepth(10).NilChance(0.3) - for i := 0; i < 100; i++ { - var before typeForTest - fz.Fuzz(&before) - - jbStd, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with stdlib: %v", err) - } - if len(strings.TrimSpace(string(jbStd))) == 0 { - t.Fatal("stdlib marshal produced empty result and no error") - } - jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal with jsoniter: %v", err) - } - if len(strings.TrimSpace(string(jbIter))) == 0 { - t.Fatal("jsoniter marshal produced empty result and no error") - } - if string(jbStd) != string(jbIter) { - t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", - indent(jbStd, " "), indent(jbIter, " "), dump(before)) - } - - var afterStd typeForTest - err = json.Unmarshal(jbIter, &afterStd) - if err != nil { - t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - var afterIter typeForTest - err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, &afterIter) - if err != nil { - t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", - err, indent(jbIter, " ")) - } - if fingerprint(afterStd) != fingerprint(afterIter) { - t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", - dump(afterStd), dump(afterIter), indent(jbIter, " ")) - } - } -} - -const indentStr = "> " - -func fingerprint(obj interface{}) string { - c := spew.ConfigState{ - SortKeys: true, - SpewKeys: true, - } - return c.Sprintf("%v", obj) -} - -func dump(obj interface{}) string { - cfg := spew.ConfigState{ - Indent: indentStr, - } - return cfg.Sdump(obj) -} - -func indent(src []byte, prefix string) string { - var buf bytes.Buffer - err := json.Indent(&buf, src, prefix, indentStr) - if err != nil { - return fmt.Sprintf("!!! %v", err) - } - return buf.String() -} - -func benchmarkMarshal(t *testing.B, name string, fn func(interface{}) ([]byte, error)) { - t.ReportAllocs() - t.ResetTimer() - - var obj typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&obj) - for i := 0; i < t.N; i++ { - jb, err := fn(obj) - if err != nil { - t.Fatalf("%s failed to marshal:\n input: %s\n error: %v", name, dump(obj), err) - } - _ = jb - } -} - -func benchmarkUnmarshal(t *testing.B, name string, fn func(data []byte, v interface{}) error) { - t.ReportAllocs() - t.ResetTimer() - - var before typeForTest - fz := fuzz.NewWithSeed(0).MaxDepth(10).NilChance(0.3) - fz.Fuzz(&before) - jb, err := json.Marshal(before) - if err != nil { - t.Fatalf("failed to marshal: %v", err) - } - - for i := 0; i < t.N; i++ { - var after typeForTest - err = fn(jb, &after) - if err != nil { - t.Fatalf("%s failed to unmarshal:\n input: %q\n error: %v", name, string(jb), err) - } - } -} - -func BenchmarkStandardMarshal(t *testing.B) { - benchmarkMarshal(t, "stdlib", json.Marshal) -} - -func BenchmarkStandardUnmarshal(t *testing.B) { - benchmarkUnmarshal(t, "stdlib", json.Unmarshal) -} - -func BenchmarkJSONIterMarshalFastest(t *testing.B) { - benchmarkMarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Marshal) -} - -func BenchmarkJSONIterUnmarshalFastest(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-fastest", jsoniter.ConfigFastest.Unmarshal) -} - -func BenchmarkJSONIterMarshalDefault(t *testing.B) { - benchmarkMarshal(t, "jsoniter-default", jsoniter.Marshal) -} - -func BenchmarkJSONIterUnmarshalDefault(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-default", jsoniter.Unmarshal) -} - -func BenchmarkJSONIterMarshalCompatible(t *testing.B) { - benchmarkMarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Marshal) -} - -func BenchmarkJSONIterUnmarshalCompatible(t *testing.B) { - benchmarkUnmarshal(t, "jsoniter-compat", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) -} diff --git a/vendor/github.com/json-iterator/go/output_tests/text_marshal/struct_field_alias/types.go b/vendor/github.com/json-iterator/go/output_tests/text_marshal/struct_field_alias/types.go deleted file mode 100644 index fbfb758df..000000000 --- a/vendor/github.com/json-iterator/go/output_tests/text_marshal/struct_field_alias/types.go +++ /dev/null @@ -1,58 +0,0 @@ -package test - -import ( - "bytes" - "encoding" - "encoding/base64" - "strings" -) - -type marshalerForTest struct { - X string -} - -func encode(str string) string { - buf := bytes.Buffer{} - b64 := base64.NewEncoder(base64.StdEncoding, &buf) - if _, err := b64.Write([]byte(str)); err != nil { - panic(err) - } - if err := b64.Close(); err != nil { - panic(err) - } - return buf.String() -} - -func decode(str string) string { - if len(str) == 0 { - return "" - } - b64 := base64.NewDecoder(base64.StdEncoding, strings.NewReader(str)) - bs := make([]byte, len(str)) - if n, err := b64.Read(bs); err != nil { - panic(err) - } else { - bs = bs[:n] - } - return string(bs) -} - -func (m marshalerForTest) MarshalText() ([]byte, error) { - return []byte(`MANUAL__` + encode(m.X)), nil -} - -func (m *marshalerForTest) UnmarshalText(text []byte) error { - m.X = decode(strings.TrimPrefix(string(text), "MANUAL__")) - return nil -} - -var _ encoding.TextMarshaler = marshalerForTest{} -var _ encoding.TextUnmarshaler = &marshalerForTest{} - -type marshalerAlias marshalerForTest - -type typeForTest struct { - S string - M marshalerAlias - I int8 -} diff --git a/vendor/github.com/json-iterator/go/feature_pool.go b/vendor/github.com/json-iterator/go/pool.go similarity index 64% rename from vendor/github.com/json-iterator/go/feature_pool.go rename to vendor/github.com/json-iterator/go/pool.go index 52d38e685..735062684 100644 --- a/vendor/github.com/json-iterator/go/feature_pool.go +++ b/vendor/github.com/json-iterator/go/pool.go @@ -17,43 +17,25 @@ type StreamPool interface { } func (cfg *frozenConfig) BorrowStream(writer io.Writer) *Stream { - select { - case stream := <-cfg.streamPool: - stream.Reset(writer) - return stream - default: - return NewStream(cfg, writer, 512) - } + stream := cfg.streamPool.Get().(*Stream) + stream.Reset(writer) + return stream } func (cfg *frozenConfig) ReturnStream(stream *Stream) { stream.Error = nil stream.Attachment = nil - select { - case cfg.streamPool <- stream: - return - default: - return - } + cfg.streamPool.Put(stream) } func (cfg *frozenConfig) BorrowIterator(data []byte) *Iterator { - select { - case iter := <-cfg.iteratorPool: - iter.ResetBytes(data) - return iter - default: - return ParseBytes(cfg, data) - } + iter := cfg.iteratorPool.Get().(*Iterator) + iter.ResetBytes(data) + return iter } func (cfg *frozenConfig) ReturnIterator(iter *Iterator) { iter.Error = nil iter.Attachment = nil - select { - case cfg.iteratorPool <- iter: - return - default: - return - } + cfg.iteratorPool.Put(iter) } diff --git a/vendor/github.com/json-iterator/go/reflect.go b/vendor/github.com/json-iterator/go/reflect.go new file mode 100644 index 000000000..5c7d3a8a0 --- /dev/null +++ b/vendor/github.com/json-iterator/go/reflect.go @@ -0,0 +1,321 @@ +package jsoniter + +import ( + "fmt" + "github.com/modern-go/reflect2" + "reflect" + "unsafe" +) + +// ValDecoder is an internal type registered to cache as needed. +// Don't confuse jsoniter.ValDecoder with json.Decoder. +// For json.Decoder's adapter, refer to jsoniter.AdapterDecoder(todo link). +// +// Reflection on type to create decoders, which is then cached +// Reflection on value is avoided as we can, as the reflect.Value itself will allocate, with following exceptions +// 1. create instance of new value, for example *int will need a int to be allocated +// 2. append to slice, if the existing cap is not enough, allocate will be done using Reflect.New +// 3. assignment to map, both key and value will be reflect.Value +// For a simple struct binding, it will be reflect.Value free and allocation free +type ValDecoder interface { + Decode(ptr unsafe.Pointer, iter *Iterator) +} + +// ValEncoder is an internal type registered to cache as needed. +// Don't confuse jsoniter.ValEncoder with json.Encoder. +// For json.Encoder's adapter, refer to jsoniter.AdapterEncoder(todo godoc link). +type ValEncoder interface { + IsEmpty(ptr unsafe.Pointer) bool + Encode(ptr unsafe.Pointer, stream *Stream) +} + +type checkIsEmpty interface { + IsEmpty(ptr unsafe.Pointer) bool +} + +type ctx struct { + *frozenConfig + prefix string + encoders map[reflect2.Type]ValEncoder + decoders map[reflect2.Type]ValDecoder +} + +func (b *ctx) append(prefix string) *ctx { + return &ctx{ + frozenConfig: b.frozenConfig, + prefix: b.prefix + " " + prefix, + encoders: b.encoders, + decoders: b.decoders, + } +} + +// ReadVal copy the underlying JSON into go interface, same as json.Unmarshal +func (iter *Iterator) ReadVal(obj interface{}) { + cacheKey := reflect2.RTypeOf(obj) + decoder := iter.cfg.getDecoderFromCache(cacheKey) + if decoder == nil { + typ := reflect2.TypeOf(obj) + if typ.Kind() != reflect.Ptr { + iter.ReportError("ReadVal", "can only unmarshal into pointer") + return + } + decoder = iter.cfg.DecoderOf(typ) + } + ptr := reflect2.PtrOf(obj) + if ptr == nil { + iter.ReportError("ReadVal", "can not read into nil pointer") + return + } + decoder.Decode(ptr, iter) +} + +// WriteVal copy the go interface into underlying JSON, same as json.Marshal +func (stream *Stream) WriteVal(val interface{}) { + if nil == val { + stream.WriteNil() + return + } + cacheKey := reflect2.RTypeOf(val) + encoder := stream.cfg.getEncoderFromCache(cacheKey) + if encoder == nil { + typ := reflect2.TypeOf(val) + encoder = stream.cfg.EncoderOf(typ) + } + encoder.Encode(reflect2.PtrOf(val), stream) +} + +func (cfg *frozenConfig) DecoderOf(typ reflect2.Type) ValDecoder { + cacheKey := typ.RType() + decoder := cfg.getDecoderFromCache(cacheKey) + if decoder != nil { + return decoder + } + ctx := &ctx{ + frozenConfig: cfg, + prefix: "", + decoders: map[reflect2.Type]ValDecoder{}, + encoders: map[reflect2.Type]ValEncoder{}, + } + ptrType := typ.(*reflect2.UnsafePtrType) + decoder = decoderOfType(ctx, ptrType.Elem()) + cfg.addDecoderToCache(cacheKey, decoder) + return decoder +} + +func decoderOfType(ctx *ctx, typ reflect2.Type) ValDecoder { + decoder := getTypeDecoderFromExtension(ctx, typ) + if decoder != nil { + return decoder + } + decoder = createDecoderOfType(ctx, typ) + for _, extension := range extensions { + decoder = extension.DecorateDecoder(typ, decoder) + } + for _, extension := range ctx.extensions { + decoder = extension.DecorateDecoder(typ, decoder) + } + return decoder +} + +func createDecoderOfType(ctx *ctx, typ reflect2.Type) ValDecoder { + decoder := ctx.decoders[typ] + if decoder != nil { + return decoder + } + placeholder := &placeholderDecoder{} + ctx.decoders[typ] = placeholder + decoder = _createDecoderOfType(ctx, typ) + placeholder.decoder = decoder + return decoder +} + +func _createDecoderOfType(ctx *ctx, typ reflect2.Type) ValDecoder { + decoder := createDecoderOfJsonRawMessage(ctx, typ) + if decoder != nil { + return decoder + } + decoder = createDecoderOfJsonNumber(ctx, typ) + if decoder != nil { + return decoder + } + decoder = createDecoderOfMarshaler(ctx, typ) + if decoder != nil { + return decoder + } + decoder = createDecoderOfAny(ctx, typ) + if decoder != nil { + return decoder + } + decoder = createDecoderOfNative(ctx, typ) + if decoder != nil { + return decoder + } + switch typ.Kind() { + case reflect.Interface: + ifaceType, isIFace := typ.(*reflect2.UnsafeIFaceType) + if isIFace { + return &ifaceDecoder{valType: ifaceType} + } + return &efaceDecoder{} + case reflect.Struct: + return decoderOfStruct(ctx, typ) + case reflect.Array: + return decoderOfArray(ctx, typ) + case reflect.Slice: + return decoderOfSlice(ctx, typ) + case reflect.Map: + return decoderOfMap(ctx, typ) + case reflect.Ptr: + return decoderOfOptional(ctx, typ) + default: + return &lazyErrorDecoder{err: fmt.Errorf("%s%s is unsupported type", ctx.prefix, typ.String())} + } +} + +func (cfg *frozenConfig) EncoderOf(typ reflect2.Type) ValEncoder { + cacheKey := typ.RType() + encoder := cfg.getEncoderFromCache(cacheKey) + if encoder != nil { + return encoder + } + ctx := &ctx{ + frozenConfig: cfg, + prefix: "", + decoders: map[reflect2.Type]ValDecoder{}, + encoders: map[reflect2.Type]ValEncoder{}, + } + encoder = encoderOfType(ctx, typ) + if typ.LikePtr() { + encoder = &onePtrEncoder{encoder} + } + cfg.addEncoderToCache(cacheKey, encoder) + return encoder +} + +type onePtrEncoder struct { + encoder ValEncoder +} + +func (encoder *onePtrEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.encoder.IsEmpty(unsafe.Pointer(&ptr)) +} + +func (encoder *onePtrEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + encoder.encoder.Encode(unsafe.Pointer(&ptr), stream) +} + +func encoderOfType(ctx *ctx, typ reflect2.Type) ValEncoder { + encoder := getTypeEncoderFromExtension(ctx, typ) + if encoder != nil { + return encoder + } + encoder = createEncoderOfType(ctx, typ) + for _, extension := range extensions { + encoder = extension.DecorateEncoder(typ, encoder) + } + for _, extension := range ctx.extensions { + encoder = extension.DecorateEncoder(typ, encoder) + } + return encoder +} + +func createEncoderOfType(ctx *ctx, typ reflect2.Type) ValEncoder { + encoder := ctx.encoders[typ] + if encoder != nil { + return encoder + } + placeholder := &placeholderEncoder{} + ctx.encoders[typ] = placeholder + encoder = _createEncoderOfType(ctx, typ) + placeholder.encoder = encoder + return encoder +} +func _createEncoderOfType(ctx *ctx, typ reflect2.Type) ValEncoder { + encoder := createEncoderOfJsonRawMessage(ctx, typ) + if encoder != nil { + return encoder + } + encoder = createEncoderOfJsonNumber(ctx, typ) + if encoder != nil { + return encoder + } + encoder = createEncoderOfMarshaler(ctx, typ) + if encoder != nil { + return encoder + } + encoder = createEncoderOfAny(ctx, typ) + if encoder != nil { + return encoder + } + encoder = createEncoderOfNative(ctx, typ) + if encoder != nil { + return encoder + } + kind := typ.Kind() + switch kind { + case reflect.Interface: + return &dynamicEncoder{typ} + case reflect.Struct: + return encoderOfStruct(ctx, typ) + case reflect.Array: + return encoderOfArray(ctx, typ) + case reflect.Slice: + return encoderOfSlice(ctx, typ) + case reflect.Map: + return encoderOfMap(ctx, typ) + case reflect.Ptr: + return encoderOfOptional(ctx, typ) + default: + return &lazyErrorEncoder{err: fmt.Errorf("%s%s is unsupported type", ctx.prefix, typ.String())} + } +} + +type lazyErrorDecoder struct { + err error +} + +func (decoder *lazyErrorDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + if iter.WhatIsNext() != NilValue { + if iter.Error == nil { + iter.Error = decoder.err + } + } else { + iter.Skip() + } +} + +type lazyErrorEncoder struct { + err error +} + +func (encoder *lazyErrorEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + if ptr == nil { + stream.WriteNil() + } else if stream.Error == nil { + stream.Error = encoder.err + } +} + +func (encoder *lazyErrorEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return false +} + +type placeholderDecoder struct { + decoder ValDecoder +} + +func (decoder *placeholderDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + decoder.decoder.Decode(ptr, iter) +} + +type placeholderEncoder struct { + encoder ValEncoder +} + +func (encoder *placeholderEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + encoder.encoder.Encode(ptr, stream) +} + +func (encoder *placeholderEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.encoder.IsEmpty(ptr) +} diff --git a/vendor/github.com/json-iterator/go/reflect_array.go b/vendor/github.com/json-iterator/go/reflect_array.go new file mode 100644 index 000000000..13a0b7b08 --- /dev/null +++ b/vendor/github.com/json-iterator/go/reflect_array.go @@ -0,0 +1,104 @@ +package jsoniter + +import ( + "fmt" + "github.com/modern-go/reflect2" + "io" + "unsafe" +) + +func decoderOfArray(ctx *ctx, typ reflect2.Type) ValDecoder { + arrayType := typ.(*reflect2.UnsafeArrayType) + decoder := decoderOfType(ctx.append("[arrayElem]"), arrayType.Elem()) + return &arrayDecoder{arrayType, decoder} +} + +func encoderOfArray(ctx *ctx, typ reflect2.Type) ValEncoder { + arrayType := typ.(*reflect2.UnsafeArrayType) + if arrayType.Len() == 0 { + return emptyArrayEncoder{} + } + encoder := encoderOfType(ctx.append("[arrayElem]"), arrayType.Elem()) + return &arrayEncoder{arrayType, encoder} +} + +type emptyArrayEncoder struct{} + +func (encoder emptyArrayEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteEmptyArray() +} + +func (encoder emptyArrayEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return true +} + +type arrayEncoder struct { + arrayType *reflect2.UnsafeArrayType + elemEncoder ValEncoder +} + +func (encoder *arrayEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteArrayStart() + elemPtr := unsafe.Pointer(ptr) + encoder.elemEncoder.Encode(elemPtr, stream) + for i := 1; i < encoder.arrayType.Len(); i++ { + stream.WriteMore() + elemPtr = encoder.arrayType.UnsafeGetIndex(ptr, i) + encoder.elemEncoder.Encode(elemPtr, stream) + } + stream.WriteArrayEnd() + if stream.Error != nil && stream.Error != io.EOF { + stream.Error = fmt.Errorf("%v: %s", encoder.arrayType, stream.Error.Error()) + } +} + +func (encoder *arrayEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return false +} + +type arrayDecoder struct { + arrayType *reflect2.UnsafeArrayType + elemDecoder ValDecoder +} + +func (decoder *arrayDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + decoder.doDecode(ptr, iter) + if iter.Error != nil && iter.Error != io.EOF { + iter.Error = fmt.Errorf("%v: %s", decoder.arrayType, iter.Error.Error()) + } +} + +func (decoder *arrayDecoder) doDecode(ptr unsafe.Pointer, iter *Iterator) { + c := iter.nextToken() + arrayType := decoder.arrayType + if c == 'n' { + iter.skipThreeBytes('u', 'l', 'l') + return + } + if c != '[' { + iter.ReportError("decode array", "expect [ or n, but found "+string([]byte{c})) + return + } + c = iter.nextToken() + if c == ']' { + return + } + iter.unreadByte() + elemPtr := arrayType.UnsafeGetIndex(ptr, 0) + decoder.elemDecoder.Decode(elemPtr, iter) + length := 1 + for c = iter.nextToken(); c == ','; c = iter.nextToken() { + if length >= arrayType.Len() { + iter.Skip() + continue + } + idx := length + length += 1 + elemPtr = arrayType.UnsafeGetIndex(ptr, idx) + decoder.elemDecoder.Decode(elemPtr, iter) + } + if c != ']' { + iter.ReportError("decode array", "expect ], but found "+string([]byte{c})) + return + } +} diff --git a/vendor/github.com/json-iterator/go/reflect_dynamic.go b/vendor/github.com/json-iterator/go/reflect_dynamic.go new file mode 100644 index 000000000..8b6bc8b43 --- /dev/null +++ b/vendor/github.com/json-iterator/go/reflect_dynamic.go @@ -0,0 +1,70 @@ +package jsoniter + +import ( + "github.com/modern-go/reflect2" + "reflect" + "unsafe" +) + +type dynamicEncoder struct { + valType reflect2.Type +} + +func (encoder *dynamicEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + obj := encoder.valType.UnsafeIndirect(ptr) + stream.WriteVal(obj) +} + +func (encoder *dynamicEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.valType.UnsafeIndirect(ptr) == nil +} + +type efaceDecoder struct { +} + +func (decoder *efaceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + pObj := (*interface{})(ptr) + obj := *pObj + if obj == nil { + *pObj = iter.Read() + return + } + typ := reflect2.TypeOf(obj) + if typ.Kind() != reflect.Ptr { + *pObj = iter.Read() + return + } + ptrType := typ.(*reflect2.UnsafePtrType) + ptrElemType := ptrType.Elem() + if iter.WhatIsNext() == NilValue { + if ptrElemType.Kind() != reflect.Ptr { + iter.skipFourBytes('n', 'u', 'l', 'l') + *pObj = nil + return + } + } + if reflect2.IsNil(obj) { + obj := ptrElemType.New() + iter.ReadVal(obj) + *pObj = obj + return + } + iter.ReadVal(obj) +} + +type ifaceDecoder struct { + valType *reflect2.UnsafeIFaceType +} + +func (decoder *ifaceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + if iter.ReadNil() { + decoder.valType.UnsafeSet(ptr, decoder.valType.UnsafeNew()) + return + } + obj := decoder.valType.UnsafeIndirect(ptr) + if reflect2.IsNil(obj) { + iter.ReportError("decode non empty interface", "can not unmarshal into nil") + return + } + iter.ReadVal(obj) +} diff --git a/vendor/github.com/json-iterator/go/feature_reflect_extension.go b/vendor/github.com/json-iterator/go/reflect_extension.go similarity index 57% rename from vendor/github.com/json-iterator/go/feature_reflect_extension.go rename to vendor/github.com/json-iterator/go/reflect_extension.go index 66083a521..917bbe84e 100644 --- a/vendor/github.com/json-iterator/go/feature_reflect_extension.go +++ b/vendor/github.com/json-iterator/go/reflect_extension.go @@ -2,6 +2,7 @@ package jsoniter import ( "fmt" + "github.com/modern-go/reflect2" "reflect" "sort" "strings" @@ -17,17 +18,15 @@ var extensions = []Extension{} // StructDescriptor describe how should we encode/decode the struct type StructDescriptor struct { - onePtrEmbedded bool - onePtrOptimization bool - Type reflect.Type - Fields []*Binding + Type reflect2.Type + Fields []*Binding } // GetField get one field from the descriptor by its name. // Can not use map here to keep field orders. func (structDescriptor *StructDescriptor) GetField(fieldName string) *Binding { for _, binding := range structDescriptor.Fields { - if binding.Field.Name == fieldName { + if binding.Field.Name() == fieldName { return binding } } @@ -37,7 +36,7 @@ func (structDescriptor *StructDescriptor) GetField(fieldName string) *Binding { // Binding describe how should we encode/decode the struct field type Binding struct { levels []int - Field *reflect.StructField + Field reflect2.StructField FromNames []string ToNames []string Encoder ValEncoder @@ -48,10 +47,12 @@ type Binding struct { // Can also rename fields by UpdateStructDescriptor. type Extension interface { UpdateStructDescriptor(structDescriptor *StructDescriptor) - CreateDecoder(typ reflect.Type) ValDecoder - CreateEncoder(typ reflect.Type) ValEncoder - DecorateDecoder(typ reflect.Type, decoder ValDecoder) ValDecoder - DecorateEncoder(typ reflect.Type, encoder ValEncoder) ValEncoder + CreateMapKeyDecoder(typ reflect2.Type) ValDecoder + CreateMapKeyEncoder(typ reflect2.Type) ValEncoder + CreateDecoder(typ reflect2.Type) ValDecoder + CreateEncoder(typ reflect2.Type) ValEncoder + DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder + DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder } // DummyExtension embed this type get dummy implementation for all methods of Extension @@ -62,23 +63,105 @@ type DummyExtension struct { func (extension *DummyExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) { } +// CreateMapKeyDecoder No-op +func (extension *DummyExtension) CreateMapKeyDecoder(typ reflect2.Type) ValDecoder { + return nil +} + +// CreateMapKeyEncoder No-op +func (extension *DummyExtension) CreateMapKeyEncoder(typ reflect2.Type) ValEncoder { + return nil +} + +// CreateDecoder No-op +func (extension *DummyExtension) CreateDecoder(typ reflect2.Type) ValDecoder { + return nil +} + +// CreateEncoder No-op +func (extension *DummyExtension) CreateEncoder(typ reflect2.Type) ValEncoder { + return nil +} + +// DecorateDecoder No-op +func (extension *DummyExtension) DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder { + return decoder +} + +// DecorateEncoder No-op +func (extension *DummyExtension) DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder { + return encoder +} + +type EncoderExtension map[reflect2.Type]ValEncoder + +// UpdateStructDescriptor No-op +func (extension EncoderExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) { +} + // CreateDecoder No-op -func (extension *DummyExtension) CreateDecoder(typ reflect.Type) ValDecoder { +func (extension EncoderExtension) CreateDecoder(typ reflect2.Type) ValDecoder { + return nil +} + +// CreateEncoder get encoder from map +func (extension EncoderExtension) CreateEncoder(typ reflect2.Type) ValEncoder { + return extension[typ] +} + +// CreateMapKeyDecoder No-op +func (extension EncoderExtension) CreateMapKeyDecoder(typ reflect2.Type) ValDecoder { + return nil +} + +// CreateMapKeyEncoder No-op +func (extension EncoderExtension) CreateMapKeyEncoder(typ reflect2.Type) ValEncoder { + return nil +} + +// DecorateDecoder No-op +func (extension EncoderExtension) DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder { + return decoder +} + +// DecorateEncoder No-op +func (extension EncoderExtension) DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder { + return encoder +} + +type DecoderExtension map[reflect2.Type]ValDecoder + +// UpdateStructDescriptor No-op +func (extension DecoderExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) { +} + +// CreateMapKeyDecoder No-op +func (extension DecoderExtension) CreateMapKeyDecoder(typ reflect2.Type) ValDecoder { return nil } +// CreateMapKeyEncoder No-op +func (extension DecoderExtension) CreateMapKeyEncoder(typ reflect2.Type) ValEncoder { + return nil +} + +// CreateDecoder get decoder from map +func (extension DecoderExtension) CreateDecoder(typ reflect2.Type) ValDecoder { + return extension[typ] +} + // CreateEncoder No-op -func (extension *DummyExtension) CreateEncoder(typ reflect.Type) ValEncoder { +func (extension DecoderExtension) CreateEncoder(typ reflect2.Type) ValEncoder { return nil } // DecorateDecoder No-op -func (extension *DummyExtension) DecorateDecoder(typ reflect.Type, decoder ValDecoder) ValDecoder { +func (extension DecoderExtension) DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder { return decoder } // DecorateEncoder No-op -func (extension *DummyExtension) DecorateEncoder(typ reflect.Type, encoder ValEncoder) ValEncoder { +func (extension DecoderExtension) DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder { return encoder } @@ -99,10 +182,6 @@ func (encoder *funcEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { encoder.fun(ptr, stream) } -func (encoder *funcEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - func (encoder *funcEncoder) IsEmpty(ptr unsafe.Pointer) bool { if encoder.isEmptyFunc == nil { return false @@ -161,26 +240,26 @@ func RegisterExtension(extension Extension) { extensions = append(extensions, extension) } -func getTypeDecoderFromExtension(cfg *frozenConfig, typ reflect.Type) ValDecoder { - decoder := _getTypeDecoderFromExtension(cfg, typ) +func getTypeDecoderFromExtension(ctx *ctx, typ reflect2.Type) ValDecoder { + decoder := _getTypeDecoderFromExtension(ctx, typ) if decoder != nil { for _, extension := range extensions { decoder = extension.DecorateDecoder(typ, decoder) } - for _, extension := range cfg.extensions { + for _, extension := range ctx.extensions { decoder = extension.DecorateDecoder(typ, decoder) } } return decoder } -func _getTypeDecoderFromExtension(cfg *frozenConfig, typ reflect.Type) ValDecoder { +func _getTypeDecoderFromExtension(ctx *ctx, typ reflect2.Type) ValDecoder { for _, extension := range extensions { decoder := extension.CreateDecoder(typ) if decoder != nil { return decoder } } - for _, extension := range cfg.extensions { + for _, extension := range ctx.extensions { decoder := extension.CreateDecoder(typ) if decoder != nil { return decoder @@ -192,35 +271,36 @@ func _getTypeDecoderFromExtension(cfg *frozenConfig, typ reflect.Type) ValDecode return decoder } if typ.Kind() == reflect.Ptr { - decoder := typeDecoders[typ.Elem().String()] + ptrType := typ.(*reflect2.UnsafePtrType) + decoder := typeDecoders[ptrType.Elem().String()] if decoder != nil { - return &OptionalDecoder{typ.Elem(), decoder} + return &OptionalDecoder{ptrType.Elem(), decoder} } } return nil } -func getTypeEncoderFromExtension(cfg *frozenConfig, typ reflect.Type) ValEncoder { - encoder := _getTypeEncoderFromExtension(cfg, typ) +func getTypeEncoderFromExtension(ctx *ctx, typ reflect2.Type) ValEncoder { + encoder := _getTypeEncoderFromExtension(ctx, typ) if encoder != nil { for _, extension := range extensions { encoder = extension.DecorateEncoder(typ, encoder) } - for _, extension := range cfg.extensions { + for _, extension := range ctx.extensions { encoder = extension.DecorateEncoder(typ, encoder) } } return encoder } -func _getTypeEncoderFromExtension(cfg *frozenConfig, typ reflect.Type) ValEncoder { +func _getTypeEncoderFromExtension(ctx *ctx, typ reflect2.Type) ValEncoder { for _, extension := range extensions { encoder := extension.CreateEncoder(typ) if encoder != nil { return encoder } } - for _, extension := range cfg.extensions { + for _, extension := range ctx.extensions { encoder := extension.CreateEncoder(typ) if encoder != nil { return encoder @@ -232,7 +312,8 @@ func _getTypeEncoderFromExtension(cfg *frozenConfig, typ reflect.Type) ValEncode return encoder } if typ.Kind() == reflect.Ptr { - encoder := typeEncoders[typ.Elem().String()] + typePtr := typ.(*reflect2.UnsafePtrType) + encoder := typeEncoders[typePtr.Elem().String()] if encoder != nil { return &OptionalEncoder{encoder} } @@ -240,61 +321,60 @@ func _getTypeEncoderFromExtension(cfg *frozenConfig, typ reflect.Type) ValEncode return nil } -func describeStruct(cfg *frozenConfig, prefix string, typ reflect.Type) *StructDescriptor { +func describeStruct(ctx *ctx, typ reflect2.Type) *StructDescriptor { + structType := typ.(*reflect2.UnsafeStructType) embeddedBindings := []*Binding{} bindings := []*Binding{} - for i := 0; i < typ.NumField(); i++ { - field := typ.Field(i) - tag, hastag := field.Tag.Lookup(cfg.getTagKey()) - if cfg.onlyTaggedField && !hastag { + for i := 0; i < structType.NumField(); i++ { + field := structType.Field(i) + tag, hastag := field.Tag().Lookup(ctx.getTagKey()) + if ctx.onlyTaggedField && !hastag { continue } tagParts := strings.Split(tag, ",") if tag == "-" { continue } - if field.Anonymous && (tag == "" || tagParts[0] == "") { - if field.Type.Kind() == reflect.Struct { - structDescriptor := describeStruct(cfg, prefix, field.Type) + if field.Anonymous() && (tag == "" || tagParts[0] == "") { + if field.Type().Kind() == reflect.Struct { + structDescriptor := describeStruct(ctx, field.Type()) for _, binding := range structDescriptor.Fields { binding.levels = append([]int{i}, binding.levels...) omitempty := binding.Encoder.(*structFieldEncoder).omitempty - binding.Encoder = &structFieldEncoder{&field, binding.Encoder, omitempty} - binding.Decoder = &structFieldDecoder{&field, binding.Decoder} + binding.Encoder = &structFieldEncoder{field, binding.Encoder, omitempty} + binding.Decoder = &structFieldDecoder{field, binding.Decoder} embeddedBindings = append(embeddedBindings, binding) } continue - } else if field.Type.Kind() == reflect.Ptr && field.Type.Elem().Kind() == reflect.Struct { - structDescriptor := describeStruct(cfg, prefix, field.Type.Elem()) - for _, binding := range structDescriptor.Fields { - binding.levels = append([]int{i}, binding.levels...) - omitempty := binding.Encoder.(*structFieldEncoder).omitempty - binding.Encoder = &dereferenceEncoder{binding.Encoder} - binding.Encoder = &structFieldEncoder{&field, binding.Encoder, omitempty} - binding.Decoder = &dereferenceDecoder{field.Type.Elem(), binding.Decoder} - binding.Decoder = &structFieldDecoder{&field, binding.Decoder} - embeddedBindings = append(embeddedBindings, binding) + } else if field.Type().Kind() == reflect.Ptr { + ptrType := field.Type().(*reflect2.UnsafePtrType) + if ptrType.Elem().Kind() == reflect.Struct { + structDescriptor := describeStruct(ctx, ptrType.Elem()) + for _, binding := range structDescriptor.Fields { + binding.levels = append([]int{i}, binding.levels...) + omitempty := binding.Encoder.(*structFieldEncoder).omitempty + binding.Encoder = &dereferenceEncoder{binding.Encoder} + binding.Encoder = &structFieldEncoder{field, binding.Encoder, omitempty} + binding.Decoder = &dereferenceDecoder{ptrType.Elem(), binding.Decoder} + binding.Decoder = &structFieldDecoder{field, binding.Decoder} + embeddedBindings = append(embeddedBindings, binding) + } + continue } - continue } } - fieldNames := calcFieldNames(field.Name, tagParts[0], tag) - fieldCacheKey := fmt.Sprintf("%s/%s", typ.String(), field.Name) + fieldNames := calcFieldNames(field.Name(), tagParts[0], tag) + fieldCacheKey := fmt.Sprintf("%s/%s", typ.String(), field.Name()) decoder := fieldDecoders[fieldCacheKey] if decoder == nil { - decoder = decoderOfType(cfg, prefix+typ.String()+"."+field.Name+"->", field.Type) + decoder = decoderOfType(ctx.append(field.Name()), field.Type()) } encoder := fieldEncoders[fieldCacheKey] if encoder == nil { - encoder = encoderOfType(cfg, prefix+typ.String()+"."+field.Name+"->", field.Type) - // map is stored as pointer in the struct, - // and treat nil or empty map as empty field - if encoder != nil && field.Type.Kind() == reflect.Map { - encoder = &optionalMapEncoder{encoder} - } + encoder = encoderOfType(ctx.append(field.Name()), field.Type()) } binding := &Binding{ - Field: &field, + Field: field, FromNames: fieldNames, ToNames: fieldNames, Decoder: decoder, @@ -303,38 +383,20 @@ func describeStruct(cfg *frozenConfig, prefix string, typ reflect.Type) *StructD binding.levels = []int{i} bindings = append(bindings, binding) } - return createStructDescriptor(cfg, typ, bindings, embeddedBindings) -} -func createStructDescriptor(cfg *frozenConfig, typ reflect.Type, bindings []*Binding, embeddedBindings []*Binding) *StructDescriptor { - onePtrEmbedded := false - onePtrOptimization := false - if typ.NumField() == 1 { - firstField := typ.Field(0) - switch firstField.Type.Kind() { - case reflect.Ptr: - if firstField.Anonymous && firstField.Type.Elem().Kind() == reflect.Struct { - onePtrEmbedded = true - } - fallthrough - case reflect.Map: - onePtrOptimization = true - case reflect.Struct: - onePtrOptimization = isStructOnePtr(firstField.Type) - } - } + return createStructDescriptor(ctx, typ, bindings, embeddedBindings) +} +func createStructDescriptor(ctx *ctx, typ reflect2.Type, bindings []*Binding, embeddedBindings []*Binding) *StructDescriptor { structDescriptor := &StructDescriptor{ - onePtrEmbedded: onePtrEmbedded, - onePtrOptimization: onePtrOptimization, - Type: typ, - Fields: bindings, + Type: typ, + Fields: bindings, } for _, extension := range extensions { extension.UpdateStructDescriptor(structDescriptor) } - for _, extension := range cfg.extensions { + for _, extension := range ctx.extensions { extension.UpdateStructDescriptor(structDescriptor) } - processTags(structDescriptor, cfg) + processTags(structDescriptor, ctx.frozenConfig) // merge normal & embedded bindings & sort with original order allBindings := sortableBindings(append(embeddedBindings, structDescriptor.Fields...)) sort.Sort(allBindings) @@ -342,21 +404,6 @@ func createStructDescriptor(cfg *frozenConfig, typ reflect.Type, bindings []*Bin return structDescriptor } -func isStructOnePtr(typ reflect.Type) bool { - if typ.NumField() == 1 { - firstField := typ.Field(0) - switch firstField.Type.Kind() { - case reflect.Ptr: - return true - case reflect.Map: - return true - case reflect.Struct: - return isStructOnePtr(firstField.Type) - } - } - return false -} - type sortableBindings []*Binding func (bindings sortableBindings) Len() int { @@ -384,12 +431,12 @@ func (bindings sortableBindings) Swap(i, j int) { func processTags(structDescriptor *StructDescriptor, cfg *frozenConfig) { for _, binding := range structDescriptor.Fields { shouldOmitEmpty := false - tagParts := strings.Split(binding.Field.Tag.Get(cfg.getTagKey()), ",") + tagParts := strings.Split(binding.Field.Tag().Get(cfg.getTagKey()), ",") for _, tagPart := range tagParts[1:] { if tagPart == "omitempty" { shouldOmitEmpty = true } else if tagPart == "string" { - if binding.Field.Type.Kind() == reflect.String { + if binding.Field.Type().Kind() == reflect.String { binding.Decoder = &stringModeStringDecoder{binding.Decoder, cfg} binding.Encoder = &stringModeStringEncoder{binding.Encoder, cfg} } else { diff --git a/vendor/github.com/json-iterator/go/reflect_json_number.go b/vendor/github.com/json-iterator/go/reflect_json_number.go new file mode 100644 index 000000000..98d45c1ec --- /dev/null +++ b/vendor/github.com/json-iterator/go/reflect_json_number.go @@ -0,0 +1,112 @@ +package jsoniter + +import ( + "encoding/json" + "github.com/modern-go/reflect2" + "strconv" + "unsafe" +) + +type Number string + +// String returns the literal text of the number. +func (n Number) String() string { return string(n) } + +// Float64 returns the number as a float64. +func (n Number) Float64() (float64, error) { + return strconv.ParseFloat(string(n), 64) +} + +// Int64 returns the number as an int64. +func (n Number) Int64() (int64, error) { + return strconv.ParseInt(string(n), 10, 64) +} + +func CastJsonNumber(val interface{}) (string, bool) { + switch typedVal := val.(type) { + case json.Number: + return string(typedVal), true + case Number: + return string(typedVal), true + } + return "", false +} + +var jsonNumberType = reflect2.TypeOfPtr((*json.Number)(nil)).Elem() +var jsoniterNumberType = reflect2.TypeOfPtr((*Number)(nil)).Elem() + +func createDecoderOfJsonNumber(ctx *ctx, typ reflect2.Type) ValDecoder { + if typ.AssignableTo(jsonNumberType) { + return &jsonNumberCodec{} + } + if typ.AssignableTo(jsoniterNumberType) { + return &jsoniterNumberCodec{} + } + return nil +} + +func createEncoderOfJsonNumber(ctx *ctx, typ reflect2.Type) ValEncoder { + if typ.AssignableTo(jsonNumberType) { + return &jsonNumberCodec{} + } + if typ.AssignableTo(jsoniterNumberType) { + return &jsoniterNumberCodec{} + } + return nil +} + +type jsonNumberCodec struct { +} + +func (codec *jsonNumberCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { + switch iter.WhatIsNext() { + case StringValue: + *((*json.Number)(ptr)) = json.Number(iter.ReadString()) + case NilValue: + iter.skipFourBytes('n', 'u', 'l', 'l') + *((*json.Number)(ptr)) = "" + default: + *((*json.Number)(ptr)) = json.Number([]byte(iter.readNumberAsString())) + } +} + +func (codec *jsonNumberCodec) Encode(ptr unsafe.Pointer, stream *Stream) { + number := *((*json.Number)(ptr)) + if len(number) == 0 { + stream.writeByte('0') + } else { + stream.WriteRaw(string(number)) + } +} + +func (codec *jsonNumberCodec) IsEmpty(ptr unsafe.Pointer) bool { + return len(*((*json.Number)(ptr))) == 0 +} + +type jsoniterNumberCodec struct { +} + +func (codec *jsoniterNumberCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { + switch iter.WhatIsNext() { + case StringValue: + *((*Number)(ptr)) = Number(iter.ReadString()) + case NilValue: + iter.skipFourBytes('n', 'u', 'l', 'l') + *((*Number)(ptr)) = "" + default: + *((*Number)(ptr)) = Number([]byte(iter.readNumberAsString())) + } +} + +func (codec *jsoniterNumberCodec) Encode(ptr unsafe.Pointer, stream *Stream) { + number := *((*Number)(ptr)) + if len(number) == 0 { + stream.writeByte('0') + } else { + stream.WriteRaw(string(number)) + } +} + +func (codec *jsoniterNumberCodec) IsEmpty(ptr unsafe.Pointer) bool { + return len(*((*Number)(ptr))) == 0 +} diff --git a/vendor/github.com/json-iterator/go/reflect_json_raw_message.go b/vendor/github.com/json-iterator/go/reflect_json_raw_message.go new file mode 100644 index 000000000..f2619936c --- /dev/null +++ b/vendor/github.com/json-iterator/go/reflect_json_raw_message.go @@ -0,0 +1,60 @@ +package jsoniter + +import ( + "encoding/json" + "github.com/modern-go/reflect2" + "unsafe" +) + +var jsonRawMessageType = reflect2.TypeOfPtr((*json.RawMessage)(nil)).Elem() +var jsoniterRawMessageType = reflect2.TypeOfPtr((*RawMessage)(nil)).Elem() + +func createEncoderOfJsonRawMessage(ctx *ctx, typ reflect2.Type) ValEncoder { + if typ == jsonRawMessageType { + return &jsonRawMessageCodec{} + } + if typ == jsoniterRawMessageType { + return &jsoniterRawMessageCodec{} + } + return nil +} + +func createDecoderOfJsonRawMessage(ctx *ctx, typ reflect2.Type) ValDecoder { + if typ == jsonRawMessageType { + return &jsonRawMessageCodec{} + } + if typ == jsoniterRawMessageType { + return &jsoniterRawMessageCodec{} + } + return nil +} + +type jsonRawMessageCodec struct { +} + +func (codec *jsonRawMessageCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { + *((*json.RawMessage)(ptr)) = json.RawMessage(iter.SkipAndReturnBytes()) +} + +func (codec *jsonRawMessageCodec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteRaw(string(*((*json.RawMessage)(ptr)))) +} + +func (codec *jsonRawMessageCodec) IsEmpty(ptr unsafe.Pointer) bool { + return len(*((*json.RawMessage)(ptr))) == 0 +} + +type jsoniterRawMessageCodec struct { +} + +func (codec *jsoniterRawMessageCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { + *((*RawMessage)(ptr)) = RawMessage(iter.SkipAndReturnBytes()) +} + +func (codec *jsoniterRawMessageCodec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteRaw(string(*((*RawMessage)(ptr)))) +} + +func (codec *jsoniterRawMessageCodec) IsEmpty(ptr unsafe.Pointer) bool { + return len(*((*RawMessage)(ptr))) == 0 +} diff --git a/vendor/github.com/json-iterator/go/reflect_map.go b/vendor/github.com/json-iterator/go/reflect_map.go new file mode 100644 index 000000000..f34d519f9 --- /dev/null +++ b/vendor/github.com/json-iterator/go/reflect_map.go @@ -0,0 +1,296 @@ +package jsoniter + +import ( + "fmt" + "github.com/modern-go/reflect2" + "reflect" + "sort" + "unsafe" +) + +func decoderOfMap(ctx *ctx, typ reflect2.Type) ValDecoder { + mapType := typ.(*reflect2.UnsafeMapType) + keyDecoder := decoderOfMapKey(ctx.append("[mapKey]"), mapType.Key()) + elemDecoder := decoderOfType(ctx.append("[mapElem]"), mapType.Elem()) + return &mapDecoder{ + mapType: mapType, + keyType: mapType.Key(), + elemType: mapType.Elem(), + keyDecoder: keyDecoder, + elemDecoder: elemDecoder, + } +} + +func encoderOfMap(ctx *ctx, typ reflect2.Type) ValEncoder { + mapType := typ.(*reflect2.UnsafeMapType) + if ctx.sortMapKeys { + return &sortKeysMapEncoder{ + mapType: mapType, + keyEncoder: encoderOfMapKey(ctx.append("[mapKey]"), mapType.Key()), + elemEncoder: encoderOfType(ctx.append("[mapElem]"), mapType.Elem()), + } + } + return &mapEncoder{ + mapType: mapType, + keyEncoder: encoderOfMapKey(ctx.append("[mapKey]"), mapType.Key()), + elemEncoder: encoderOfType(ctx.append("[mapElem]"), mapType.Elem()), + } +} + +func decoderOfMapKey(ctx *ctx, typ reflect2.Type) ValDecoder { + for _, extension := range ctx.extensions { + decoder := extension.CreateMapKeyDecoder(typ) + if decoder != nil { + return decoder + } + } + switch typ.Kind() { + case reflect.String: + return decoderOfType(ctx, reflect2.DefaultTypeOfKind(reflect.String)) + case reflect.Bool, + reflect.Uint8, reflect.Int8, + reflect.Uint16, reflect.Int16, + reflect.Uint32, reflect.Int32, + reflect.Uint64, reflect.Int64, + reflect.Uint, reflect.Int, + reflect.Float32, reflect.Float64, + reflect.Uintptr: + typ = reflect2.DefaultTypeOfKind(typ.Kind()) + return &numericMapKeyDecoder{decoderOfType(ctx, typ)} + default: + ptrType := reflect2.PtrTo(typ) + if ptrType.Implements(textMarshalerType) { + return &referenceDecoder{ + &textUnmarshalerDecoder{ + valType: ptrType, + }, + } + } + if typ.Implements(textMarshalerType) { + return &textUnmarshalerDecoder{ + valType: typ, + } + } + return &lazyErrorDecoder{err: fmt.Errorf("unsupported map key type: %v", typ)} + } +} + +func encoderOfMapKey(ctx *ctx, typ reflect2.Type) ValEncoder { + for _, extension := range ctx.extensions { + encoder := extension.CreateMapKeyEncoder(typ) + if encoder != nil { + return encoder + } + } + switch typ.Kind() { + case reflect.String: + return encoderOfType(ctx, reflect2.DefaultTypeOfKind(reflect.String)) + case reflect.Bool, + reflect.Uint8, reflect.Int8, + reflect.Uint16, reflect.Int16, + reflect.Uint32, reflect.Int32, + reflect.Uint64, reflect.Int64, + reflect.Uint, reflect.Int, + reflect.Float32, reflect.Float64, + reflect.Uintptr: + typ = reflect2.DefaultTypeOfKind(typ.Kind()) + return &numericMapKeyEncoder{encoderOfType(ctx, typ)} + default: + if typ == textMarshalerType { + return &directTextMarshalerEncoder{ + stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), + } + } + if typ.Implements(textMarshalerType) { + return &textMarshalerEncoder{ + valType: typ, + stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), + } + } + return &lazyErrorEncoder{err: fmt.Errorf("unsupported map key type: %v", typ)} + } +} + +type mapDecoder struct { + mapType *reflect2.UnsafeMapType + keyType reflect2.Type + elemType reflect2.Type + keyDecoder ValDecoder + elemDecoder ValDecoder +} + +func (decoder *mapDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + mapType := decoder.mapType + c := iter.nextToken() + if c == 'n' { + iter.skipThreeBytes('u', 'l', 'l') + *(*unsafe.Pointer)(ptr) = nil + mapType.UnsafeSet(ptr, mapType.UnsafeNew()) + return + } + if mapType.UnsafeIsNil(ptr) { + mapType.UnsafeSet(ptr, mapType.UnsafeMakeMap(0)) + } + if c != '{' { + iter.ReportError("ReadMapCB", `expect { or n, but found `+string([]byte{c})) + return + } + c = iter.nextToken() + if c == '}' { + return + } + if c != '"' { + iter.ReportError("ReadMapCB", `expect " after }, but found `+string([]byte{c})) + return + } + iter.unreadByte() + key := decoder.keyType.UnsafeNew() + decoder.keyDecoder.Decode(key, iter) + c = iter.nextToken() + if c != ':' { + iter.ReportError("ReadMapCB", "expect : after object field, but found "+string([]byte{c})) + return + } + elem := decoder.elemType.UnsafeNew() + decoder.elemDecoder.Decode(elem, iter) + decoder.mapType.UnsafeSetIndex(ptr, key, elem) + for c = iter.nextToken(); c == ','; c = iter.nextToken() { + key := decoder.keyType.UnsafeNew() + decoder.keyDecoder.Decode(key, iter) + c = iter.nextToken() + if c != ':' { + iter.ReportError("ReadMapCB", "expect : after object field, but found "+string([]byte{c})) + return + } + elem := decoder.elemType.UnsafeNew() + decoder.elemDecoder.Decode(elem, iter) + decoder.mapType.UnsafeSetIndex(ptr, key, elem) + } + if c != '}' { + iter.ReportError("ReadMapCB", `expect }, but found `+string([]byte{c})) + } +} + +type numericMapKeyDecoder struct { + decoder ValDecoder +} + +func (decoder *numericMapKeyDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + c := iter.nextToken() + if c != '"' { + iter.ReportError("ReadMapCB", `expect ", but found `+string([]byte{c})) + return + } + decoder.decoder.Decode(ptr, iter) + c = iter.nextToken() + if c != '"' { + iter.ReportError("ReadMapCB", `expect ", but found `+string([]byte{c})) + return + } +} + +type numericMapKeyEncoder struct { + encoder ValEncoder +} + +func (encoder *numericMapKeyEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.writeByte('"') + encoder.encoder.Encode(ptr, stream) + stream.writeByte('"') +} + +func (encoder *numericMapKeyEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return false +} + +type mapEncoder struct { + mapType *reflect2.UnsafeMapType + keyEncoder ValEncoder + elemEncoder ValEncoder +} + +func (encoder *mapEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteObjectStart() + iter := encoder.mapType.UnsafeIterate(ptr) + for i := 0; iter.HasNext(); i++ { + if i != 0 { + stream.WriteMore() + } + key, elem := iter.UnsafeNext() + encoder.keyEncoder.Encode(key, stream) + if stream.indention > 0 { + stream.writeTwoBytes(byte(':'), byte(' ')) + } else { + stream.writeByte(':') + } + encoder.elemEncoder.Encode(elem, stream) + } + stream.WriteObjectEnd() +} + +func (encoder *mapEncoder) IsEmpty(ptr unsafe.Pointer) bool { + iter := encoder.mapType.UnsafeIterate(ptr) + return !iter.HasNext() +} + +type sortKeysMapEncoder struct { + mapType *reflect2.UnsafeMapType + keyEncoder ValEncoder + elemEncoder ValEncoder +} + +func (encoder *sortKeysMapEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + if *(*unsafe.Pointer)(ptr) == nil { + stream.WriteNil() + return + } + stream.WriteObjectStart() + mapIter := encoder.mapType.UnsafeIterate(ptr) + subStream := stream.cfg.BorrowStream(nil) + subIter := stream.cfg.BorrowIterator(nil) + keyValues := encodedKeyValues{} + for mapIter.HasNext() { + subStream.buf = make([]byte, 0, 64) + key, elem := mapIter.UnsafeNext() + encoder.keyEncoder.Encode(key, subStream) + encodedKey := subStream.Buffer() + subIter.ResetBytes(encodedKey) + decodedKey := subIter.ReadString() + if stream.indention > 0 { + subStream.writeTwoBytes(byte(':'), byte(' ')) + } else { + subStream.writeByte(':') + } + encoder.elemEncoder.Encode(elem, subStream) + keyValues = append(keyValues, encodedKV{ + key: decodedKey, + keyValue: subStream.Buffer(), + }) + } + sort.Sort(keyValues) + for i, keyValue := range keyValues { + if i != 0 { + stream.WriteMore() + } + stream.Write(keyValue.keyValue) + } + stream.WriteObjectEnd() + stream.cfg.ReturnStream(subStream) + stream.cfg.ReturnIterator(subIter) +} + +func (encoder *sortKeysMapEncoder) IsEmpty(ptr unsafe.Pointer) bool { + iter := encoder.mapType.UnsafeIterate(ptr) + return !iter.HasNext() +} + +type encodedKeyValues []encodedKV + +type encodedKV struct { + key string + keyValue []byte +} + +func (sv encodedKeyValues) Len() int { return len(sv) } +func (sv encodedKeyValues) Swap(i, j int) { sv[i], sv[j] = sv[j], sv[i] } +func (sv encodedKeyValues) Less(i, j int) bool { return sv[i].key < sv[j].key } diff --git a/vendor/github.com/json-iterator/go/reflect_marshaler.go b/vendor/github.com/json-iterator/go/reflect_marshaler.go new file mode 100644 index 000000000..58ac959ad --- /dev/null +++ b/vendor/github.com/json-iterator/go/reflect_marshaler.go @@ -0,0 +1,218 @@ +package jsoniter + +import ( + "encoding" + "encoding/json" + "github.com/modern-go/reflect2" + "unsafe" +) + +var marshalerType = reflect2.TypeOfPtr((*json.Marshaler)(nil)).Elem() +var unmarshalerType = reflect2.TypeOfPtr((*json.Unmarshaler)(nil)).Elem() +var textMarshalerType = reflect2.TypeOfPtr((*encoding.TextMarshaler)(nil)).Elem() +var textUnmarshalerType = reflect2.TypeOfPtr((*encoding.TextUnmarshaler)(nil)).Elem() + +func createDecoderOfMarshaler(ctx *ctx, typ reflect2.Type) ValDecoder { + ptrType := reflect2.PtrTo(typ) + if ptrType.Implements(unmarshalerType) { + return &referenceDecoder{ + &unmarshalerDecoder{ptrType}, + } + } + if ptrType.Implements(textUnmarshalerType) { + return &referenceDecoder{ + &textUnmarshalerDecoder{ptrType}, + } + } + return nil +} + +func createEncoderOfMarshaler(ctx *ctx, typ reflect2.Type) ValEncoder { + if typ == marshalerType { + checkIsEmpty := createCheckIsEmpty(ctx, typ) + var encoder ValEncoder = &directMarshalerEncoder{ + checkIsEmpty: checkIsEmpty, + } + return encoder + } + if typ.Implements(marshalerType) { + checkIsEmpty := createCheckIsEmpty(ctx, typ) + var encoder ValEncoder = &marshalerEncoder{ + valType: typ, + checkIsEmpty: checkIsEmpty, + } + return encoder + } + ptrType := reflect2.PtrTo(typ) + if ctx.prefix != "" && ptrType.Implements(marshalerType) { + checkIsEmpty := createCheckIsEmpty(ctx, ptrType) + var encoder ValEncoder = &marshalerEncoder{ + valType: ptrType, + checkIsEmpty: checkIsEmpty, + } + return &referenceEncoder{encoder} + } + if typ == textMarshalerType { + checkIsEmpty := createCheckIsEmpty(ctx, typ) + var encoder ValEncoder = &directTextMarshalerEncoder{ + checkIsEmpty: checkIsEmpty, + stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), + } + return encoder + } + if typ.Implements(textMarshalerType) { + checkIsEmpty := createCheckIsEmpty(ctx, typ) + var encoder ValEncoder = &textMarshalerEncoder{ + valType: typ, + stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), + checkIsEmpty: checkIsEmpty, + } + return encoder + } + // if prefix is empty, the type is the root type + if ctx.prefix != "" && ptrType.Implements(textMarshalerType) { + checkIsEmpty := createCheckIsEmpty(ctx, ptrType) + var encoder ValEncoder = &textMarshalerEncoder{ + valType: ptrType, + stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), + checkIsEmpty: checkIsEmpty, + } + return &referenceEncoder{encoder} + } + return nil +} + +type marshalerEncoder struct { + checkIsEmpty checkIsEmpty + valType reflect2.Type +} + +func (encoder *marshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + obj := encoder.valType.UnsafeIndirect(ptr) + if encoder.valType.IsNullable() && reflect2.IsNil(obj) { + stream.WriteNil() + return + } + marshaler := obj.(json.Marshaler) + bytes, err := marshaler.MarshalJSON() + if err != nil { + stream.Error = err + } else { + stream.Write(bytes) + } +} + +func (encoder *marshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.checkIsEmpty.IsEmpty(ptr) +} + +type directMarshalerEncoder struct { + checkIsEmpty checkIsEmpty +} + +func (encoder *directMarshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + marshaler := *(*json.Marshaler)(ptr) + if marshaler == nil { + stream.WriteNil() + return + } + bytes, err := marshaler.MarshalJSON() + if err != nil { + stream.Error = err + } else { + stream.Write(bytes) + } +} + +func (encoder *directMarshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.checkIsEmpty.IsEmpty(ptr) +} + +type textMarshalerEncoder struct { + valType reflect2.Type + stringEncoder ValEncoder + checkIsEmpty checkIsEmpty +} + +func (encoder *textMarshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + obj := encoder.valType.UnsafeIndirect(ptr) + if encoder.valType.IsNullable() && reflect2.IsNil(obj) { + stream.WriteNil() + return + } + marshaler := (obj).(encoding.TextMarshaler) + bytes, err := marshaler.MarshalText() + if err != nil { + stream.Error = err + } else { + str := string(bytes) + encoder.stringEncoder.Encode(unsafe.Pointer(&str), stream) + } +} + +func (encoder *textMarshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.checkIsEmpty.IsEmpty(ptr) +} + +type directTextMarshalerEncoder struct { + stringEncoder ValEncoder + checkIsEmpty checkIsEmpty +} + +func (encoder *directTextMarshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + marshaler := *(*encoding.TextMarshaler)(ptr) + if marshaler == nil { + stream.WriteNil() + return + } + bytes, err := marshaler.MarshalText() + if err != nil { + stream.Error = err + } else { + str := string(bytes) + encoder.stringEncoder.Encode(unsafe.Pointer(&str), stream) + } +} + +func (encoder *directTextMarshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.checkIsEmpty.IsEmpty(ptr) +} + +type unmarshalerDecoder struct { + valType reflect2.Type +} + +func (decoder *unmarshalerDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + valType := decoder.valType + obj := valType.UnsafeIndirect(ptr) + unmarshaler := obj.(json.Unmarshaler) + iter.nextToken() + iter.unreadByte() // skip spaces + bytes := iter.SkipAndReturnBytes() + err := unmarshaler.UnmarshalJSON(bytes) + if err != nil { + iter.ReportError("unmarshalerDecoder", err.Error()) + } +} + +type textUnmarshalerDecoder struct { + valType reflect2.Type +} + +func (decoder *textUnmarshalerDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + valType := decoder.valType + obj := valType.UnsafeIndirect(ptr) + if reflect2.IsNil(obj) { + ptrType := valType.(*reflect2.UnsafePtrType) + elemType := ptrType.Elem() + elem := elemType.UnsafeNew() + ptrType.UnsafeSet(ptr, unsafe.Pointer(&elem)) + obj = valType.UnsafeIndirect(ptr) + } + unmarshaler := (obj).(encoding.TextUnmarshaler) + str := iter.ReadString() + err := unmarshaler.UnmarshalText([]byte(str)) + if err != nil { + iter.ReportError("textUnmarshalerDecoder", err.Error()) + } +} diff --git a/vendor/github.com/json-iterator/go/reflect_native.go b/vendor/github.com/json-iterator/go/reflect_native.go new file mode 100644 index 000000000..7f1e2464d --- /dev/null +++ b/vendor/github.com/json-iterator/go/reflect_native.go @@ -0,0 +1,455 @@ +package jsoniter + +import ( + "encoding/base64" + "github.com/modern-go/reflect2" + "reflect" + "strconv" + "unsafe" +) + +const ptrSize = 32 << uintptr(^uintptr(0)>>63) + +func createEncoderOfNative(ctx *ctx, typ reflect2.Type) ValEncoder { + if typ.Kind() == reflect.Slice && typ.(reflect2.SliceType).Elem().Kind() == reflect.Uint8 { + sliceDecoder := decoderOfSlice(ctx, typ) + return &base64Codec{sliceDecoder: sliceDecoder} + } + typeName := typ.String() + kind := typ.Kind() + switch kind { + case reflect.String: + if typeName != "string" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*string)(nil)).Elem()) + } + return &stringCodec{} + case reflect.Int: + if typeName != "int" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*int)(nil)).Elem()) + } + if strconv.IntSize == 32 { + return &int32Codec{} + } + return &int64Codec{} + case reflect.Int8: + if typeName != "int8" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*int8)(nil)).Elem()) + } + return &int8Codec{} + case reflect.Int16: + if typeName != "int16" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*int16)(nil)).Elem()) + } + return &int16Codec{} + case reflect.Int32: + if typeName != "int32" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*int32)(nil)).Elem()) + } + return &int32Codec{} + case reflect.Int64: + if typeName != "int64" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*int64)(nil)).Elem()) + } + return &int64Codec{} + case reflect.Uint: + if typeName != "uint" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*uint)(nil)).Elem()) + } + if strconv.IntSize == 32 { + return &uint32Codec{} + } + return &uint64Codec{} + case reflect.Uint8: + if typeName != "uint8" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*uint8)(nil)).Elem()) + } + return &uint8Codec{} + case reflect.Uint16: + if typeName != "uint16" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*uint16)(nil)).Elem()) + } + return &uint16Codec{} + case reflect.Uint32: + if typeName != "uint32" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*uint32)(nil)).Elem()) + } + return &uint32Codec{} + case reflect.Uintptr: + if typeName != "uintptr" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*uintptr)(nil)).Elem()) + } + if ptrSize == 32 { + return &uint32Codec{} + } + return &uint64Codec{} + case reflect.Uint64: + if typeName != "uint64" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*uint64)(nil)).Elem()) + } + return &uint64Codec{} + case reflect.Float32: + if typeName != "float32" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*float32)(nil)).Elem()) + } + return &float32Codec{} + case reflect.Float64: + if typeName != "float64" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*float64)(nil)).Elem()) + } + return &float64Codec{} + case reflect.Bool: + if typeName != "bool" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*bool)(nil)).Elem()) + } + return &boolCodec{} + } + return nil +} + +func createDecoderOfNative(ctx *ctx, typ reflect2.Type) ValDecoder { + if typ.Kind() == reflect.Slice && typ.(reflect2.SliceType).Elem().Kind() == reflect.Uint8 { + sliceDecoder := decoderOfSlice(ctx, typ) + return &base64Codec{sliceDecoder: sliceDecoder} + } + typeName := typ.String() + switch typ.Kind() { + case reflect.String: + if typeName != "string" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*string)(nil)).Elem()) + } + return &stringCodec{} + case reflect.Int: + if typeName != "int" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*int)(nil)).Elem()) + } + if strconv.IntSize == 32 { + return &int32Codec{} + } + return &int64Codec{} + case reflect.Int8: + if typeName != "int8" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*int8)(nil)).Elem()) + } + return &int8Codec{} + case reflect.Int16: + if typeName != "int16" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*int16)(nil)).Elem()) + } + return &int16Codec{} + case reflect.Int32: + if typeName != "int32" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*int32)(nil)).Elem()) + } + return &int32Codec{} + case reflect.Int64: + if typeName != "int64" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*int64)(nil)).Elem()) + } + return &int64Codec{} + case reflect.Uint: + if typeName != "uint" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*uint)(nil)).Elem()) + } + if strconv.IntSize == 32 { + return &uint32Codec{} + } + return &uint64Codec{} + case reflect.Uint8: + if typeName != "uint8" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*uint8)(nil)).Elem()) + } + return &uint8Codec{} + case reflect.Uint16: + if typeName != "uint16" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*uint16)(nil)).Elem()) + } + return &uint16Codec{} + case reflect.Uint32: + if typeName != "uint32" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*uint32)(nil)).Elem()) + } + return &uint32Codec{} + case reflect.Uintptr: + if typeName != "uintptr" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*uintptr)(nil)).Elem()) + } + if ptrSize == 32 { + return &uint32Codec{} + } + return &uint64Codec{} + case reflect.Uint64: + if typeName != "uint64" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*uint64)(nil)).Elem()) + } + return &uint64Codec{} + case reflect.Float32: + if typeName != "float32" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*float32)(nil)).Elem()) + } + return &float32Codec{} + case reflect.Float64: + if typeName != "float64" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*float64)(nil)).Elem()) + } + return &float64Codec{} + case reflect.Bool: + if typeName != "bool" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*bool)(nil)).Elem()) + } + return &boolCodec{} + } + return nil +} + +type stringCodec struct { +} + +func (codec *stringCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { + *((*string)(ptr)) = iter.ReadString() +} + +func (codec *stringCodec) Encode(ptr unsafe.Pointer, stream *Stream) { + str := *((*string)(ptr)) + stream.WriteString(str) +} + +func (codec *stringCodec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*string)(ptr)) == "" +} + +type int8Codec struct { +} + +func (codec *int8Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*int8)(ptr)) = iter.ReadInt8() + } +} + +func (codec *int8Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteInt8(*((*int8)(ptr))) +} + +func (codec *int8Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*int8)(ptr)) == 0 +} + +type int16Codec struct { +} + +func (codec *int16Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*int16)(ptr)) = iter.ReadInt16() + } +} + +func (codec *int16Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteInt16(*((*int16)(ptr))) +} + +func (codec *int16Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*int16)(ptr)) == 0 +} + +type int32Codec struct { +} + +func (codec *int32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*int32)(ptr)) = iter.ReadInt32() + } +} + +func (codec *int32Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteInt32(*((*int32)(ptr))) +} + +func (codec *int32Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*int32)(ptr)) == 0 +} + +type int64Codec struct { +} + +func (codec *int64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*int64)(ptr)) = iter.ReadInt64() + } +} + +func (codec *int64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteInt64(*((*int64)(ptr))) +} + +func (codec *int64Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*int64)(ptr)) == 0 +} + +type uint8Codec struct { +} + +func (codec *uint8Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*uint8)(ptr)) = iter.ReadUint8() + } +} + +func (codec *uint8Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteUint8(*((*uint8)(ptr))) +} + +func (codec *uint8Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*uint8)(ptr)) == 0 +} + +type uint16Codec struct { +} + +func (codec *uint16Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*uint16)(ptr)) = iter.ReadUint16() + } +} + +func (codec *uint16Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteUint16(*((*uint16)(ptr))) +} + +func (codec *uint16Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*uint16)(ptr)) == 0 +} + +type uint32Codec struct { +} + +func (codec *uint32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*uint32)(ptr)) = iter.ReadUint32() + } +} + +func (codec *uint32Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteUint32(*((*uint32)(ptr))) +} + +func (codec *uint32Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*uint32)(ptr)) == 0 +} + +type uint64Codec struct { +} + +func (codec *uint64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*uint64)(ptr)) = iter.ReadUint64() + } +} + +func (codec *uint64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteUint64(*((*uint64)(ptr))) +} + +func (codec *uint64Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*uint64)(ptr)) == 0 +} + +type float32Codec struct { +} + +func (codec *float32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*float32)(ptr)) = iter.ReadFloat32() + } +} + +func (codec *float32Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteFloat32(*((*float32)(ptr))) +} + +func (codec *float32Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*float32)(ptr)) == 0 +} + +type float64Codec struct { +} + +func (codec *float64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*float64)(ptr)) = iter.ReadFloat64() + } +} + +func (codec *float64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteFloat64(*((*float64)(ptr))) +} + +func (codec *float64Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*float64)(ptr)) == 0 +} + +type boolCodec struct { +} + +func (codec *boolCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*bool)(ptr)) = iter.ReadBool() + } +} + +func (codec *boolCodec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteBool(*((*bool)(ptr))) +} + +func (codec *boolCodec) IsEmpty(ptr unsafe.Pointer) bool { + return !(*((*bool)(ptr))) +} + +type base64Codec struct { + sliceType *reflect2.UnsafeSliceType + sliceDecoder ValDecoder +} + +func (codec *base64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if iter.ReadNil() { + codec.sliceType.UnsafeSetNil(ptr) + return + } + switch iter.WhatIsNext() { + case StringValue: + encoding := base64.StdEncoding + src := iter.SkipAndReturnBytes() + src = src[1 : len(src)-1] + decodedLen := encoding.DecodedLen(len(src)) + dst := make([]byte, decodedLen) + len, err := encoding.Decode(dst, src) + if err != nil { + iter.ReportError("decode base64", err.Error()) + } else { + dst = dst[:len] + codec.sliceType.UnsafeSet(ptr, unsafe.Pointer(&dst)) + } + case ArrayValue: + codec.sliceDecoder.Decode(ptr, iter) + default: + iter.ReportError("base64Codec", "invalid input") + } +} + +func (codec *base64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + src := *((*[]byte)(ptr)) + if len(src) == 0 { + stream.WriteNil() + return + } + encoding := base64.StdEncoding + stream.writeByte('"') + size := encoding.EncodedLen(len(src)) + buf := make([]byte, size) + encoding.Encode(buf, src) + stream.buf = append(stream.buf, buf...) + stream.writeByte('"') +} + +func (codec *base64Codec) IsEmpty(ptr unsafe.Pointer) bool { + return len(*((*[]byte)(ptr))) == 0 +} diff --git a/vendor/github.com/json-iterator/go/feature_reflect_optional.go b/vendor/github.com/json-iterator/go/reflect_optional.go similarity index 52% rename from vendor/github.com/json-iterator/go/feature_reflect_optional.go rename to vendor/github.com/json-iterator/go/reflect_optional.go index fe7055fcd..43ec71d6d 100644 --- a/vendor/github.com/json-iterator/go/feature_reflect_optional.go +++ b/vendor/github.com/json-iterator/go/reflect_optional.go @@ -1,28 +1,31 @@ package jsoniter import ( + "github.com/modern-go/reflect2" "reflect" "unsafe" ) -func decoderOfOptional(cfg *frozenConfig, prefix string, typ reflect.Type) ValDecoder { - elemType := typ.Elem() - decoder := decoderOfType(cfg, prefix, elemType) +func decoderOfOptional(ctx *ctx, typ reflect2.Type) ValDecoder { + ptrType := typ.(*reflect2.UnsafePtrType) + elemType := ptrType.Elem() + decoder := decoderOfType(ctx, elemType) + if ctx.prefix == "" && elemType.Kind() == reflect.Ptr { + return &dereferenceDecoder{elemType, decoder} + } return &OptionalDecoder{elemType, decoder} } -func encoderOfOptional(cfg *frozenConfig, prefix string, typ reflect.Type) ValEncoder { - elemType := typ.Elem() - elemEncoder := encoderOfType(cfg, prefix, elemType) +func encoderOfOptional(ctx *ctx, typ reflect2.Type) ValEncoder { + ptrType := typ.(*reflect2.UnsafePtrType) + elemType := ptrType.Elem() + elemEncoder := encoderOfType(ctx, elemType) encoder := &OptionalEncoder{elemEncoder} - if elemType.Kind() == reflect.Map { - encoder = &OptionalEncoder{encoder} - } return encoder } type OptionalDecoder struct { - ValueType reflect.Type + ValueType reflect2.Type ValueDecoder ValDecoder } @@ -32,10 +35,9 @@ func (decoder *OptionalDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { } else { if *((*unsafe.Pointer)(ptr)) == nil { //pointer to null, we have to allocate memory to hold the value - value := reflect.New(decoder.ValueType) - newPtr := extractInterface(value.Interface()).word + newPtr := decoder.ValueType.UnsafeNew() decoder.ValueDecoder.Decode(newPtr, iter) - *((*uintptr)(ptr)) = uintptr(newPtr) + *((*unsafe.Pointer)(ptr)) = newPtr } else { //reuse existing instance decoder.ValueDecoder.Decode(*((*unsafe.Pointer)(ptr)), iter) @@ -45,17 +47,16 @@ func (decoder *OptionalDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { type dereferenceDecoder struct { // only to deference a pointer - valueType reflect.Type + valueType reflect2.Type valueDecoder ValDecoder } func (decoder *dereferenceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { if *((*unsafe.Pointer)(ptr)) == nil { //pointer to null, we have to allocate memory to hold the value - value := reflect.New(decoder.valueType) - newPtr := extractInterface(value.Interface()).word + newPtr := decoder.valueType.UnsafeNew() decoder.valueDecoder.Decode(newPtr, iter) - *((*uintptr)(ptr)) = uintptr(newPtr) + *((*unsafe.Pointer)(ptr)) = newPtr } else { //reuse existing instance decoder.valueDecoder.Decode(*((*unsafe.Pointer)(ptr)), iter) @@ -74,10 +75,6 @@ func (encoder *OptionalEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { } } -func (encoder *OptionalEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - func (encoder *OptionalEncoder) IsEmpty(ptr unsafe.Pointer) bool { return *((*unsafe.Pointer)(ptr)) == nil } @@ -94,31 +91,43 @@ func (encoder *dereferenceEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { } } -func (encoder *dereferenceEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) +func (encoder *dereferenceEncoder) IsEmpty(ptr unsafe.Pointer) bool { + dePtr := *((*unsafe.Pointer)(ptr)) + if dePtr == nil { + return true + } + return encoder.ValueEncoder.IsEmpty(dePtr) } -func (encoder *dereferenceEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.ValueEncoder.IsEmpty(*((*unsafe.Pointer)(ptr))) +func (encoder *dereferenceEncoder) IsEmbeddedPtrNil(ptr unsafe.Pointer) bool { + deReferenced := *((*unsafe.Pointer)(ptr)) + if deReferenced == nil { + return true + } + isEmbeddedPtrNil, converted := encoder.ValueEncoder.(IsEmbeddedPtrNil) + if !converted { + return false + } + fieldPtr := unsafe.Pointer(deReferenced) + return isEmbeddedPtrNil.IsEmbeddedPtrNil(fieldPtr) } -type optionalMapEncoder struct { - valueEncoder ValEncoder +type referenceEncoder struct { + encoder ValEncoder } -func (encoder *optionalMapEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - if *((*unsafe.Pointer)(ptr)) == nil { - stream.WriteNil() - } else { - encoder.valueEncoder.Encode(*((*unsafe.Pointer)(ptr)), stream) - } +func (encoder *referenceEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + encoder.encoder.Encode(unsafe.Pointer(&ptr), stream) +} + +func (encoder *referenceEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.encoder.IsEmpty(unsafe.Pointer(&ptr)) } -func (encoder *optionalMapEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) +type referenceDecoder struct { + decoder ValDecoder } -func (encoder *optionalMapEncoder) IsEmpty(ptr unsafe.Pointer) bool { - p := *((*unsafe.Pointer)(ptr)) - return p == nil || encoder.valueEncoder.IsEmpty(p) +func (decoder *referenceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + decoder.decoder.Decode(unsafe.Pointer(&ptr), iter) } diff --git a/vendor/github.com/json-iterator/go/reflect_slice.go b/vendor/github.com/json-iterator/go/reflect_slice.go new file mode 100644 index 000000000..9441d79df --- /dev/null +++ b/vendor/github.com/json-iterator/go/reflect_slice.go @@ -0,0 +1,99 @@ +package jsoniter + +import ( + "fmt" + "github.com/modern-go/reflect2" + "io" + "unsafe" +) + +func decoderOfSlice(ctx *ctx, typ reflect2.Type) ValDecoder { + sliceType := typ.(*reflect2.UnsafeSliceType) + decoder := decoderOfType(ctx.append("[sliceElem]"), sliceType.Elem()) + return &sliceDecoder{sliceType, decoder} +} + +func encoderOfSlice(ctx *ctx, typ reflect2.Type) ValEncoder { + sliceType := typ.(*reflect2.UnsafeSliceType) + encoder := encoderOfType(ctx.append("[sliceElem]"), sliceType.Elem()) + return &sliceEncoder{sliceType, encoder} +} + +type sliceEncoder struct { + sliceType *reflect2.UnsafeSliceType + elemEncoder ValEncoder +} + +func (encoder *sliceEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + if encoder.sliceType.UnsafeIsNil(ptr) { + stream.WriteNil() + return + } + length := encoder.sliceType.UnsafeLengthOf(ptr) + if length == 0 { + stream.WriteEmptyArray() + return + } + stream.WriteArrayStart() + encoder.elemEncoder.Encode(encoder.sliceType.UnsafeGetIndex(ptr, 0), stream) + for i := 1; i < length; i++ { + stream.WriteMore() + elemPtr := encoder.sliceType.UnsafeGetIndex(ptr, i) + encoder.elemEncoder.Encode(elemPtr, stream) + } + stream.WriteArrayEnd() + if stream.Error != nil && stream.Error != io.EOF { + stream.Error = fmt.Errorf("%v: %s", encoder.sliceType, stream.Error.Error()) + } +} + +func (encoder *sliceEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.sliceType.UnsafeLengthOf(ptr) == 0 +} + +type sliceDecoder struct { + sliceType *reflect2.UnsafeSliceType + elemDecoder ValDecoder +} + +func (decoder *sliceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + decoder.doDecode(ptr, iter) + if iter.Error != nil && iter.Error != io.EOF { + iter.Error = fmt.Errorf("%v: %s", decoder.sliceType, iter.Error.Error()) + } +} + +func (decoder *sliceDecoder) doDecode(ptr unsafe.Pointer, iter *Iterator) { + c := iter.nextToken() + sliceType := decoder.sliceType + if c == 'n' { + iter.skipThreeBytes('u', 'l', 'l') + sliceType.UnsafeSetNil(ptr) + return + } + if c != '[' { + iter.ReportError("decode slice", "expect [ or n, but found "+string([]byte{c})) + return + } + c = iter.nextToken() + if c == ']' { + sliceType.UnsafeSet(ptr, sliceType.UnsafeMakeSlice(0, 0)) + return + } + iter.unreadByte() + sliceType.UnsafeGrow(ptr, 1) + elemPtr := sliceType.UnsafeGetIndex(ptr, 0) + decoder.elemDecoder.Decode(elemPtr, iter) + length := 1 + for c = iter.nextToken(); c == ','; c = iter.nextToken() { + idx := length + length += 1 + sliceType.UnsafeGrow(ptr, length) + elemPtr = sliceType.UnsafeGetIndex(ptr, idx) + decoder.elemDecoder.Decode(elemPtr, iter) + } + if c != ']' { + iter.ReportError("decode slice", "expect ], but found "+string([]byte{c})) + return + } +} diff --git a/vendor/github.com/json-iterator/go/feature_reflect_struct_decoder.go b/vendor/github.com/json-iterator/go/reflect_struct_decoder.go similarity index 77% rename from vendor/github.com/json-iterator/go/feature_reflect_struct_decoder.go rename to vendor/github.com/json-iterator/go/reflect_struct_decoder.go index d30804855..e718722af 100644 --- a/vendor/github.com/json-iterator/go/feature_reflect_struct_decoder.go +++ b/vendor/github.com/json-iterator/go/reflect_struct_decoder.go @@ -2,14 +2,43 @@ package jsoniter import ( "fmt" + "github.com/modern-go/reflect2" "io" - "reflect" "strings" "unsafe" ) -func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder) ValDecoder { - knownHash := map[int32]struct{}{ +func decoderOfStruct(ctx *ctx, typ reflect2.Type) ValDecoder { + bindings := map[string]*Binding{} + structDescriptor := describeStruct(ctx, typ) + for _, binding := range structDescriptor.Fields { + for _, fromName := range binding.FromNames { + old := bindings[fromName] + if old == nil { + bindings[fromName] = binding + continue + } + ignoreOld, ignoreNew := resolveConflictBinding(ctx.frozenConfig, old, binding) + if ignoreOld { + delete(bindings, fromName) + } + if !ignoreNew { + bindings[fromName] = binding + } + } + } + fields := map[string]*structFieldDecoder{} + for k, binding := range bindings { + fields[k] = binding.Decoder.(*structFieldDecoder) + } + return createStructDecoder(ctx, typ, fields) +} + +func createStructDecoder(ctx *ctx, typ reflect2.Type, fields map[string]*structFieldDecoder) ValDecoder { + if ctx.disallowUnknownFields { + return &generalStructDecoder{typ: typ, fields: fields, disallowUnknownFields: true} + } + knownHash := map[int64]struct{}{ 0: {}, } switch len(fields) { @@ -20,21 +49,21 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldHash := calcHash(fieldName) _, known := knownHash[fieldHash] if known { - return &generalStructDecoder{typ, fields} + return &generalStructDecoder{typ, fields, false} } knownHash[fieldHash] = struct{}{} return &oneFieldStructDecoder{typ, fieldHash, fieldDecoder} } case 2: - var fieldHash1 int32 - var fieldHash2 int32 + var fieldHash1 int64 + var fieldHash2 int64 var fieldDecoder1 *structFieldDecoder var fieldDecoder2 *structFieldDecoder for fieldName, fieldDecoder := range fields { fieldHash := calcHash(fieldName) _, known := knownHash[fieldHash] if known { - return &generalStructDecoder{typ, fields} + return &generalStructDecoder{typ, fields, false} } knownHash[fieldHash] = struct{}{} if fieldHash1 == 0 { @@ -47,9 +76,9 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder } return &twoFieldsStructDecoder{typ, fieldHash1, fieldDecoder1, fieldHash2, fieldDecoder2} case 3: - var fieldName1 int32 - var fieldName2 int32 - var fieldName3 int32 + var fieldName1 int64 + var fieldName2 int64 + var fieldName3 int64 var fieldDecoder1 *structFieldDecoder var fieldDecoder2 *structFieldDecoder var fieldDecoder3 *structFieldDecoder @@ -57,7 +86,7 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldHash := calcHash(fieldName) _, known := knownHash[fieldHash] if known { - return &generalStructDecoder{typ, fields} + return &generalStructDecoder{typ, fields, false} } knownHash[fieldHash] = struct{}{} if fieldName1 == 0 { @@ -76,10 +105,10 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldName2, fieldDecoder2, fieldName3, fieldDecoder3} case 4: - var fieldName1 int32 - var fieldName2 int32 - var fieldName3 int32 - var fieldName4 int32 + var fieldName1 int64 + var fieldName2 int64 + var fieldName3 int64 + var fieldName4 int64 var fieldDecoder1 *structFieldDecoder var fieldDecoder2 *structFieldDecoder var fieldDecoder3 *structFieldDecoder @@ -88,7 +117,7 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldHash := calcHash(fieldName) _, known := knownHash[fieldHash] if known { - return &generalStructDecoder{typ, fields} + return &generalStructDecoder{typ, fields, false} } knownHash[fieldHash] = struct{}{} if fieldName1 == 0 { @@ -111,11 +140,11 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldName3, fieldDecoder3, fieldName4, fieldDecoder4} case 5: - var fieldName1 int32 - var fieldName2 int32 - var fieldName3 int32 - var fieldName4 int32 - var fieldName5 int32 + var fieldName1 int64 + var fieldName2 int64 + var fieldName3 int64 + var fieldName4 int64 + var fieldName5 int64 var fieldDecoder1 *structFieldDecoder var fieldDecoder2 *structFieldDecoder var fieldDecoder3 *structFieldDecoder @@ -125,7 +154,7 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldHash := calcHash(fieldName) _, known := knownHash[fieldHash] if known { - return &generalStructDecoder{typ, fields} + return &generalStructDecoder{typ, fields, false} } knownHash[fieldHash] = struct{}{} if fieldName1 == 0 { @@ -152,12 +181,12 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldName4, fieldDecoder4, fieldName5, fieldDecoder5} case 6: - var fieldName1 int32 - var fieldName2 int32 - var fieldName3 int32 - var fieldName4 int32 - var fieldName5 int32 - var fieldName6 int32 + var fieldName1 int64 + var fieldName2 int64 + var fieldName3 int64 + var fieldName4 int64 + var fieldName5 int64 + var fieldName6 int64 var fieldDecoder1 *structFieldDecoder var fieldDecoder2 *structFieldDecoder var fieldDecoder3 *structFieldDecoder @@ -168,7 +197,7 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldHash := calcHash(fieldName) _, known := knownHash[fieldHash] if known { - return &generalStructDecoder{typ, fields} + return &generalStructDecoder{typ, fields, false} } knownHash[fieldHash] = struct{}{} if fieldName1 == 0 { @@ -199,13 +228,13 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldName5, fieldDecoder5, fieldName6, fieldDecoder6} case 7: - var fieldName1 int32 - var fieldName2 int32 - var fieldName3 int32 - var fieldName4 int32 - var fieldName5 int32 - var fieldName6 int32 - var fieldName7 int32 + var fieldName1 int64 + var fieldName2 int64 + var fieldName3 int64 + var fieldName4 int64 + var fieldName5 int64 + var fieldName6 int64 + var fieldName7 int64 var fieldDecoder1 *structFieldDecoder var fieldDecoder2 *structFieldDecoder var fieldDecoder3 *structFieldDecoder @@ -217,7 +246,7 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldHash := calcHash(fieldName) _, known := knownHash[fieldHash] if known { - return &generalStructDecoder{typ, fields} + return &generalStructDecoder{typ, fields, false} } knownHash[fieldHash] = struct{}{} if fieldName1 == 0 { @@ -252,14 +281,14 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldName6, fieldDecoder6, fieldName7, fieldDecoder7} case 8: - var fieldName1 int32 - var fieldName2 int32 - var fieldName3 int32 - var fieldName4 int32 - var fieldName5 int32 - var fieldName6 int32 - var fieldName7 int32 - var fieldName8 int32 + var fieldName1 int64 + var fieldName2 int64 + var fieldName3 int64 + var fieldName4 int64 + var fieldName5 int64 + var fieldName6 int64 + var fieldName7 int64 + var fieldName8 int64 var fieldDecoder1 *structFieldDecoder var fieldDecoder2 *structFieldDecoder var fieldDecoder3 *structFieldDecoder @@ -272,7 +301,7 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldHash := calcHash(fieldName) _, known := knownHash[fieldHash] if known { - return &generalStructDecoder{typ, fields} + return &generalStructDecoder{typ, fields, false} } knownHash[fieldHash] = struct{}{} if fieldName1 == 0 { @@ -311,15 +340,15 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldName7, fieldDecoder7, fieldName8, fieldDecoder8} case 9: - var fieldName1 int32 - var fieldName2 int32 - var fieldName3 int32 - var fieldName4 int32 - var fieldName5 int32 - var fieldName6 int32 - var fieldName7 int32 - var fieldName8 int32 - var fieldName9 int32 + var fieldName1 int64 + var fieldName2 int64 + var fieldName3 int64 + var fieldName4 int64 + var fieldName5 int64 + var fieldName6 int64 + var fieldName7 int64 + var fieldName8 int64 + var fieldName9 int64 var fieldDecoder1 *structFieldDecoder var fieldDecoder2 *structFieldDecoder var fieldDecoder3 *structFieldDecoder @@ -333,7 +362,7 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldHash := calcHash(fieldName) _, known := knownHash[fieldHash] if known { - return &generalStructDecoder{typ, fields} + return &generalStructDecoder{typ, fields, false} } knownHash[fieldHash] = struct{}{} if fieldName1 == 0 { @@ -376,16 +405,16 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldName8, fieldDecoder8, fieldName9, fieldDecoder9} case 10: - var fieldName1 int32 - var fieldName2 int32 - var fieldName3 int32 - var fieldName4 int32 - var fieldName5 int32 - var fieldName6 int32 - var fieldName7 int32 - var fieldName8 int32 - var fieldName9 int32 - var fieldName10 int32 + var fieldName1 int64 + var fieldName2 int64 + var fieldName3 int64 + var fieldName4 int64 + var fieldName5 int64 + var fieldName6 int64 + var fieldName7 int64 + var fieldName8 int64 + var fieldName9 int64 + var fieldName10 int64 var fieldDecoder1 *structFieldDecoder var fieldDecoder2 *structFieldDecoder var fieldDecoder3 *structFieldDecoder @@ -400,7 +429,7 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldHash := calcHash(fieldName) _, known := knownHash[fieldHash] if known { - return &generalStructDecoder{typ, fields} + return &generalStructDecoder{typ, fields, false} } knownHash[fieldHash] = struct{}{} if fieldName1 == 0 { @@ -447,61 +476,66 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldName9, fieldDecoder9, fieldName10, fieldDecoder10} } - return &generalStructDecoder{typ, fields} + return &generalStructDecoder{typ, fields, false} } type generalStructDecoder struct { - typ reflect.Type - fields map[string]*structFieldDecoder + typ reflect2.Type + fields map[string]*structFieldDecoder + disallowUnknownFields bool } func (decoder *generalStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { if !iter.readObjectStart() { return } - var fieldBytes []byte + decoder.decodeOneField(ptr, iter) + for iter.nextToken() == ',' { + decoder.decodeOneField(ptr, iter) + } + if iter.Error != nil && iter.Error != io.EOF { + iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) + } +} + +func (decoder *generalStructDecoder) decodeOneField(ptr unsafe.Pointer, iter *Iterator) { var field string + var fieldDecoder *structFieldDecoder if iter.cfg.objectFieldMustBeSimpleString { - fieldBytes = iter.readObjectFieldAsBytes() + fieldBytes := iter.ReadStringAsSlice() field = *(*string)(unsafe.Pointer(&fieldBytes)) + fieldDecoder = decoder.fields[field] + if fieldDecoder == nil { + fieldDecoder = decoder.fields[strings.ToLower(field)] + } } else { field = iter.ReadString() - c := iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) + fieldDecoder = decoder.fields[field] + if fieldDecoder == nil { + fieldDecoder = decoder.fields[strings.ToLower(field)] } } - fieldDecoder := decoder.fields[strings.ToLower(field)] if fieldDecoder == nil { - iter.Skip() - } else { - fieldDecoder.Decode(ptr, iter) - } - for iter.nextToken() == ',' { - if iter.cfg.objectFieldMustBeSimpleString { - fieldBytes := iter.readObjectFieldAsBytes() - field = *(*string)(unsafe.Pointer(&fieldBytes)) - } else { - field = iter.ReadString() - c := iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } + msg := "found unknown field: " + field + if decoder.disallowUnknownFields { + iter.ReportError("ReadObject", msg) } - fieldDecoder = decoder.fields[strings.ToLower(field)] - if fieldDecoder == nil { - iter.Skip() - } else { - fieldDecoder.Decode(ptr, iter) + c := iter.nextToken() + if c != ':' { + iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) } + iter.Skip() + return } - if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) + c := iter.nextToken() + if c != ':' { + iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) } + fieldDecoder.Decode(ptr, iter) } type skipObjectDecoder struct { - typ reflect.Type + typ reflect2.Type } func (decoder *skipObjectDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { @@ -514,8 +548,8 @@ func (decoder *skipObjectDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { } type oneFieldStructDecoder struct { - typ reflect.Type - fieldHash int32 + typ reflect2.Type + fieldHash int64 fieldDecoder *structFieldDecoder } @@ -539,10 +573,10 @@ func (decoder *oneFieldStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) } type twoFieldsStructDecoder struct { - typ reflect.Type - fieldHash1 int32 + typ reflect2.Type + fieldHash1 int64 fieldDecoder1 *structFieldDecoder - fieldHash2 int32 + fieldHash2 int64 fieldDecoder2 *structFieldDecoder } @@ -569,12 +603,12 @@ func (decoder *twoFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator } type threeFieldsStructDecoder struct { - typ reflect.Type - fieldHash1 int32 + typ reflect2.Type + fieldHash1 int64 fieldDecoder1 *structFieldDecoder - fieldHash2 int32 + fieldHash2 int64 fieldDecoder2 *structFieldDecoder - fieldHash3 int32 + fieldHash3 int64 fieldDecoder3 *structFieldDecoder } @@ -603,14 +637,14 @@ func (decoder *threeFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterat } type fourFieldsStructDecoder struct { - typ reflect.Type - fieldHash1 int32 + typ reflect2.Type + fieldHash1 int64 fieldDecoder1 *structFieldDecoder - fieldHash2 int32 + fieldHash2 int64 fieldDecoder2 *structFieldDecoder - fieldHash3 int32 + fieldHash3 int64 fieldDecoder3 *structFieldDecoder - fieldHash4 int32 + fieldHash4 int64 fieldDecoder4 *structFieldDecoder } @@ -641,16 +675,16 @@ func (decoder *fourFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterato } type fiveFieldsStructDecoder struct { - typ reflect.Type - fieldHash1 int32 + typ reflect2.Type + fieldHash1 int64 fieldDecoder1 *structFieldDecoder - fieldHash2 int32 + fieldHash2 int64 fieldDecoder2 *structFieldDecoder - fieldHash3 int32 + fieldHash3 int64 fieldDecoder3 *structFieldDecoder - fieldHash4 int32 + fieldHash4 int64 fieldDecoder4 *structFieldDecoder - fieldHash5 int32 + fieldHash5 int64 fieldDecoder5 *structFieldDecoder } @@ -683,18 +717,18 @@ func (decoder *fiveFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterato } type sixFieldsStructDecoder struct { - typ reflect.Type - fieldHash1 int32 + typ reflect2.Type + fieldHash1 int64 fieldDecoder1 *structFieldDecoder - fieldHash2 int32 + fieldHash2 int64 fieldDecoder2 *structFieldDecoder - fieldHash3 int32 + fieldHash3 int64 fieldDecoder3 *structFieldDecoder - fieldHash4 int32 + fieldHash4 int64 fieldDecoder4 *structFieldDecoder - fieldHash5 int32 + fieldHash5 int64 fieldDecoder5 *structFieldDecoder - fieldHash6 int32 + fieldHash6 int64 fieldDecoder6 *structFieldDecoder } @@ -729,20 +763,20 @@ func (decoder *sixFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator } type sevenFieldsStructDecoder struct { - typ reflect.Type - fieldHash1 int32 + typ reflect2.Type + fieldHash1 int64 fieldDecoder1 *structFieldDecoder - fieldHash2 int32 + fieldHash2 int64 fieldDecoder2 *structFieldDecoder - fieldHash3 int32 + fieldHash3 int64 fieldDecoder3 *structFieldDecoder - fieldHash4 int32 + fieldHash4 int64 fieldDecoder4 *structFieldDecoder - fieldHash5 int32 + fieldHash5 int64 fieldDecoder5 *structFieldDecoder - fieldHash6 int32 + fieldHash6 int64 fieldDecoder6 *structFieldDecoder - fieldHash7 int32 + fieldHash7 int64 fieldDecoder7 *structFieldDecoder } @@ -779,22 +813,22 @@ func (decoder *sevenFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterat } type eightFieldsStructDecoder struct { - typ reflect.Type - fieldHash1 int32 + typ reflect2.Type + fieldHash1 int64 fieldDecoder1 *structFieldDecoder - fieldHash2 int32 + fieldHash2 int64 fieldDecoder2 *structFieldDecoder - fieldHash3 int32 + fieldHash3 int64 fieldDecoder3 *structFieldDecoder - fieldHash4 int32 + fieldHash4 int64 fieldDecoder4 *structFieldDecoder - fieldHash5 int32 + fieldHash5 int64 fieldDecoder5 *structFieldDecoder - fieldHash6 int32 + fieldHash6 int64 fieldDecoder6 *structFieldDecoder - fieldHash7 int32 + fieldHash7 int64 fieldDecoder7 *structFieldDecoder - fieldHash8 int32 + fieldHash8 int64 fieldDecoder8 *structFieldDecoder } @@ -833,24 +867,24 @@ func (decoder *eightFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterat } type nineFieldsStructDecoder struct { - typ reflect.Type - fieldHash1 int32 + typ reflect2.Type + fieldHash1 int64 fieldDecoder1 *structFieldDecoder - fieldHash2 int32 + fieldHash2 int64 fieldDecoder2 *structFieldDecoder - fieldHash3 int32 + fieldHash3 int64 fieldDecoder3 *structFieldDecoder - fieldHash4 int32 + fieldHash4 int64 fieldDecoder4 *structFieldDecoder - fieldHash5 int32 + fieldHash5 int64 fieldDecoder5 *structFieldDecoder - fieldHash6 int32 + fieldHash6 int64 fieldDecoder6 *structFieldDecoder - fieldHash7 int32 + fieldHash7 int64 fieldDecoder7 *structFieldDecoder - fieldHash8 int32 + fieldHash8 int64 fieldDecoder8 *structFieldDecoder - fieldHash9 int32 + fieldHash9 int64 fieldDecoder9 *structFieldDecoder } @@ -891,26 +925,26 @@ func (decoder *nineFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterato } type tenFieldsStructDecoder struct { - typ reflect.Type - fieldHash1 int32 + typ reflect2.Type + fieldHash1 int64 fieldDecoder1 *structFieldDecoder - fieldHash2 int32 + fieldHash2 int64 fieldDecoder2 *structFieldDecoder - fieldHash3 int32 + fieldHash3 int64 fieldDecoder3 *structFieldDecoder - fieldHash4 int32 + fieldHash4 int64 fieldDecoder4 *structFieldDecoder - fieldHash5 int32 + fieldHash5 int64 fieldDecoder5 *structFieldDecoder - fieldHash6 int32 + fieldHash6 int64 fieldDecoder6 *structFieldDecoder - fieldHash7 int32 + fieldHash7 int64 fieldDecoder7 *structFieldDecoder - fieldHash8 int32 + fieldHash8 int64 fieldDecoder8 *structFieldDecoder - fieldHash9 int32 + fieldHash9 int64 fieldDecoder9 *structFieldDecoder - fieldHash10 int32 + fieldHash10 int64 fieldDecoder10 *structFieldDecoder } @@ -953,14 +987,48 @@ func (decoder *tenFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator } type structFieldDecoder struct { - field *reflect.StructField + field reflect2.StructField fieldDecoder ValDecoder } func (decoder *structFieldDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - fieldPtr := unsafe.Pointer(uintptr(ptr) + decoder.field.Offset) + fieldPtr := decoder.field.UnsafeGet(ptr) decoder.fieldDecoder.Decode(fieldPtr, iter) if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%s: %s", decoder.field.Name, iter.Error.Error()) + iter.Error = fmt.Errorf("%s: %s", decoder.field.Name(), iter.Error.Error()) + } +} + +type stringModeStringDecoder struct { + elemDecoder ValDecoder + cfg *frozenConfig +} + +func (decoder *stringModeStringDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + decoder.elemDecoder.Decode(ptr, iter) + str := *((*string)(ptr)) + tempIter := decoder.cfg.BorrowIterator([]byte(str)) + defer decoder.cfg.ReturnIterator(tempIter) + *((*string)(ptr)) = tempIter.ReadString() +} + +type stringModeNumberDecoder struct { + elemDecoder ValDecoder +} + +func (decoder *stringModeNumberDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + c := iter.nextToken() + if c != '"' { + iter.ReportError("stringModeNumberDecoder", `expect ", but found `+string([]byte{c})) + return + } + decoder.elemDecoder.Decode(ptr, iter) + if iter.Error != nil { + return + } + c = iter.readByte() + if c != '"' { + iter.ReportError("stringModeNumberDecoder", `expect ", but found `+string([]byte{c})) + return } } diff --git a/vendor/github.com/json-iterator/go/feature_reflect_object.go b/vendor/github.com/json-iterator/go/reflect_struct_encoder.go similarity index 53% rename from vendor/github.com/json-iterator/go/feature_reflect_object.go rename to vendor/github.com/json-iterator/go/reflect_struct_encoder.go index 036545cbe..d0759cf64 100644 --- a/vendor/github.com/json-iterator/go/feature_reflect_object.go +++ b/vendor/github.com/json-iterator/go/reflect_struct_encoder.go @@ -2,20 +2,20 @@ package jsoniter import ( "fmt" + "github.com/modern-go/reflect2" "io" "reflect" - "strings" "unsafe" ) -func encoderOfStruct(cfg *frozenConfig, prefix string, typ reflect.Type) ValEncoder { +func encoderOfStruct(ctx *ctx, typ reflect2.Type) ValEncoder { type bindingTo struct { binding *Binding toName string ignored bool } orderedBindings := []*bindingTo{} - structDescriptor := describeStruct(cfg, prefix, typ) + structDescriptor := describeStruct(ctx, typ) for _, binding := range structDescriptor.Fields { for _, toName := range binding.ToNames { new := &bindingTo{ @@ -26,7 +26,7 @@ func encoderOfStruct(cfg *frozenConfig, prefix string, typ reflect.Type) ValEnco if old.toName != toName { continue } - old.ignored, new.ignored = resolveConflictBinding(cfg, old.binding, new.binding) + old.ignored, new.ignored = resolveConflictBinding(ctx.frozenConfig, old.binding, new.binding) } orderedBindings = append(orderedBindings, new) } @@ -43,13 +43,36 @@ func encoderOfStruct(cfg *frozenConfig, prefix string, typ reflect.Type) ValEnco }) } } - return &structEncoder{typ, structDescriptor.onePtrEmbedded, - structDescriptor.onePtrOptimization, finalOrderedFields} + return &structEncoder{typ, finalOrderedFields} +} + +func createCheckIsEmpty(ctx *ctx, typ reflect2.Type) checkIsEmpty { + encoder := createEncoderOfNative(ctx, typ) + if encoder != nil { + return encoder + } + kind := typ.Kind() + switch kind { + case reflect.Interface: + return &dynamicEncoder{typ} + case reflect.Struct: + return &structEncoder{typ: typ} + case reflect.Array: + return &arrayEncoder{} + case reflect.Slice: + return &sliceEncoder{} + case reflect.Map: + return encoderOfMap(ctx, typ) + case reflect.Ptr: + return &OptionalEncoder{} + default: + return &lazyErrorEncoder{err: fmt.Errorf("unsupported type: %v", typ)} + } } func resolveConflictBinding(cfg *frozenConfig, old, new *Binding) (ignoreOld, ignoreNew bool) { - newTagged := new.Field.Tag.Get(cfg.getTagKey()) != "" - oldTagged := old.Field.Tag.Get(cfg.getTagKey()) != "" + newTagged := new.Field.Tag().Get(cfg.getTagKey()) != "" + oldTagged := old.Field.Tag().Get(cfg.getTagKey()) != "" if newTagged { if oldTagged { if len(old.levels) > len(new.levels) { @@ -76,60 +99,41 @@ func resolveConflictBinding(cfg *frozenConfig, old, new *Binding) (ignoreOld, ig } } -func decoderOfStruct(cfg *frozenConfig, prefix string, typ reflect.Type) ValDecoder { - bindings := map[string]*Binding{} - structDescriptor := describeStruct(cfg, prefix, typ) - for _, binding := range structDescriptor.Fields { - for _, fromName := range binding.FromNames { - old := bindings[fromName] - if old == nil { - bindings[fromName] = binding - continue - } - ignoreOld, ignoreNew := resolveConflictBinding(cfg, old, binding) - if ignoreOld { - delete(bindings, fromName) - } - if !ignoreNew { - bindings[fromName] = binding - } - } - } - fields := map[string]*structFieldDecoder{} - for k, binding := range bindings { - fields[strings.ToLower(k)] = binding.Decoder.(*structFieldDecoder) - } - return createStructDecoder(typ, fields) -} - type structFieldEncoder struct { - field *reflect.StructField + field reflect2.StructField fieldEncoder ValEncoder omitempty bool } func (encoder *structFieldEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - fieldPtr := unsafe.Pointer(uintptr(ptr) + encoder.field.Offset) + fieldPtr := encoder.field.UnsafeGet(ptr) encoder.fieldEncoder.Encode(fieldPtr, stream) if stream.Error != nil && stream.Error != io.EOF { - stream.Error = fmt.Errorf("%s: %s", encoder.field.Name, stream.Error.Error()) + stream.Error = fmt.Errorf("%s: %s", encoder.field.Name(), stream.Error.Error()) } } -func (encoder *structFieldEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - func (encoder *structFieldEncoder) IsEmpty(ptr unsafe.Pointer) bool { - fieldPtr := unsafe.Pointer(uintptr(ptr) + encoder.field.Offset) + fieldPtr := encoder.field.UnsafeGet(ptr) return encoder.fieldEncoder.IsEmpty(fieldPtr) } +func (encoder *structFieldEncoder) IsEmbeddedPtrNil(ptr unsafe.Pointer) bool { + isEmbeddedPtrNil, converted := encoder.fieldEncoder.(IsEmbeddedPtrNil) + if !converted { + return false + } + fieldPtr := encoder.field.UnsafeGet(ptr) + return isEmbeddedPtrNil.IsEmbeddedPtrNil(fieldPtr) +} + +type IsEmbeddedPtrNil interface { + IsEmbeddedPtrNil(ptr unsafe.Pointer) bool +} + type structEncoder struct { - typ reflect.Type - onePtrEmbedded bool - onePtrOptimization bool - fields []structFieldTo + typ reflect2.Type + fields []structFieldTo } type structFieldTo struct { @@ -144,6 +148,9 @@ func (encoder *structEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { if field.encoder.omitempty && field.encoder.IsEmpty(ptr) { continue } + if field.encoder.IsEmbeddedPtrNil(ptr) { + continue + } if isNotFirst { stream.WriteMore() } @@ -157,24 +164,6 @@ func (encoder *structEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { } } -func (encoder *structEncoder) EncodeInterface(val interface{}, stream *Stream) { - e := (*emptyInterface)(unsafe.Pointer(&val)) - if encoder.onePtrOptimization { - if e.word == nil && encoder.onePtrEmbedded { - stream.WriteObjectStart() - stream.WriteObjectEnd() - return - } - ptr := uintptr(e.word) - e.word = unsafe.Pointer(&ptr) - } - if reflect.TypeOf(val).Kind() == reflect.Ptr { - encoder.Encode(unsafe.Pointer(&e.word), stream) - } else { - encoder.Encode(e.word, stream) - } -} - func (encoder *structEncoder) IsEmpty(ptr unsafe.Pointer) bool { return false } @@ -186,10 +175,36 @@ func (encoder *emptyStructEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { stream.WriteEmptyObject() } -func (encoder *emptyStructEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - func (encoder *emptyStructEncoder) IsEmpty(ptr unsafe.Pointer) bool { return false } + +type stringModeNumberEncoder struct { + elemEncoder ValEncoder +} + +func (encoder *stringModeNumberEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.writeByte('"') + encoder.elemEncoder.Encode(ptr, stream) + stream.writeByte('"') +} + +func (encoder *stringModeNumberEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.elemEncoder.IsEmpty(ptr) +} + +type stringModeStringEncoder struct { + elemEncoder ValEncoder + cfg *frozenConfig +} + +func (encoder *stringModeStringEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + tempStream := encoder.cfg.BorrowStream(nil) + defer encoder.cfg.ReturnStream(tempStream) + encoder.elemEncoder.Encode(ptr, tempStream) + stream.WriteString(string(tempStream.Buffer())) +} + +func (encoder *stringModeStringEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.elemEncoder.IsEmpty(ptr) +} diff --git a/vendor/github.com/json-iterator/go/skip_tests/array/inputs.go b/vendor/github.com/json-iterator/go/skip_tests/array/inputs.go deleted file mode 100644 index 8fb74ac00..000000000 --- a/vendor/github.com/json-iterator/go/skip_tests/array/inputs.go +++ /dev/null @@ -1,12 +0,0 @@ -package test - -type typeForTest []interface{} - -var inputs = []string{ - `[]`, // valid - `[1]`, // valid - `[ 1, "hello"]`, // valid - `[abc]`, // invalid - `[`, // invalid - `[[]`, // invalid -} diff --git a/vendor/github.com/json-iterator/go/skip_tests/array/skip_test.go b/vendor/github.com/json-iterator/go/skip_tests/array/skip_test.go deleted file mode 100644 index 8d24ef07f..000000000 --- a/vendor/github.com/json-iterator/go/skip_tests/array/skip_test.go +++ /dev/null @@ -1,34 +0,0 @@ -package test - -import ( - "encoding/json" - "errors" - "github.com/json-iterator/go" - "github.com/stretchr/testify/require" - "io" - "testing" -) - -func Test_skip(t *testing.T) { - for _, input := range inputs { - t.Run(input, func(t *testing.T) { - should := require.New(t) - var dst typeForTest - stdErr := json.Unmarshal([]byte(input), &dst) - iter := jsoniter.ParseString(jsoniter.ConfigDefault, input) - iter.Skip() - iter.ReadNil() // trigger looking forward - err := iter.Error - if err == io.EOF { - err = nil - } else { - err = errors.New("remaining bytes") - } - if stdErr == nil { - should.Nil(err) - } else { - should.NotNil(err) - } - }) - } -} diff --git a/vendor/github.com/json-iterator/go/skip_tests/array_test.go b/vendor/github.com/json-iterator/go/skip_tests/array_test.go new file mode 100644 index 000000000..12e42a13a --- /dev/null +++ b/vendor/github.com/json-iterator/go/skip_tests/array_test.go @@ -0,0 +1,15 @@ +package skip_tests + +func init() { + testCases = append(testCases, testCase{ + ptr: (*[]interface{})(nil), + inputs: []string{ + `[]`, // valid + `[1]`, // valid + `[ 1, "hello"]`, // valid + `[abc]`, // invalid + `[`, // invalid + `[[]`, // invalid + }, + }) +} diff --git a/vendor/github.com/json-iterator/go/skip_tests/float64_test.go b/vendor/github.com/json-iterator/go/skip_tests/float64_test.go new file mode 100644 index 000000000..bc90f24f5 --- /dev/null +++ b/vendor/github.com/json-iterator/go/skip_tests/float64_test.go @@ -0,0 +1,20 @@ +package skip_tests + +func init() { + testCases = append(testCases, testCase{ + ptr: (*float64)(nil), + inputs: []string{ + "+1", // invalid + "-a", // invalid + "-\x00", // invalid, zero byte + "0.1", // valid + "0..1", // invalid, more dot + "1e+1", // valid + "1+1", // invalid + "1E1", // valid, e or E + "1ee1", // invalid + "100a", // invalid + "10.", // invalid + }, + }) +} diff --git a/vendor/github.com/json-iterator/go/jsoniter_skip_test.go b/vendor/github.com/json-iterator/go/skip_tests/jsoniter_skip_test.go similarity index 76% rename from vendor/github.com/json-iterator/go/jsoniter_skip_test.go rename to vendor/github.com/json-iterator/go/skip_tests/jsoniter_skip_test.go index cb13e507c..bf054d1c3 100644 --- a/vendor/github.com/json-iterator/go/jsoniter_skip_test.go +++ b/vendor/github.com/json-iterator/go/skip_tests/jsoniter_skip_test.go @@ -1,16 +1,17 @@ -package jsoniter +package skip_tests import ( "bytes" "encoding/json" "testing" + "github.com/json-iterator/go" "github.com/stretchr/testify/require" ) func Test_skip_number_in_array(t *testing.T) { should := require.New(t) - iter := ParseString(ConfigDefault, `[-0.12, "stream"]`) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `[-0.12, "stream"]`) iter.ReadArray() iter.Skip() iter.ReadArray() @@ -20,7 +21,7 @@ func Test_skip_number_in_array(t *testing.T) { func Test_skip_string_in_array(t *testing.T) { should := require.New(t) - iter := ParseString(ConfigDefault, `["hello", "stream"]`) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `["hello", "stream"]`) iter.ReadArray() iter.Skip() iter.ReadArray() @@ -29,7 +30,7 @@ func Test_skip_string_in_array(t *testing.T) { } func Test_skip_null(t *testing.T) { - iter := ParseString(ConfigDefault, `[null , "stream"]`) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `[null , "stream"]`) iter.ReadArray() iter.Skip() iter.ReadArray() @@ -39,7 +40,7 @@ func Test_skip_null(t *testing.T) { } func Test_skip_true(t *testing.T) { - iter := ParseString(ConfigDefault, `[true , "stream"]`) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `[true , "stream"]`) iter.ReadArray() iter.Skip() iter.ReadArray() @@ -49,7 +50,7 @@ func Test_skip_true(t *testing.T) { } func Test_skip_false(t *testing.T) { - iter := ParseString(ConfigDefault, `[false , "stream"]`) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `[false , "stream"]`) iter.ReadArray() iter.Skip() iter.ReadArray() @@ -59,7 +60,7 @@ func Test_skip_false(t *testing.T) { } func Test_skip_array(t *testing.T) { - iter := ParseString(ConfigDefault, `[[1, [2, [3], 4]], "stream"]`) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `[[1, [2, [3], 4]], "stream"]`) iter.ReadArray() iter.Skip() iter.ReadArray() @@ -69,7 +70,7 @@ func Test_skip_array(t *testing.T) { } func Test_skip_empty_array(t *testing.T) { - iter := ParseString(ConfigDefault, `[ [ ], "stream"]`) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `[ [ ], "stream"]`) iter.ReadArray() iter.Skip() iter.ReadArray() @@ -79,7 +80,7 @@ func Test_skip_empty_array(t *testing.T) { } func Test_skip_nested(t *testing.T) { - iter := ParseString(ConfigDefault, `[ {"a" : [{"stream": "c"}], "d": 102 }, "stream"]`) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `[ {"a" : [{"stream": "c"}], "d": 102 }, "stream"]`) iter.ReadArray() iter.Skip() iter.ReadArray() @@ -90,7 +91,7 @@ func Test_skip_nested(t *testing.T) { func Test_skip_and_return_bytes(t *testing.T) { should := require.New(t) - iter := ParseString(ConfigDefault, `[ {"a" : [{"stream": "c"}], "d": 102 }, "stream"]`) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, `[ {"a" : [{"stream": "c"}], "d": 102 }, "stream"]`) iter.ReadArray() skipped := iter.SkipAndReturnBytes() should.Equal(`{"a" : [{"stream": "c"}], "d": 102 }`, string(skipped)) @@ -98,7 +99,7 @@ func Test_skip_and_return_bytes(t *testing.T) { func Test_skip_and_return_bytes_with_reader(t *testing.T) { should := require.New(t) - iter := Parse(ConfigDefault, bytes.NewBufferString(`[ {"a" : [{"stream": "c"}], "d": 102 }, "stream"]`), 4) + iter := jsoniter.Parse(jsoniter.ConfigDefault, bytes.NewBufferString(`[ {"a" : [{"stream": "c"}], "d": 102 }, "stream"]`), 4) iter.ReadArray() skipped := iter.SkipAndReturnBytes() should.Equal(`{"a" : [{"stream": "c"}], "d": 102 }`, string(skipped)) @@ -106,7 +107,7 @@ func Test_skip_and_return_bytes_with_reader(t *testing.T) { func Test_skip_empty(t *testing.T) { should := require.New(t) - should.NotNil(Get([]byte("")).LastError()) + should.NotNil(jsoniter.Get([]byte("")).LastError()) } type TestResp struct { @@ -140,7 +141,7 @@ func Benchmark_jsoniter_skip(b *testing.B) { }`) for n := 0; n < b.N; n++ { result := TestResp{} - iter := ParseBytes(ConfigDefault, input) + iter := jsoniter.ParseBytes(jsoniter.ConfigDefault, input) for field := iter.ReadObject(); field != ""; field = iter.ReadObject() { switch field { case "code": diff --git a/vendor/github.com/json-iterator/go/skip_tests/number/inputs.go b/vendor/github.com/json-iterator/go/skip_tests/number/inputs.go deleted file mode 100644 index 4eaca2ffd..000000000 --- a/vendor/github.com/json-iterator/go/skip_tests/number/inputs.go +++ /dev/null @@ -1,17 +0,0 @@ -package test - -type typeForTest float64 - -var inputs = []string{ - "+1", // invalid - "-a", // invalid - "-\x00", // invalid, zero byte - "0.1", // valid - "0..1", // invalid, more dot - "1e+1", // valid - "1+1", // invalid - "1E1", // valid, e or E - "1ee1", // invalid - "100a", // invalid - "10.", // invalid -} diff --git a/vendor/github.com/json-iterator/go/skip_tests/number/skip_test.go b/vendor/github.com/json-iterator/go/skip_tests/number/skip_test.go deleted file mode 100644 index 8d24ef07f..000000000 --- a/vendor/github.com/json-iterator/go/skip_tests/number/skip_test.go +++ /dev/null @@ -1,34 +0,0 @@ -package test - -import ( - "encoding/json" - "errors" - "github.com/json-iterator/go" - "github.com/stretchr/testify/require" - "io" - "testing" -) - -func Test_skip(t *testing.T) { - for _, input := range inputs { - t.Run(input, func(t *testing.T) { - should := require.New(t) - var dst typeForTest - stdErr := json.Unmarshal([]byte(input), &dst) - iter := jsoniter.ParseString(jsoniter.ConfigDefault, input) - iter.Skip() - iter.ReadNil() // trigger looking forward - err := iter.Error - if err == io.EOF { - err = nil - } else { - err = errors.New("remaining bytes") - } - if stdErr == nil { - should.Nil(err) - } else { - should.NotNil(err) - } - }) - } -} diff --git a/vendor/github.com/json-iterator/go/skip_tests/object/inputs.go b/vendor/github.com/json-iterator/go/skip_tests/object/inputs.go deleted file mode 100644 index 91ad60f32..000000000 --- a/vendor/github.com/json-iterator/go/skip_tests/object/inputs.go +++ /dev/null @@ -1,16 +0,0 @@ -package test - -type typeForTest struct{} - -var inputs = []string{ - `{}`, // valid - `{"hello":"world"}`, // valid - `{hello:"world"}`, // invalid - `{"hello:"world"}`, // invalid - `{"hello","world"}`, // invalid - `{"hello":{}`, // invalid - `{"hello":{}}`, // valid - `{"hello":{}}}`, // invalid - `{"hello": { "hello": 1}}`, // valid - `{abc}`, // invalid -} diff --git a/vendor/github.com/json-iterator/go/skip_tests/object/skip_test.go b/vendor/github.com/json-iterator/go/skip_tests/object/skip_test.go deleted file mode 100644 index 8d24ef07f..000000000 --- a/vendor/github.com/json-iterator/go/skip_tests/object/skip_test.go +++ /dev/null @@ -1,34 +0,0 @@ -package test - -import ( - "encoding/json" - "errors" - "github.com/json-iterator/go" - "github.com/stretchr/testify/require" - "io" - "testing" -) - -func Test_skip(t *testing.T) { - for _, input := range inputs { - t.Run(input, func(t *testing.T) { - should := require.New(t) - var dst typeForTest - stdErr := json.Unmarshal([]byte(input), &dst) - iter := jsoniter.ParseString(jsoniter.ConfigDefault, input) - iter.Skip() - iter.ReadNil() // trigger looking forward - err := iter.Error - if err == io.EOF { - err = nil - } else { - err = errors.New("remaining bytes") - } - if stdErr == nil { - should.Nil(err) - } else { - should.NotNil(err) - } - }) - } -} diff --git a/vendor/github.com/json-iterator/go/skip_tests/skip_test.go b/vendor/github.com/json-iterator/go/skip_tests/skip_test.go new file mode 100644 index 000000000..3295e6f4c --- /dev/null +++ b/vendor/github.com/json-iterator/go/skip_tests/skip_test.go @@ -0,0 +1,45 @@ +package skip_tests + +import ( + "encoding/json" + "errors" + "github.com/json-iterator/go" + "github.com/stretchr/testify/require" + "io" + "reflect" + "testing" +) + +type testCase struct { + ptr interface{} + inputs []string +} + +var testCases []testCase + +func Test_skip(t *testing.T) { + for _, testCase := range testCases { + valType := reflect.TypeOf(testCase.ptr).Elem() + for _, input := range testCase.inputs { + t.Run(input, func(t *testing.T) { + should := require.New(t) + ptrVal := reflect.New(valType) + stdErr := json.Unmarshal([]byte(input), ptrVal.Interface()) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, input) + iter.Skip() + iter.ReadNil() // trigger looking forward + err := iter.Error + if err == io.EOF { + err = nil + } else { + err = errors.New("remaining bytes") + } + if stdErr == nil { + should.Nil(err) + } else { + should.NotNil(err) + } + }) + } + } +} diff --git a/vendor/github.com/json-iterator/go/skip_tests/string/inputs.go b/vendor/github.com/json-iterator/go/skip_tests/string/inputs.go deleted file mode 100644 index 692393db5..000000000 --- a/vendor/github.com/json-iterator/go/skip_tests/string/inputs.go +++ /dev/null @@ -1,14 +0,0 @@ -package test - -type typeForTest string - -var inputs = []string{ - `""`, // valid - `"hello"`, // valid - `"`, // invalid - `"\"`, // invalid - `"\x00"`, // invalid - "\"\x00\"", // invalid - "\"\t\"", // invalid - `"\t"`, // valid -} diff --git a/vendor/github.com/json-iterator/go/skip_tests/string/skip_test.go b/vendor/github.com/json-iterator/go/skip_tests/string/skip_test.go deleted file mode 100644 index 8d24ef07f..000000000 --- a/vendor/github.com/json-iterator/go/skip_tests/string/skip_test.go +++ /dev/null @@ -1,34 +0,0 @@ -package test - -import ( - "encoding/json" - "errors" - "github.com/json-iterator/go" - "github.com/stretchr/testify/require" - "io" - "testing" -) - -func Test_skip(t *testing.T) { - for _, input := range inputs { - t.Run(input, func(t *testing.T) { - should := require.New(t) - var dst typeForTest - stdErr := json.Unmarshal([]byte(input), &dst) - iter := jsoniter.ParseString(jsoniter.ConfigDefault, input) - iter.Skip() - iter.ReadNil() // trigger looking forward - err := iter.Error - if err == io.EOF { - err = nil - } else { - err = errors.New("remaining bytes") - } - if stdErr == nil { - should.Nil(err) - } else { - should.NotNil(err) - } - }) - } -} diff --git a/vendor/github.com/json-iterator/go/skip_tests/string_test.go b/vendor/github.com/json-iterator/go/skip_tests/string_test.go new file mode 100644 index 000000000..d37777165 --- /dev/null +++ b/vendor/github.com/json-iterator/go/skip_tests/string_test.go @@ -0,0 +1,17 @@ +package skip_tests + +func init() { + testCases = append(testCases, testCase{ + ptr: (*string)(nil), + inputs: []string{ + `""`, // valid + `"hello"`, // valid + `"`, // invalid + `"\"`, // invalid + `"\x00"`, // invalid + "\"\x00\"", // invalid + "\"\t\"", // invalid + `"\t"`, // valid + }, + }) +} diff --git a/vendor/github.com/json-iterator/go/skip_tests/struct_test.go b/vendor/github.com/json-iterator/go/skip_tests/struct_test.go new file mode 100644 index 000000000..7f1571da1 --- /dev/null +++ b/vendor/github.com/json-iterator/go/skip_tests/struct_test.go @@ -0,0 +1,19 @@ +package skip_tests + +func init() { + testCases = append(testCases, testCase{ + ptr: (*struct{})(nil), + inputs: []string{ + `{}`, // valid + `{"hello":"world"}`, // valid + `{hello:"world"}`, // invalid + `{"hello:"world"}`, // invalid + `{"hello","world"}`, // invalid + `{"hello":{}`, // invalid + `{"hello":{}}`, // valid + `{"hello":{}}}`, // invalid + `{"hello": { "hello": 1}}`, // valid + `{abc}`, // invalid + }, + }) +} diff --git a/vendor/github.com/json-iterator/go/feature_stream.go b/vendor/github.com/json-iterator/go/stream.go similarity index 62% rename from vendor/github.com/json-iterator/go/feature_stream.go rename to vendor/github.com/json-iterator/go/stream.go index 97355eb5b..17662fded 100644 --- a/vendor/github.com/json-iterator/go/feature_stream.go +++ b/vendor/github.com/json-iterator/go/stream.go @@ -10,7 +10,6 @@ type Stream struct { cfg *frozenConfig out io.Writer buf []byte - n int Error error indention int Attachment interface{} // open for customized encoder @@ -24,8 +23,7 @@ func NewStream(cfg API, out io.Writer, bufSize int) *Stream { return &Stream{ cfg: cfg.(*frozenConfig), out: out, - buf: make([]byte, bufSize), - n: 0, + buf: make([]byte, 0, bufSize), Error: nil, indention: 0, } @@ -39,22 +37,27 @@ func (stream *Stream) Pool() StreamPool { // Reset reuse this stream instance by assign a new writer func (stream *Stream) Reset(out io.Writer) { stream.out = out - stream.n = 0 + stream.buf = stream.buf[:0] } // Available returns how many bytes are unused in the buffer. func (stream *Stream) Available() int { - return len(stream.buf) - stream.n + return cap(stream.buf) - len(stream.buf) } // Buffered returns the number of bytes that have been written into the current buffer. func (stream *Stream) Buffered() int { - return stream.n + return len(stream.buf) } // Buffer if writer is nil, use this method to take the result func (stream *Stream) Buffer() []byte { - return stream.buf[:stream.n] + return stream.buf +} + +// SetBuffer allows to append to the internal buffer directly +func (stream *Stream) SetBuffer(buf []byte) { + stream.buf = buf } // Write writes the contents of p into the buffer. @@ -62,97 +65,34 @@ func (stream *Stream) Buffer() []byte { // If nn < len(p), it also returns an error explaining // why the write is short. func (stream *Stream) Write(p []byte) (nn int, err error) { - for len(p) > stream.Available() && stream.Error == nil { - if stream.out == nil { - stream.growAtLeast(len(p)) - } else { - var n int - if stream.Buffered() == 0 { - // Large write, empty buffer. - // Write directly from p to avoid copy. - n, stream.Error = stream.out.Write(p) - } else { - n = copy(stream.buf[stream.n:], p) - stream.n += n - stream.Flush() - } - nn += n - p = p[n:] - } - } - if stream.Error != nil { - return nn, stream.Error + stream.buf = append(stream.buf, p...) + if stream.out != nil { + nn, err = stream.out.Write(stream.buf) + stream.buf = stream.buf[nn:] + return } - n := copy(stream.buf[stream.n:], p) - stream.n += n - nn += n - return nn, nil + return len(p), nil } // WriteByte writes a single byte. func (stream *Stream) writeByte(c byte) { - if stream.Error != nil { - return - } - if stream.Available() < 1 { - stream.growAtLeast(1) - } - stream.buf[stream.n] = c - stream.n++ + stream.buf = append(stream.buf, c) } func (stream *Stream) writeTwoBytes(c1 byte, c2 byte) { - if stream.Error != nil { - return - } - if stream.Available() < 2 { - stream.growAtLeast(2) - } - stream.buf[stream.n] = c1 - stream.buf[stream.n+1] = c2 - stream.n += 2 + stream.buf = append(stream.buf, c1, c2) } func (stream *Stream) writeThreeBytes(c1 byte, c2 byte, c3 byte) { - if stream.Error != nil { - return - } - if stream.Available() < 3 { - stream.growAtLeast(3) - } - stream.buf[stream.n] = c1 - stream.buf[stream.n+1] = c2 - stream.buf[stream.n+2] = c3 - stream.n += 3 + stream.buf = append(stream.buf, c1, c2, c3) } func (stream *Stream) writeFourBytes(c1 byte, c2 byte, c3 byte, c4 byte) { - if stream.Error != nil { - return - } - if stream.Available() < 4 { - stream.growAtLeast(4) - } - stream.buf[stream.n] = c1 - stream.buf[stream.n+1] = c2 - stream.buf[stream.n+2] = c3 - stream.buf[stream.n+3] = c4 - stream.n += 4 + stream.buf = append(stream.buf, c1, c2, c3, c4) } func (stream *Stream) writeFiveBytes(c1 byte, c2 byte, c3 byte, c4 byte, c5 byte) { - if stream.Error != nil { - return - } - if stream.Available() < 5 { - stream.growAtLeast(5) - } - stream.buf[stream.n] = c1 - stream.buf[stream.n+1] = c2 - stream.buf[stream.n+2] = c3 - stream.buf[stream.n+3] = c4 - stream.buf[stream.n+4] = c5 - stream.n += 5 + stream.buf = append(stream.buf, c1, c2, c3, c4, c5) } // Flush writes any buffered data to the underlying io.Writer. @@ -163,56 +103,20 @@ func (stream *Stream) Flush() error { if stream.Error != nil { return stream.Error } - if stream.n == 0 { - return nil - } - n, err := stream.out.Write(stream.buf[0:stream.n]) - if n < stream.n && err == nil { - err = io.ErrShortWrite - } + n, err := stream.out.Write(stream.buf) if err != nil { - if n > 0 && n < stream.n { - copy(stream.buf[0:stream.n-n], stream.buf[n:stream.n]) + if stream.Error == nil { + stream.Error = err } - stream.n -= n - stream.Error = err return err } - stream.n = 0 + stream.buf = stream.buf[n:] return nil } -func (stream *Stream) ensure(minimal int) { - available := stream.Available() - if available < minimal { - stream.growAtLeast(minimal) - } -} - -func (stream *Stream) growAtLeast(minimal int) { - if stream.out != nil { - stream.Flush() - if stream.Available() >= minimal { - return - } - } - toGrow := len(stream.buf) - if toGrow < minimal { - toGrow = minimal - } - newBuf := make([]byte, len(stream.buf)+toGrow) - copy(newBuf, stream.Buffer()) - stream.buf = newBuf -} - // WriteRaw write string out without quotes, just like []byte func (stream *Stream) WriteRaw(s string) { - stream.ensure(len(s)) - if stream.Error != nil { - return - } - n := copy(stream.buf[stream.n:], s) - stream.n += n + stream.buf = append(stream.buf, s...) } // WriteNil write null to stream @@ -273,6 +177,7 @@ func (stream *Stream) WriteEmptyObject() { func (stream *Stream) WriteMore() { stream.writeByte(',') stream.writeIndention(0) + stream.Flush() } // WriteArrayStart write [ with possible indention @@ -300,9 +205,7 @@ func (stream *Stream) writeIndention(delta int) { } stream.writeByte('\n') toWrite := stream.indention - delta - stream.ensure(toWrite) - for i := 0; i < toWrite && stream.n < len(stream.buf); i++ { - stream.buf[stream.n] = ' ' - stream.n++ + for i := 0; i < toWrite; i++ { + stream.buf = append(stream.buf, ' ') } } diff --git a/vendor/github.com/json-iterator/go/feature_stream_float.go b/vendor/github.com/json-iterator/go/stream_float.go similarity index 85% rename from vendor/github.com/json-iterator/go/feature_stream_float.go rename to vendor/github.com/json-iterator/go/stream_float.go index 9a404e11d..f318d2c59 100644 --- a/vendor/github.com/json-iterator/go/feature_stream_float.go +++ b/vendor/github.com/json-iterator/go/stream_float.go @@ -21,7 +21,7 @@ func (stream *Stream) WriteFloat32(val float32) { fmt = 'e' } } - stream.WriteRaw(strconv.FormatFloat(float64(val), fmt, -1, 32)) + stream.buf = strconv.AppendFloat(stream.buf, float64(val), fmt, -1, 32) } // WriteFloat32Lossy write float32 to stream with ONLY 6 digits precision although much much faster @@ -43,13 +43,12 @@ func (stream *Stream) WriteFloat32Lossy(val float32) { return } stream.writeByte('.') - stream.ensure(10) for p := precision - 1; p > 0 && fval < pow10[p]; p-- { stream.writeByte('0') } stream.WriteUint64(fval) - for stream.buf[stream.n-1] == '0' { - stream.n-- + for stream.buf[len(stream.buf)-1] == '0' { + stream.buf = stream.buf[:len(stream.buf)-1] } } @@ -63,7 +62,7 @@ func (stream *Stream) WriteFloat64(val float64) { fmt = 'e' } } - stream.WriteRaw(strconv.FormatFloat(float64(val), fmt, -1, 64)) + stream.buf = strconv.AppendFloat(stream.buf, float64(val), fmt, -1, 64) } // WriteFloat64Lossy write float64 to stream with ONLY 6 digits precision although much much faster @@ -85,12 +84,11 @@ func (stream *Stream) WriteFloat64Lossy(val float64) { return } stream.writeByte('.') - stream.ensure(10) for p := precision - 1; p > 0 && fval < pow10[p]; p-- { stream.writeByte('0') } stream.WriteUint64(fval) - for stream.buf[stream.n-1] == '0' { - stream.n-- + for stream.buf[len(stream.buf)-1] == '0' { + stream.buf = stream.buf[:len(stream.buf)-1] } } diff --git a/vendor/github.com/json-iterator/go/stream_int.go b/vendor/github.com/json-iterator/go/stream_int.go new file mode 100644 index 000000000..d1059ee4c --- /dev/null +++ b/vendor/github.com/json-iterator/go/stream_int.go @@ -0,0 +1,190 @@ +package jsoniter + +var digits []uint32 + +func init() { + digits = make([]uint32, 1000) + for i := uint32(0); i < 1000; i++ { + digits[i] = (((i / 100) + '0') << 16) + ((((i / 10) % 10) + '0') << 8) + i%10 + '0' + if i < 10 { + digits[i] += 2 << 24 + } else if i < 100 { + digits[i] += 1 << 24 + } + } +} + +func writeFirstBuf(space []byte, v uint32) []byte { + start := v >> 24 + if start == 0 { + space = append(space, byte(v>>16), byte(v>>8)) + } else if start == 1 { + space = append(space, byte(v>>8)) + } + space = append(space, byte(v)) + return space +} + +func writeBuf(buf []byte, v uint32) []byte { + return append(buf, byte(v>>16), byte(v>>8), byte(v)) +} + +// WriteUint8 write uint8 to stream +func (stream *Stream) WriteUint8(val uint8) { + stream.buf = writeFirstBuf(stream.buf, digits[val]) +} + +// WriteInt8 write int8 to stream +func (stream *Stream) WriteInt8(nval int8) { + var val uint8 + if nval < 0 { + val = uint8(-nval) + stream.buf = append(stream.buf, '-') + } else { + val = uint8(nval) + } + stream.buf = writeFirstBuf(stream.buf, digits[val]) +} + +// WriteUint16 write uint16 to stream +func (stream *Stream) WriteUint16(val uint16) { + q1 := val / 1000 + if q1 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[val]) + return + } + r1 := val - q1*1000 + stream.buf = writeFirstBuf(stream.buf, digits[q1]) + stream.buf = writeBuf(stream.buf, digits[r1]) + return +} + +// WriteInt16 write int16 to stream +func (stream *Stream) WriteInt16(nval int16) { + var val uint16 + if nval < 0 { + val = uint16(-nval) + stream.buf = append(stream.buf, '-') + } else { + val = uint16(nval) + } + stream.WriteUint16(val) +} + +// WriteUint32 write uint32 to stream +func (stream *Stream) WriteUint32(val uint32) { + q1 := val / 1000 + if q1 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[val]) + return + } + r1 := val - q1*1000 + q2 := q1 / 1000 + if q2 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[q1]) + stream.buf = writeBuf(stream.buf, digits[r1]) + return + } + r2 := q1 - q2*1000 + q3 := q2 / 1000 + if q3 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[q2]) + } else { + r3 := q2 - q3*1000 + stream.buf = append(stream.buf, byte(q3+'0')) + stream.buf = writeBuf(stream.buf, digits[r3]) + } + stream.buf = writeBuf(stream.buf, digits[r2]) + stream.buf = writeBuf(stream.buf, digits[r1]) +} + +// WriteInt32 write int32 to stream +func (stream *Stream) WriteInt32(nval int32) { + var val uint32 + if nval < 0 { + val = uint32(-nval) + stream.buf = append(stream.buf, '-') + } else { + val = uint32(nval) + } + stream.WriteUint32(val) +} + +// WriteUint64 write uint64 to stream +func (stream *Stream) WriteUint64(val uint64) { + q1 := val / 1000 + if q1 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[val]) + return + } + r1 := val - q1*1000 + q2 := q1 / 1000 + if q2 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[q1]) + stream.buf = writeBuf(stream.buf, digits[r1]) + return + } + r2 := q1 - q2*1000 + q3 := q2 / 1000 + if q3 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[q2]) + stream.buf = writeBuf(stream.buf, digits[r2]) + stream.buf = writeBuf(stream.buf, digits[r1]) + return + } + r3 := q2 - q3*1000 + q4 := q3 / 1000 + if q4 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[q3]) + stream.buf = writeBuf(stream.buf, digits[r3]) + stream.buf = writeBuf(stream.buf, digits[r2]) + stream.buf = writeBuf(stream.buf, digits[r1]) + return + } + r4 := q3 - q4*1000 + q5 := q4 / 1000 + if q5 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[q4]) + stream.buf = writeBuf(stream.buf, digits[r4]) + stream.buf = writeBuf(stream.buf, digits[r3]) + stream.buf = writeBuf(stream.buf, digits[r2]) + stream.buf = writeBuf(stream.buf, digits[r1]) + return + } + r5 := q4 - q5*1000 + q6 := q5 / 1000 + if q6 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[q5]) + } else { + stream.buf = writeFirstBuf(stream.buf, digits[q6]) + r6 := q5 - q6*1000 + stream.buf = writeBuf(stream.buf, digits[r6]) + } + stream.buf = writeBuf(stream.buf, digits[r5]) + stream.buf = writeBuf(stream.buf, digits[r4]) + stream.buf = writeBuf(stream.buf, digits[r3]) + stream.buf = writeBuf(stream.buf, digits[r2]) + stream.buf = writeBuf(stream.buf, digits[r1]) +} + +// WriteInt64 write int64 to stream +func (stream *Stream) WriteInt64(nval int64) { + var val uint64 + if nval < 0 { + val = uint64(-nval) + stream.buf = append(stream.buf, '-') + } else { + val = uint64(nval) + } + stream.WriteUint64(val) +} + +// WriteInt write int to stream +func (stream *Stream) WriteInt(val int) { + stream.WriteInt64(int64(val)) +} + +// WriteUint write uint to stream +func (stream *Stream) WriteUint(val uint) { + stream.WriteUint64(uint64(val)) +} diff --git a/vendor/github.com/json-iterator/go/feature_stream_string.go b/vendor/github.com/json-iterator/go/stream_str.go similarity index 91% rename from vendor/github.com/json-iterator/go/feature_stream_string.go rename to vendor/github.com/json-iterator/go/stream_str.go index 334282f05..54c2ba0b3 100644 --- a/vendor/github.com/json-iterator/go/feature_stream_string.go +++ b/vendor/github.com/json-iterator/go/stream_str.go @@ -219,34 +219,22 @@ var hex = "0123456789abcdef" // WriteStringWithHTMLEscaped write string to stream with html special characters escaped func (stream *Stream) WriteStringWithHTMLEscaped(s string) { - stream.ensure(32) valLen := len(s) - toWriteLen := valLen - bufLengthMinusTwo := len(stream.buf) - 2 // make room for the quotes - if stream.n+toWriteLen > bufLengthMinusTwo { - toWriteLen = bufLengthMinusTwo - stream.n - } - n := stream.n - stream.buf[n] = '"' - n++ + stream.buf = append(stream.buf, '"') // write string, the fast path, without utf8 and escape support i := 0 - for ; i < toWriteLen; i++ { + for ; i < valLen; i++ { c := s[i] if c < utf8.RuneSelf && htmlSafeSet[c] { - stream.buf[n] = c - n++ + stream.buf = append(stream.buf, c) } else { break } } if i == valLen { - stream.buf[n] = '"' - n++ - stream.n = n + stream.buf = append(stream.buf, '"') return } - stream.n = n writeStringSlowPathWithHTMLEscaped(stream, i, s, valLen) } @@ -321,34 +309,22 @@ func writeStringSlowPathWithHTMLEscaped(stream *Stream, i int, s string, valLen // WriteString write string to stream without html escape func (stream *Stream) WriteString(s string) { - stream.ensure(32) valLen := len(s) - toWriteLen := valLen - bufLengthMinusTwo := len(stream.buf) - 2 // make room for the quotes - if stream.n+toWriteLen > bufLengthMinusTwo { - toWriteLen = bufLengthMinusTwo - stream.n - } - n := stream.n - stream.buf[n] = '"' - n++ + stream.buf = append(stream.buf, '"') // write string, the fast path, without utf8 and escape support i := 0 - for ; i < toWriteLen; i++ { + for ; i < valLen; i++ { c := s[i] if c > 31 && c != '"' && c != '\\' { - stream.buf[n] = c - n++ + stream.buf = append(stream.buf, c) } else { break } } if i == valLen { - stream.buf[n] = '"' - n++ - stream.n = n + stream.buf = append(stream.buf, '"') return } - stream.n = n writeStringSlowPath(stream, i, s, valLen) } diff --git a/vendor/github.com/json-iterator/go/jsoniter_stream_test.go b/vendor/github.com/json-iterator/go/stream_test.go similarity index 94% rename from vendor/github.com/json-iterator/go/jsoniter_stream_test.go rename to vendor/github.com/json-iterator/go/stream_test.go index 8df96b9f3..d407c7ab7 100644 --- a/vendor/github.com/json-iterator/go/jsoniter_stream_test.go +++ b/vendor/github.com/json-iterator/go/stream_test.go @@ -23,10 +23,10 @@ func Test_writeBytes_should_grow_buffer(t *testing.T) { stream := NewStream(ConfigDefault, nil, 1) stream.Write([]byte{'1', '2'}) should.Equal("12", string(stream.Buffer())) - should.Equal(3, len(stream.buf)) + should.Equal(2, len(stream.buf)) stream.Write([]byte{'3', '4', '5', '6', '7'}) should.Equal("1234567", string(stream.Buffer())) - should.Equal(8, len(stream.buf)) + should.Equal(7, len(stream.buf)) } func Test_writeIndention_should_grow_buffer(t *testing.T) { @@ -65,5 +65,5 @@ func Test_flush_buffer_should_stop_grow_buffer(t *testing.T) { writer := new(NopWriter) NewEncoder(writer).Encode(make([]int, 10000000)) should := require.New(t) - should.Equal(512, writer.bufferSize) + should.Equal(8, writer.bufferSize) } diff --git a/vendor/github.com/json-iterator/go/test.sh b/vendor/github.com/json-iterator/go/test.sh index 466f1141a..f4e7c0b2c 100755 --- a/vendor/github.com/json-iterator/go/test.sh +++ b/vendor/github.com/json-iterator/go/test.sh @@ -4,7 +4,7 @@ set -e echo "" > coverage.txt for d in $(go list ./... | grep -v vendor); do - go test -coverprofile=profile.out $d + go test -coverprofile=profile.out -coverpkg=github.com/json-iterator/go $d if [ -f profile.out ]; then cat profile.out >> coverage.txt rm profile.out diff --git a/vendor/github.com/json-iterator/go/type_tests/array_test.go b/vendor/github.com/json-iterator/go/type_tests/array_test.go new file mode 100644 index 000000000..db27d4ac8 --- /dev/null +++ b/vendor/github.com/json-iterator/go/type_tests/array_test.go @@ -0,0 +1,63 @@ +package test + +func init() { + testCases = append(testCases, + (*[4]bool)(nil), + (*[4]byte)(nil), + (*[4]float64)(nil), + (*[4]int32)(nil), + (*[4]map[int32]string)(nil), + (*[4]map[string]string)(nil), + (*[4]*bool)(nil), + (*[4]*float64)(nil), + (*[4]*int32)(nil), + (*[4]*map[int32]string)(nil), + (*[4]*map[string]string)(nil), + (*[4]*[4]bool)(nil), + (*[4]*[4]byte)(nil), + (*[4]*[4]float64)(nil), + (*[4]*[4]int32)(nil), + (*[4]*[4]*string)(nil), + (*[4]*[4]string)(nil), + (*[4]*[4]uint8)(nil), + (*[4]*string)(nil), + (*[4]*struct { + String string + Int int32 + Float float64 + Struct struct { + X string + } + Slice [4]string + Map map[string]string + })(nil), + (*[4]*uint8)(nil), + (*[4][4]bool)(nil), + (*[4][4]byte)(nil), + (*[4][4]float64)(nil), + (*[4][4]int32)(nil), + (*[4][4]*string)(nil), + (*[4][4]string)(nil), + (*[4][4]uint8)(nil), + (*[4]string)(nil), + (*[4]struct{})(nil), + (*[4]structEmpty)(nil), + (*[4]struct { + F *string + })(nil), + (*[4]struct { + String string + Int int32 + Float float64 + Struct struct { + X string + } + Slice [4]string + Map map[string]string + })(nil), + (*[4]uint8)(nil), + ) +} + +type structEmpty struct{} +type arrayAlis [4]stringAlias diff --git a/vendor/github.com/json-iterator/go/type_tests/builtin_test.go b/vendor/github.com/json-iterator/go/type_tests/builtin_test.go new file mode 100644 index 000000000..03dd34597 --- /dev/null +++ b/vendor/github.com/json-iterator/go/type_tests/builtin_test.go @@ -0,0 +1,69 @@ +package test + +func init() { + testCases = append(testCases, + (*bool)(nil), + (*boolAlias)(nil), + (*byte)(nil), + (*byteAlias)(nil), + (*float32)(nil), + (*float32Alias)(nil), + (*float64)(nil), + (*float64Alias)(nil), + (*int8)(nil), + (*int8Alias)(nil), + (*int16)(nil), + (*int16Alias)(nil), + (*int32)(nil), + (*int32Alias)(nil), + (*int64)(nil), + (*int64Alias)(nil), + (*string)(nil), + (*stringAlias)(nil), + (*uint8)(nil), + (*uint8Alias)(nil), + (*uint16)(nil), + (*uint16Alias)(nil), + (*uint32)(nil), + (*uint32Alias)(nil), + (*uintptr)(nil), + (*uintptrAlias)(nil), + (*struct { + A int8Alias `json:"a"` + B int16Alias `json:"stream"` + C int32Alias `json:"c"` + D int64Alias `json:"d"` + E uintAlias `json:"e"` + F uint16Alias `json:"f"` + G uint32Alias `json:"g"` + H uint64Alias `json:"h"` + I float32Alias `json:"i"` + J float64Alias `json:"j"` + K stringAlias `json:"k"` + L intAlias `json:"l"` + M uintAlias `json:"m"` + N boolAlias `json:"n"` + O uintptrAlias `json:"o"` + })(nil), + ) +} + +type boolAlias bool +type byteAlias byte +type float32Alias float32 +type float64Alias float64 +type ptrFloat64Alias *float64 +type int8Alias int8 +type int16Alias int16 +type int32Alias int32 +type ptrInt32Alias *int32 +type int64Alias int64 +type stringAlias string +type ptrStringAlias *string +type uint8Alias uint8 +type uint16Alias uint16 +type uint32Alias uint32 +type uintptrAlias uintptr +type uintAlias uint +type uint64Alias uint64 +type intAlias int diff --git a/vendor/github.com/json-iterator/go/type_tests/map_key_test.go b/vendor/github.com/json-iterator/go/type_tests/map_key_test.go new file mode 100644 index 000000000..e5bd21fb7 --- /dev/null +++ b/vendor/github.com/json-iterator/go/type_tests/map_key_test.go @@ -0,0 +1,43 @@ +package test + +import ( + "encoding" + "strings" +) + +func init() { + testCases = append(testCases, + (*map[stringKeyType]string)(nil), + (*map[structKeyType]string)(nil), + ) +} + +type stringKeyType string + +func (k stringKeyType) MarshalText() ([]byte, error) { + return []byte("MANUAL__" + k), nil +} + +func (k *stringKeyType) UnmarshalText(text []byte) error { + *k = stringKeyType(strings.TrimPrefix(string(text), "MANUAL__")) + return nil +} + +var _ encoding.TextMarshaler = stringKeyType("") +var _ encoding.TextUnmarshaler = new(stringKeyType) + +type structKeyType struct { + X string +} + +func (k structKeyType) MarshalText() ([]byte, error) { + return []byte("MANUAL__" + k.X), nil +} + +func (k *structKeyType) UnmarshalText(text []byte) error { + k.X = strings.TrimPrefix(string(text), "MANUAL__") + return nil +} + +var _ encoding.TextMarshaler = structKeyType{} +var _ encoding.TextUnmarshaler = &structKeyType{} diff --git a/vendor/github.com/json-iterator/go/type_tests/map_test.go b/vendor/github.com/json-iterator/go/type_tests/map_test.go new file mode 100644 index 000000000..614f7bcd5 --- /dev/null +++ b/vendor/github.com/json-iterator/go/type_tests/map_test.go @@ -0,0 +1,60 @@ +package test + +func init() { + testCases = append(testCases, + (*map[int8]string)(nil), + (*map[int16]string)(nil), + (*map[int32]string)(nil), + (*map[int64]string)(nil), + (*map[string][4]string)(nil), + (*map[string]bool)(nil), + (*map[string]byte)(nil), + (*map[string]float64)(nil), + (*map[string]int32)(nil), + (*map[string]map[string]string)(nil), + (*map[string]*[4]string)(nil), + (*map[string]*bool)(nil), + (*map[string]*float64)(nil), + (*map[string]*int32)(nil), + (*map[string]*map[string]string)(nil), + (*map[string]*[]string)(nil), + (*map[string]*string)(nil), + (*map[string]*structVarious)(nil), + (*map[string]*uint8)(nil), + (*map[string][]string)(nil), + (*map[string]string)(nil), + (*map[string]stringAlias)(nil), + (*map[string]struct{})(nil), + (*map[string]structEmpty)(nil), + (*map[string]struct { + F *string + })(nil), + (*map[string]struct { + String string + Int int32 + Float float64 + Struct struct { + X string + } + Slice []string + Map map[string]string + })(nil), + (*map[string]uint8)(nil), + (*map[stringAlias]string)(nil), + (*map[stringAlias]stringAlias)(nil), + (*map[uint8]string)(nil), + (*map[uint16]string)(nil), + (*map[uint32]string)(nil), + ) +} + +type structVarious struct { + String string + Int int32 + Float float64 + Struct struct { + X string + } + Slice []string + Map map[string]string +} diff --git a/vendor/github.com/json-iterator/go/type_tests/marshaler_string_test.go b/vendor/github.com/json-iterator/go/type_tests/marshaler_string_test.go new file mode 100644 index 000000000..c871191f4 --- /dev/null +++ b/vendor/github.com/json-iterator/go/type_tests/marshaler_string_test.go @@ -0,0 +1,52 @@ +package test + +import ( + "bytes" + "encoding/base64" + "encoding/json" + "strings" +) + +type StringMarshaler string + +func (m StringMarshaler) encode(str string) string { + buf := bytes.Buffer{} + b64 := base64.NewEncoder(base64.StdEncoding, &buf) + if _, err := b64.Write([]byte(str)); err != nil { + panic(err) + } + if err := b64.Close(); err != nil { + panic(err) + } + return buf.String() +} + +func (m StringMarshaler) decode(str string) string { + if len(str) == 0 { + return "" + } + b64 := base64.NewDecoder(base64.StdEncoding, strings.NewReader(str)) + bs := make([]byte, len(str)) + if n, err := b64.Read(bs); err != nil { + panic(err) + } else { + bs = bs[:n] + } + return string(bs) +} + +func (m StringMarshaler) MarshalJSON() ([]byte, error) { + return []byte(`"MANUAL__` + m.encode(string(m)) + `"`), nil +} + +func (m *StringMarshaler) UnmarshalJSON(text []byte) error { + *m = StringMarshaler(m.decode(strings.TrimPrefix(strings.Trim(string(text), `"`), "MANUAL__"))) + return nil +} + +var _ json.Marshaler = *new(StringMarshaler) +var _ json.Unmarshaler = new(StringMarshaler) + +func init() { + testCases = append(testCases, (*StringMarshaler)(nil)) +} diff --git a/vendor/github.com/json-iterator/go/type_tests/marshaler_struct_test.go b/vendor/github.com/json-iterator/go/type_tests/marshaler_struct_test.go new file mode 100644 index 000000000..e235dd600 --- /dev/null +++ b/vendor/github.com/json-iterator/go/type_tests/marshaler_struct_test.go @@ -0,0 +1,69 @@ +package test + +import ( + "bytes" + "encoding/base64" + "encoding/json" + "strings" +) + +type structMarshaler struct { + X string +} + +func (m structMarshaler) encode(str string) string { + buf := bytes.Buffer{} + b64 := base64.NewEncoder(base64.StdEncoding, &buf) + if _, err := b64.Write([]byte(str)); err != nil { + panic(err) + } + if err := b64.Close(); err != nil { + panic(err) + } + return buf.String() +} + +func (m structMarshaler) decode(str string) string { + if len(str) == 0 { + return "" + } + b64 := base64.NewDecoder(base64.StdEncoding, strings.NewReader(str)) + bs := make([]byte, len(str)) + if n, err := b64.Read(bs); err != nil { + panic(err) + } else { + bs = bs[:n] + } + return string(bs) +} + +func (m structMarshaler) MarshalJSON() ([]byte, error) { + return []byte(`"MANUAL__` + m.encode(m.X) + `"`), nil +} + +func (m *structMarshaler) UnmarshalJSON(text []byte) error { + m.X = m.decode(strings.TrimPrefix(strings.Trim(string(text), `"`), "MANUAL__")) + return nil +} + +var _ json.Marshaler = structMarshaler{} +var _ json.Unmarshaler = &structMarshaler{} + +type structMarshalerAlias structMarshaler + +func init() { + testCases = append(testCases, + (*structMarshaler)(nil), + (*structMarshalerAlias)(nil), + (*struct { + S string + M structMarshaler + I int8 + })(nil), + (*struct { + S string + M structMarshalerAlias + I int8 + })(nil), + ) +} diff --git a/vendor/github.com/json-iterator/go/type_tests/slice_test.go b/vendor/github.com/json-iterator/go/type_tests/slice_test.go new file mode 100644 index 000000000..129737d5c --- /dev/null +++ b/vendor/github.com/json-iterator/go/type_tests/slice_test.go @@ -0,0 +1,125 @@ +package test + +func init() { + testCases = append(testCases, + (*[][4]bool)(nil), + (*[][4]byte)(nil), + (*[][4]float64)(nil), + (*[][4]int32)(nil), + (*[][4]*string)(nil), + (*[][4]string)(nil), + (*[][4]uint8)(nil), + (*[]bool)(nil), + (*[]byte)(nil), + (*[]float64)(nil), + (*[]int32)(nil), + (*[]int64)(nil), + (*[]map[int32]string)(nil), + (*[]map[string]string)(nil), + (*[4]*[4]bool)(nil), + (*[4]*[4]byte)(nil), + (*[4]*[4]float64)(nil), + (*[4]*[4]int32)(nil), + (*[4]*[4]*string)(nil), + (*[4]*[4]string)(nil), + (*[4]*[4]uint8)(nil), + (*[]*bool)(nil), + (*[]*float64)(nil), + (*[]*int32)(nil), + (*[]*map[int32]string)(nil), + (*[]*map[string]string)(nil), + (*[]*[]bool)(nil), + (*[]*[]byte)(nil), + (*[]*[]float64)(nil), + (*[]*[]int32)(nil), + (*[]*[]*string)(nil), + (*[]*[]string)(nil), + (*[]*[]uint8)(nil), + (*[]*string)(nil), + (*[]*struct { + String string + Int int32 + Float float64 + Struct struct { + X string + } + Slice []string + Map map[string]string + })(nil), + (*[]*uint8)(nil), + (*[][]bool)(nil), + (*[][]byte)(nil), + (*[][]float64)(nil), + (*[][]int32)(nil), + (*[][]*string)(nil), + (*[][]string)(nil), + (*[][]uint8)(nil), + (*[]string)(nil), + (*[]struct{})(nil), + (*[]structEmpty)(nil), + (*[]struct { + F *string + })(nil), + (*[]struct { + String string + Int int32 + Float float64 + Struct struct { + X string + } + Slice []string + Map map[string]string + })(nil), + (*[]uint8)(nil), + (*[]jsonMarshaler)(nil), + (*[]jsonMarshalerMap)(nil), + (*[]textMarshaler)(nil), + (*[]textMarshalerMap)(nil), + ) +} + +type jsonMarshaler struct { + Id string `json:"id,omitempty" db:"id"` +} + +func (p *jsonMarshaler) MarshalJSON() ([]byte, error) { + return []byte(`{}`), nil +} + +func (p *jsonMarshaler) UnmarshalJSON(input []byte) error { + p.Id = "hello" + return nil +} + +type jsonMarshalerMap map[int]int + +func (p *jsonMarshalerMap) MarshalJSON() ([]byte, error) { + return []byte(`{}`), nil +} + +func (p *jsonMarshalerMap) UnmarshalJSON(input []byte) error { + return nil +} + +type textMarshaler struct { + Id string `json:"id,omitempty" db:"id"` +} + +func (p *textMarshaler) MarshalText() ([]byte, error) { + return []byte(`{}`), nil +} + +func (p *textMarshaler) UnmarshalText(input []byte) error { + p.Id = "hello" + return nil +} + +type textMarshalerMap map[int]int + +func (p *textMarshalerMap) MarshalText() ([]byte, error) { + return []byte(`{}`), nil +} + +func (p *textMarshalerMap) UnmarshalText(input []byte) error { + return nil +} diff --git a/vendor/github.com/json-iterator/go/type_tests/struct_embedded_test.go b/vendor/github.com/json-iterator/go/type_tests/struct_embedded_test.go new file mode 100644 index 000000000..3fb3f1107 --- /dev/null +++ b/vendor/github.com/json-iterator/go/type_tests/struct_embedded_test.go @@ -0,0 +1,233 @@ +package test + +func init() { + testCases = append(testCases, + (*struct { + EmbeddedFloat64 + })(nil), + (*struct { + EmbeddedInt32 + })(nil), + (*struct { + F1 float64 + StringMarshaler + F2 int32 + })(nil), + (*struct { + EmbeddedMapStringString + })(nil), + (*struct { + *EmbeddedFloat64 + })(nil), + (*struct { + *EmbeddedInt32 + })(nil), + (*struct { + *EmbeddedMapStringString + })(nil), + (*struct { + *EmbeddedSliceString + })(nil), + (*struct { + *EmbeddedString + })(nil), + (*struct { + *EmbeddedStruct + })(nil), + (*struct { + EmbeddedSliceString + })(nil), + (*struct { + EmbeddedString + })(nil), + (*struct { + EmbeddedString `json:"othername"` + })(nil), + (*struct { + EmbeddedStruct + })(nil), + (*struct { + F1 float64 + StringTextMarshaler + F2 int32 + })(nil), + (*OverlapDifferentLevels)(nil), + (*IgnoreDeeperLevel)(nil), + (*SameLevel1BothTagged)(nil), + (*SameLevel1NoTags)(nil), + (*SameLevel1Tagged)(nil), + (*SameLevel2BothTagged)(nil), + (*SameLevel2NoTags)(nil), + (*SameLevel2Tagged)(nil), + (*EmbeddedPtr)(nil), + ) +} + +type EmbeddedFloat64 float64 +type EmbeddedInt32 int32 +type EmbeddedMapStringString map[string]string +type EmbeddedSliceString []string +type EmbeddedString string +type EmbeddedStruct struct { + String string + Int int32 + Float float64 + Struct struct { + X string + } + Slice []string + Map map[string]string +} + +type OverlapDifferentLevelsE1 struct { + F1 int32 +} + +type OverlapDifferentLevelsE2 struct { + F2 string +} + +type OverlapDifferentLevels struct { + OverlapDifferentLevelsE1 + OverlapDifferentLevelsE2 + F1 string +} + +type IgnoreDeeperLevelDoubleEmbedded struct { + F1 int32 `json:"F1"` +} + +type IgnoreDeeperLevelE1 struct { + IgnoreDeeperLevelDoubleEmbedded + F1 int32 +} + +type IgnoreDeeperLevelE2 struct { + F1 int32 `json:"F1"` + IgnoreDeeperLevelDoubleEmbedded +} + +type IgnoreDeeperLevel struct { + IgnoreDeeperLevelE1 + IgnoreDeeperLevelE2 +} + +type SameLevel1BothTaggedE1 struct { + F1 int32 `json:"F1"` +} + +type SameLevel1BothTaggedE2 struct { + F1 int32 `json:"F1"` +} + +type SameLevel1BothTagged struct { + SameLevel1BothTaggedE1 + SameLevel1BothTaggedE2 +} + +type SameLevel1NoTagsE1 struct { + F1 int32 +} + +type SameLevel1NoTagsE2 struct { + F1 int32 +} + +type SameLevel1NoTags struct { + SameLevel1NoTagsE1 + SameLevel1NoTagsE2 +} + +type SameLevel1TaggedE1 struct { + F1 int32 +} + +type SameLevel1TaggedE2 struct { + F1 int32 `json:"F1"` +} + +type SameLevel1Tagged struct { + SameLevel1TaggedE1 + SameLevel1TaggedE2 +} + +type SameLevel2BothTaggedDE1 struct { + F1 int32 `json:"F1"` +} + +type SameLevel2BothTaggedE1 struct { + SameLevel2BothTaggedDE1 +} + +// DoubleEmbedded2 TEST ONLY +type SameLevel2BothTaggedDE2 struct { + F1 int32 `json:"F1"` +} + +// Embedded2 TEST ONLY +type SameLevel2BothTaggedE2 struct { + SameLevel2BothTaggedDE2 +} + +type SameLevel2BothTagged struct { + SameLevel2BothTaggedE1 + SameLevel2BothTaggedE2 +} + +type SameLevel2NoTagsDE1 struct { + F1 int32 +} + +type SameLevel2NoTagsE1 struct { + SameLevel2NoTagsDE1 +} + +type SameLevel2NoTagsDE2 struct { + F1 int32 +} + +type SameLevel2NoTagsE2 struct { + SameLevel2NoTagsDE2 +} + +type SameLevel2NoTags struct { + SameLevel2NoTagsE1 + SameLevel2NoTagsE2 +} + +// DoubleEmbedded1 TEST ONLY +type SameLevel2TaggedDE1 struct { + F1 int32 +} + +// Embedded1 TEST ONLY +type SameLevel2TaggedE1 struct { + SameLevel2TaggedDE1 +} + +// DoubleEmbedded2 TEST ONLY +type SameLevel2TaggedDE2 struct { + F1 int32 `json:"F1"` +} + +// Embedded2 TEST ONLY +type SameLevel2TaggedE2 struct { + SameLevel2TaggedDE2 +} + +type SameLevel2Tagged struct { + SameLevel2TaggedE1 + SameLevel2TaggedE2 +} + +type EmbeddedPtrO1 struct { + O1F string +} + +type EmbeddedPtrOption struct { + O1 *EmbeddedPtrO1 +} + +type EmbeddedPtr struct { + EmbeddedPtrOption `json:","` +} diff --git a/vendor/github.com/json-iterator/go/type_tests/struct_field_case_test.go b/vendor/github.com/json-iterator/go/type_tests/struct_field_case_test.go new file mode 100644 index 000000000..567f290ba --- /dev/null +++ b/vendor/github.com/json-iterator/go/type_tests/struct_field_case_test.go @@ -0,0 +1,30 @@ +package test + +func init() { + testCases = append(testCases, + (*struct { + Upper bool `json:"M"` + Lower bool `json:"m"` + })(nil), + ) + asymmetricTestCases = append(asymmetricTestCases, [][2]interface{}{ + { + (*struct { + Field string + })(nil), + (*struct { + FIELD string + })(nil), + }, + { + (*struct { + F1 string + F2 string + F3 string + })(nil), + (*struct { + F1 string + })(nil), + }, + }...) +} diff --git a/vendor/github.com/json-iterator/go/type_tests/struct_tags_test.go b/vendor/github.com/json-iterator/go/type_tests/struct_tags_test.go new file mode 100644 index 000000000..6b111faa4 --- /dev/null +++ b/vendor/github.com/json-iterator/go/type_tests/struct_tags_test.go @@ -0,0 +1,282 @@ +package test + +func init() { + testCases = append(testCases, + (*EmbeddedFieldName)(nil), + (*StringFieldName)(nil), + (*StructFieldName)(nil), + (*struct { + F1 bool `json:"F1"` + F2 bool `json:"F2,omitempty"` + })(nil), + (*EmbeddedOmitEmpty)(nil), + (*struct { + F1 float32 `json:"F1"` + F2 float32 `json:"F2,omitempty"` + })(nil), + (*struct { + F1 int32 `json:"F1"` + F2 int32 `json:"F2,omitempty"` + })(nil), + (*struct { + F1 map[string]string `json:"F1"` + F2 map[string]string `json:"F2,omitempty"` + })(nil), + (*struct { + F1 *bool `json:"F1"` + F2 *bool `json:"F2,omitempty"` + })(nil), + (*struct { + F1 *float32 `json:"F1"` + F2 *float32 `json:"F2,omitempty"` + })(nil), + (*struct { + F1 *int32 `json:"F1"` + F2 *int32 `json:"F2,omitempty"` + })(nil), + (*struct { + F1 *map[string]string `json:"F1"` + F2 *map[string]string `json:"F2,omitempty"` + })(nil), + (*struct { + F1 *[]string `json:"F1"` + F2 *[]string `json:"F2,omitempty"` + })(nil), + (*struct { + F1 string `json:"F1"` + F2 string `json:"F2,omitempty"` + })(nil), + (*struct { + F1 *string `json:"F1"` + F2 *string `json:"F2,omitempty"` + })(nil), + (*struct { + F *jm `json:"f,omitempty"` + })(nil), + (*struct { + F *tm `json:"f,omitempty"` + })(nil), + (*struct { + F *sjm `json:"f,omitempty"` + })(nil), + (*struct { + F *tm `json:"f,omitempty"` + })(nil), + (*struct { + F1 *uint32 `json:"F1"` + F2 *uint32 `json:"F2,omitempty"` + })(nil), + (*struct { + F1 []string `json:"F1"` + F2 []string `json:"F2,omitempty"` + })(nil), + (*struct { + F1 string `json:"F1"` + F2 string `json:"F2,omitempty"` + })(nil), + (*struct { + F jm `json:"f,omitempty"` + })(nil), + (*struct { + F tm `json:"f,omitempty"` + })(nil), + (*struct { + F struct{} `json:"f,omitempty"` // omitempty is meaningless here + })(nil), + (*struct { + F sjm `json:"f,omitempty"` + })(nil), + (*struct { + F stm `json:"f,omitempty"` + })(nil), + (*struct { + F1 uint32 `json:"F1"` + F2 uint32 `json:"F2,omitempty"` + })(nil), + (*struct { + F1 bool `json:"F1"` + F2 bool `json:"F2,string"` + })(nil), + (*struct { + F1 byte `json:"F1"` + F2 byte `json:"F2,string"` + })(nil), + (*struct { + F1 float32 `json:"F1"` + F2 float32 `json:"F2,string"` + })(nil), + (*struct { + F1 float64 `json:"F1"` + F2 float64 `json:"F2,string"` + })(nil), + (*struct { + F1 int8 `json:"F1"` + F2 int8 `json:"F2,string"` + })(nil), + (*struct { + F1 int16 `json:"F1"` + F2 int16 `json:"F2,string"` + })(nil), + (*struct { + F1 int32 `json:"F1"` + F2 int32 `json:"F2,string"` + })(nil), + (*struct { + F1 string `json:"F1"` + F2 string `json:"F2,string"` + })(nil), + (*struct { + F1 uint8 `json:"F1"` + F2 uint8 `json:"F2,string"` + })(nil), + (*struct { + F1 uint16 `json:"F1"` + F2 uint16 `json:"F2,string"` + })(nil), + (*struct { + F1 uint32 `json:"F1"` + F2 uint32 `json:"F2,string"` + })(nil), + (*struct { + A string `json:"a,omitempty"` + B string `json:"b,omitempty"` + Annotations map[string]string `json:"annotations,omitempty"` + })(nil), + (*struct { + Field bool `json:",omitempty,string"` + })(nil), + ) +} + +// S1 TEST ONLY +type EmbeddedFieldNameS1 struct { + S1F string +} + +// S2 TEST ONLY +type EmbeddedFieldNameS2 struct { + S2F string +} + +// S3 TEST ONLY +type EmbeddedFieldNameS3 struct { + S3F string +} + +// S4 TEST ONLY +type EmbeddedFieldNameS4 struct { + S4F string +} + +// S5 TEST ONLY +type EmbeddedFieldNameS5 struct { + S5F string +} + +// S6 TEST ONLY +type EmbeddedFieldNameS6 struct { + S6F string +} + +type EmbeddedFieldName struct { + EmbeddedFieldNameS1 `json:"F1"` + EmbeddedFieldNameS2 `json:"f2"` + EmbeddedFieldNameS3 `json:"-"` + EmbeddedFieldNameS4 `json:"-,"` + EmbeddedFieldNameS5 `json:","` + EmbeddedFieldNameS6 `json:""` +} + +type StringFieldNameE struct { + E1 string +} + +type StringFieldName struct { + F1 string `json:"F1"` + F2 string `json:"f2"` + F3 string `json:"-"` + F4 string `json:"-,"` + F5 string `json:","` + F6 string `json:""` + StringFieldNameE `json:"e"` +} + +type StructFieldNameS1 struct { + S1F string +} + +type StructFieldNameS2 struct { + S2F string +} + +type StructFieldNameS3 struct { + S3F string +} + +type StructFieldNameS4 struct { + S4F string +} + +type StructFieldNameS5 struct { + S5F string +} + +type StructFieldNameS6 struct { + S6F string +} + +type StructFieldName struct { + F1 StructFieldNameS1 `json:"F1"` + F2 StructFieldNameS2 `json:"f2"` + F3 StructFieldNameS3 `json:"-"` + F4 StructFieldNameS4 `json:"-,"` + F5 StructFieldNameS5 `json:","` + F6 StructFieldNameS6 `json:""` +} +type EmbeddedOmitEmptyE struct { + F string `json:"F,omitempty"` +} + +type EmbeddedOmitEmpty struct { + EmbeddedOmitEmptyE +} + +type jm string + +func (t *jm) UnmarshalJSON(b []byte) error { + return nil +} + +func (t jm) MarshalJSON() ([]byte, error) { + return []byte(`""`), nil +} + +type tm string + +func (t *tm) UnmarshalText(b []byte) error { + return nil +} + +func (t tm) MarshalText() ([]byte, error) { + return []byte(`""`), nil +} + +type sjm struct{} + +func (t *sjm) UnmarshalJSON(b []byte) error { + return nil +} + +func (t sjm) MarshalJSON() ([]byte, error) { + return []byte(`""`), nil +} + +type stm struct{} + +func (t *stm) UnmarshalText(b []byte) error { + return nil +} + +func (t stm) MarshalText() ([]byte, error) { + return []byte(`""`), nil +} diff --git a/vendor/github.com/json-iterator/go/type_tests/struct_test.go b/vendor/github.com/json-iterator/go/type_tests/struct_test.go new file mode 100644 index 000000000..0cf32522a --- /dev/null +++ b/vendor/github.com/json-iterator/go/type_tests/struct_test.go @@ -0,0 +1,404 @@ +package test + +import "time" + +func init() { + structFields1To11() + testCases = append(testCases, + (*struct1Alias)(nil), + (*struct { + F [4]*string + })(nil), + (*struct { + F [4]string + })(nil), + (*struct { + F1 [4]stringAlias + F2 arrayAlis + })(nil), + (*struct { + F1 [4]string + F2 [4]string + F3 [4]string + })(nil), + (*struct { + F [4]struct { + F1 string + F2 string + F3 string + } + })(nil), + (*struct{})(nil), + (*structEmpty)(nil), + (*struct { + Byte1 byte + Byte2 byte + Bool1 bool + Bool2 bool + Int8 int8 + Int16 int16 + Int32 int32 + Int64 int64 + Uint8 uint8 + Uint16 uint16 + Uint32 uint32 + Uint64 uint64 + Float32 float32 + Float64 float64 + String1 string + String2 string + })(nil), + (*struct { + F float64 + })(nil), + (*struct { + F float64Alias + })(nil), + (*struct { + F1 float64 + F2 float64 + F3 float64 + })(nil), + (*struct { + F1 float64Alias + F2 float64Alias + F3 float64Alias + })(nil), + (*struct { + F int32 + })(nil), + (*struct { + F int32Alias + })(nil), + (*struct { + F1 int32 + F2 int32 + F3 int32 + })(nil), + (*struct { + F1 int32Alias + F2 int32Alias + F3 int32Alias + })(nil), + (*struct { + F int64 + })(nil), + (*struct { + F map[int32]*string + })(nil), + (*struct { + F map[int32]string + })(nil), + (*struct { + F map[int32]struct { + F1 string + F2 string + F3 string + } + })(nil), + (*struct { + F map[string]*string + })(nil), + (*struct { + F map[string]string + })(nil), + (*struct { + F map[string]struct { + F1 string + F2 string + F3 string + } + })(nil), + (*struct { + F *float64 + })(nil), + (*struct { + F1 *float64Alias + F2 ptrFloat64Alias + F3 *ptrFloat64Alias + })(nil), + (*struct { + F *int32 + })(nil), + (*struct { + F1 *int32Alias + F2 ptrInt32Alias + F3 *ptrInt32Alias + })(nil), + (*struct { + F **struct{} + })(nil), + (*struct { + F **struct { + F1 string + F2 string + F3 string + } + })(nil), + (*struct { + F *string + })(nil), + (*struct { + F1 *stringAlias + F2 ptrStringAlias + F3 *ptrStringAlias + })(nil), + (*struct { + F *struct{} + })(nil), + (*struct { + F *struct { + F1 string + F2 string + F3 string + } + })(nil), + (*struct { + F1 *float64 + F2 *float64 + F3 *float64 + })(nil), + (*struct { + F1 *int32 + F2 *int32 + F3 *int32 + })(nil), + (*struct { + F1 *string + F2 *string + F3 *string + })(nil), + (*struct { + F []*string + })(nil), + (*struct { + F []string + })(nil), + (*struct { + F1 []stringAlias + F2 stringAlias + })(nil), + (*struct { + F1 []string + F2 []string + F3 []string + })(nil), + (*struct { + F []struct { + F1 string + F2 string + F3 string + } + })(nil), + (*struct { + F string + })(nil), + (*struct { + F stringAlias + })(nil), + (*struct { + F1 string + F2 string + F3 string + })(nil), + (*struct { + F1 stringAlias + F2 stringAlias + F3 stringAlias + })(nil), + (*struct { + F1 struct{} + F2 struct{} + F3 struct{} + })(nil), + (*struct { + F struct{} + })(nil), + (*struct { + F structEmpty + })(nil), + (*struct { + F struct { + F1 float32 + F2 float32 + F3 float32 + } + })(nil), + (*struct { + F struct { + F float32 + } + })(nil), + (*struct { + F struct2 + })(nil), + (*struct { + F struct { + F1 int32 + F2 int32 + F3 int32 + } + })(nil), + (*struct { + F struct { + F1 string + F2 string + F3 string + } + })(nil), + (*struct { + F struct3 + })(nil), + (*struct { + TF1 struct { + F2 int + F1 *withTime + } + })(nil), + (*DeeplyNested)(nil), + ) +} + +func structFields1To11() { + testCases = append(testCases, + (*struct { + Field1 string + })(nil), + (*struct { + Field1 string + Field2 string + })(nil), + (*struct { + Field1 string + Field2 string + Field3 string + })(nil), + (*struct { + Field1 string + Field2 string + Field3 string + Field4 string + })(nil), + (*struct { + Field1 string + Field2 string + Field3 string + Field4 string + Field5 string + })(nil), + (*struct { + Field1 string + Field2 string + Field3 string + Field4 string + Field5 string + Field6 string + })(nil), + (*struct { + Field1 string + Field2 string + Field3 string + Field4 string + Field5 string + Field6 string + Field7 string + })(nil), + (*struct { + Field1 string + Field2 string + Field3 string + Field4 string + Field5 string + Field6 string + Field7 string + Field8 string + })(nil), + (*struct { + Field1 string + Field2 string + Field3 string + Field4 string + Field5 string + Field6 string + Field7 string + Field8 string + Field9 string + })(nil), + (*struct { + Field1 string + Field2 string + Field3 string + Field4 string + Field5 string + Field6 string + Field7 string + Field8 string + Field9 string + Field10 string + })(nil), + (*struct { + Field1 string + Field2 string + Field3 string + Field4 string + Field5 string + Field6 string + Field7 string + Field8 string + Field9 string + Field10 string + Field11 string + })(nil), + ) +} + +type struct1 struct { + Byte1 byte + Byte2 byte + Bool1 bool + Bool2 bool + Int8 int8 + Int16 int16 + Int32 int32 + Uint8 uint8 + Uint16 uint16 + Uint32 uint32 + Float32 float32 + Float64 float64 + String1 string + String2 string +} +type struct1Alias struct1 + +type struct2 struct { + F float64 +} +type struct3 struct { + F1 stringAlias + F2 stringAlias + F3 stringAlias +} + +type withTime struct { + time.Time +} + +func (t *withTime) UnmarshalJSON(b []byte) error { + return nil +} +func (t withTime) MarshalJSON() ([]byte, error) { + return []byte(`"fake"`), nil +} + +type YetYetAnotherObject struct { + Field string +} +type YetAnotherObject struct { + Field *YetYetAnotherObject +} +type AnotherObject struct { + Field *YetAnotherObject +} +type DeeplyNested struct { + Me *AnotherObject +} diff --git a/vendor/github.com/json-iterator/go/type_tests/text_marshaler_string_test.go b/vendor/github.com/json-iterator/go/type_tests/text_marshaler_string_test.go new file mode 100644 index 000000000..c08b7985c --- /dev/null +++ b/vendor/github.com/json-iterator/go/type_tests/text_marshaler_string_test.go @@ -0,0 +1,57 @@ +package test + +import ( + "bytes" + "encoding" + "encoding/base64" + "strings" +) + +func init() { + testCases = append(testCases, + (*StringTextMarshaler)(nil), + ) +} + +// StringTextMarshaler TEST ONLY +type StringTextMarshaler string + +func (m StringTextMarshaler) encode(str string) string { + buf := bytes.Buffer{} + b64 := base64.NewEncoder(base64.StdEncoding, &buf) + if _, err := b64.Write([]byte(str)); err != nil { + panic(err) + } + if err := b64.Close(); err != nil { + panic(err) + } + return buf.String() +} + +func (m StringTextMarshaler) decode(str string) string { + if len(str) == 0 { + return "" + } + b64 := base64.NewDecoder(base64.StdEncoding, strings.NewReader(str)) + bs := make([]byte, len(str)) + if n, err := b64.Read(bs); err != nil { + panic(err) + } else { + bs = bs[:n] + } + return string(bs) +} + +// MarshalText TEST ONLY +func (m StringTextMarshaler) MarshalText() ([]byte, error) { + return []byte(`MANUAL__` + m.encode(string(m))), nil +} + +// UnmarshalText TEST ONLY +func (m *StringTextMarshaler) UnmarshalText(text []byte) error { + *m = StringTextMarshaler(m.decode(strings.TrimPrefix(string(text), "MANUAL__"))) + return nil +} + +var _ encoding.TextMarshaler = *new(StringTextMarshaler) +var _ encoding.TextUnmarshaler = new(StringTextMarshaler) diff --git a/vendor/github.com/json-iterator/go/type_tests/text_marshaler_struct_test.go b/vendor/github.com/json-iterator/go/type_tests/text_marshaler_struct_test.go new file mode 100644 index 000000000..7c4be391e --- /dev/null +++ b/vendor/github.com/json-iterator/go/type_tests/text_marshaler_struct_test.go @@ -0,0 +1,69 @@ +package test + +import ( + "bytes" + "encoding" + "encoding/base64" + "strings" +) + +func init() { + testCases = append(testCases, + (*structTextMarshaler)(nil), + (*structTextMarshalerAlias)(nil), + (*struct { + S string + M structTextMarshaler + I int8 + })(nil), + (*struct { + S string + M structTextMarshalerAlias + I int8 + })(nil), + ) +} + +type structTextMarshaler struct { + X string +} + +func (m structTextMarshaler) encode(str string) string { + buf := bytes.Buffer{} + b64 := base64.NewEncoder(base64.StdEncoding, &buf) + if _, err := b64.Write([]byte(str)); err != nil { + panic(err) + } + if err := b64.Close(); err != nil { + panic(err) + } + return buf.String() +} + +func (m structTextMarshaler) decode(str string) string { + if len(str) == 0 { + return "" + } + b64 := base64.NewDecoder(base64.StdEncoding, strings.NewReader(str)) + bs := make([]byte, len(str)) + if n, err := b64.Read(bs); err != nil { + panic(err) + } else { + bs = bs[:n] + } + return string(bs) +} + +func (m structTextMarshaler) MarshalText() ([]byte, error) { + return []byte(`MANUAL__` + m.encode(m.X)), nil +} + +func (m *structTextMarshaler) UnmarshalText(text []byte) error { + m.X = m.decode(strings.TrimPrefix(string(text), "MANUAL__")) + return nil +} + +var _ encoding.TextMarshaler = structTextMarshaler{} +var _ encoding.TextUnmarshaler = &structTextMarshaler{} + +type structTextMarshalerAlias structTextMarshaler diff --git a/vendor/github.com/json-iterator/go/type_tests/type_test.go b/vendor/github.com/json-iterator/go/type_tests/type_test.go new file mode 100644 index 000000000..cde433227 --- /dev/null +++ b/vendor/github.com/json-iterator/go/type_tests/type_test.go @@ -0,0 +1,162 @@ +package test + +import ( + "bytes" + "encoding/json" + "fmt" + "github.com/davecgh/go-spew/spew" + "github.com/google/gofuzz" + "github.com/json-iterator/go" + "reflect" + "strings" + "testing" +) + +var testCases []interface{} +var asymmetricTestCases [][2]interface{} + +type selectedSymmetricCase struct { + testCase interface{} +} + +func Test_symmetric(t *testing.T) { + for _, testCase := range testCases { + selectedSymmetricCase, found := testCase.(selectedSymmetricCase) + if found { + testCases = []interface{}{selectedSymmetricCase.testCase} + break + } + } + for _, testCase := range testCases { + valType := reflect.TypeOf(testCase).Elem() + t.Run(valType.String(), func(t *testing.T) { + fz := fuzz.New().MaxDepth(10).NilChance(0.3) + for i := 0; i < 100; i++ { + beforePtrVal := reflect.New(valType) + beforePtr := beforePtrVal.Interface() + fz.Fuzz(beforePtr) + before := beforePtrVal.Elem().Interface() + + jbStd, err := json.Marshal(before) + if err != nil { + t.Fatalf("failed to marshal with stdlib: %v", err) + } + if len(strings.TrimSpace(string(jbStd))) == 0 { + t.Fatal("stdlib marshal produced empty result and no error") + } + jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) + if err != nil { + t.Fatalf("failed to marshal with jsoniter: %v", err) + } + if len(strings.TrimSpace(string(jbIter))) == 0 { + t.Fatal("jsoniter marshal produced empty result and no error") + } + if string(jbStd) != string(jbIter) { + t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", + indent(jbStd, " "), indent(jbIter, " "), dump(before)) + } + + afterStdPtrVal := reflect.New(valType) + afterStdPtr := afterStdPtrVal.Interface() + err = json.Unmarshal(jbIter, afterStdPtr) + if err != nil { + t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", + err, indent(jbIter, " ")) + } + afterIterPtrVal := reflect.New(valType) + afterIterPtr := afterIterPtrVal.Interface() + err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, afterIterPtr) + if err != nil { + t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", + err, indent(jbIter, " ")) + } + afterStd := afterStdPtrVal.Elem().Interface() + afterIter := afterIterPtrVal.Elem().Interface() + if fingerprint(afterStd) != fingerprint(afterIter) { + t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", + dump(afterStd), dump(afterIter), indent(jbIter, " ")) + } + } + }) + } +} + +func Test_asymmetric(t *testing.T) { + for _, testCase := range asymmetricTestCases { + fromType := reflect.TypeOf(testCase[0]).Elem() + toType := reflect.TypeOf(testCase[1]).Elem() + fz := fuzz.New().MaxDepth(10).NilChance(0.3) + for i := 0; i < 100; i++ { + beforePtrVal := reflect.New(fromType) + beforePtr := beforePtrVal.Interface() + fz.Fuzz(beforePtr) + before := beforePtrVal.Elem().Interface() + + jbStd, err := json.Marshal(before) + if err != nil { + t.Fatalf("failed to marshal with stdlib: %v", err) + } + if len(strings.TrimSpace(string(jbStd))) == 0 { + t.Fatal("stdlib marshal produced empty result and no error") + } + jbIter, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(before) + if err != nil { + t.Fatalf("failed to marshal with jsoniter: %v", err) + } + if len(strings.TrimSpace(string(jbIter))) == 0 { + t.Fatal("jsoniter marshal produced empty result and no error") + } + if string(jbStd) != string(jbIter) { + t.Fatalf("marshal expected:\n %s\ngot:\n %s\nobj:\n %s", + indent(jbStd, " "), indent(jbIter, " "), dump(before)) + } + + afterStdPtrVal := reflect.New(toType) + afterStdPtr := afterStdPtrVal.Interface() + err = json.Unmarshal(jbIter, afterStdPtr) + if err != nil { + t.Fatalf("failed to unmarshal with stdlib: %v\nvia:\n %s", + err, indent(jbIter, " ")) + } + afterIterPtrVal := reflect.New(toType) + afterIterPtr := afterIterPtrVal.Interface() + err = jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal(jbIter, afterIterPtr) + if err != nil { + t.Fatalf("failed to unmarshal with jsoniter: %v\nvia:\n %s", + err, indent(jbIter, " ")) + } + afterStd := afterStdPtrVal.Elem().Interface() + afterIter := afterIterPtrVal.Elem().Interface() + if fingerprint(afterStd) != fingerprint(afterIter) { + t.Fatalf("unmarshal expected:\n %s\ngot:\n %s\nvia:\n %s", + dump(afterStd), dump(afterIter), indent(jbIter, " ")) + } + } + } +} + +const indentStr = "> " + +func fingerprint(obj interface{}) string { + c := spew.ConfigState{ + SortKeys: true, + SpewKeys: true, + } + return c.Sprintf("%v", obj) +} + +func dump(obj interface{}) string { + cfg := spew.ConfigState{ + Indent: indentStr, + } + return cfg.Sdump(obj) +} + +func indent(src []byte, prefix string) string { + var buf bytes.Buffer + err := json.Indent(&buf, src, prefix, indentStr) + if err != nil { + return fmt.Sprintf("!!! %v", err) + } + return buf.String() +} diff --git a/vendor/github.com/json-iterator/go/unmarshal_input_test.go b/vendor/github.com/json-iterator/go/unmarshal_input_test.go deleted file mode 100644 index 9d7b99c5f..000000000 --- a/vendor/github.com/json-iterator/go/unmarshal_input_test.go +++ /dev/null @@ -1,72 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "reflect" - "testing" - - fuzz "github.com/google/gofuzz" -) - -func Test_NilInput(t *testing.T) { - var jb []byte // nil - var out string - err := Unmarshal(jb, &out) - if err == nil { - t.Errorf("Expected error") - } -} - -func Test_EmptyInput(t *testing.T) { - jb := []byte("") - var out string - err := Unmarshal(jb, &out) - if err == nil { - t.Errorf("Expected error") - } -} - -func Test_RandomInput_Bytes(t *testing.T) { - fz := fuzz.New().NilChance(0) - for i := 0; i < 10000; i++ { - var jb []byte - fz.Fuzz(&jb) - testRandomInput(t, jb) - } -} - -func Test_RandomInput_String(t *testing.T) { - fz := fuzz.New().NilChance(0) - for i := 0; i < 10000; i++ { - var js string - fz.Fuzz(&js) - jb := []byte(js) - testRandomInput(t, jb) - } -} - -func testRandomInput(t *testing.T, jb []byte) { - var outString string - testRandomInputTo(t, jb, &outString) - - var outInt int - testRandomInputTo(t, jb, &outInt) - - var outStruct struct{} - testRandomInputTo(t, jb, &outStruct) - - var outSlice []string - testRandomInputTo(t, jb, &outSlice) -} - -func testRandomInputTo(t *testing.T, jb []byte, out interface{}) { - err := Unmarshal(jb, out) - if err == nil { - // Cross-check stdlib to see if we just happened to fuzz a legit value. - err := json.Unmarshal(jb, out) - if err != nil { - t.Fatalf("Expected error unmarshaling as %s:\nas string: %q\nas bytes: %v", - reflect.TypeOf(out).Elem().Kind(), string(jb), jb) - } - } -} diff --git a/vendor/github.com/json-iterator/go/value_tests/array_test.go b/vendor/github.com/json-iterator/go/value_tests/array_test.go new file mode 100644 index 000000000..75ce27afd --- /dev/null +++ b/vendor/github.com/json-iterator/go/value_tests/array_test.go @@ -0,0 +1,20 @@ +package test + +func init() { + two := float64(2) + marshalCases = append(marshalCases, + [1]*float64{nil}, + [1]*float64{&two}, + [2]*float64{}, + ) + unmarshalCases = append(unmarshalCases, unmarshalCase{ + ptr: (*[0]int)(nil), + input: `[1]`, + }, unmarshalCase{ + ptr: (*[1]int)(nil), + input: `[2]`, + }, unmarshalCase{ + ptr: (*[1]int)(nil), + input: `[]`, + }) +} diff --git a/vendor/github.com/json-iterator/go/value_tests/bool_test.go b/vendor/github.com/json-iterator/go/value_tests/bool_test.go new file mode 100644 index 000000000..40d8ca931 --- /dev/null +++ b/vendor/github.com/json-iterator/go/value_tests/bool_test.go @@ -0,0 +1,10 @@ +package test + +func init() { + unmarshalCases = append(unmarshalCases, unmarshalCase{ + ptr: (*struct { + Field bool `json:"field"` + })(nil), + input: `{"field": null}`, + }) +} diff --git a/vendor/github.com/json-iterator/go/value_tests/eface_test.go b/vendor/github.com/json-iterator/go/value_tests/eface_test.go new file mode 100644 index 000000000..9d22ea92b --- /dev/null +++ b/vendor/github.com/json-iterator/go/value_tests/eface_test.go @@ -0,0 +1,78 @@ +package test + +func init() { + var pEFace = func(val interface{}) *interface{} { + return &val + } + var pInt = func(val int) *int { + return &val + } + unmarshalCases = append(unmarshalCases, unmarshalCase{ + ptr: (**interface{})(nil), + input: `"hello"`, + }, unmarshalCase{ + ptr: (**interface{})(nil), + input: `1e1`, + }, unmarshalCase{ + ptr: (**interface{})(nil), + input: `1.0e1`, + }, unmarshalCase{ + ptr: (*[]interface{})(nil), + input: `[1.0e1]`, + }, unmarshalCase{ + ptr: (*struct { + Field interface{} + })(nil), + input: `{"field":"hello"}`, + }, unmarshalCase{ + obj: func() interface{} { + type TestData struct { + Name string `json:"name"` + } + o := &TestData{} + return &o + }, + input: `{"name":"value"}`, + }, unmarshalCase{ + obj: func() interface{} { + b := true + return &struct { + Field interface{} `json:"field"` + }{&b} + }, + input: `{"field": null}`, + }, unmarshalCase{ + obj: func() interface{} { + var pb *bool + return &struct { + Field interface{} `json:"field"` + }{&pb} + }, + input: `{"field": null}`, + }, unmarshalCase{ + obj: func() interface{} { + b := true + pb := &b + return &struct { + Field interface{} `json:"field"` + }{&pb} + }, + input: `{"field": null}`, + }) + marshalCases = append(marshalCases, + pEFace("hello"), + struct { + Field interface{} + }{"hello"}, + struct { + Field interface{} + }{struct { + field chan int + }{}}, + struct { + Field interface{} + }{struct { + Field *int + }{pInt(100)}}, + ) +} diff --git a/vendor/github.com/json-iterator/go/jsoniter_float_test.go b/vendor/github.com/json-iterator/go/value_tests/float_test.go similarity index 51% rename from vendor/github.com/json-iterator/go/jsoniter_float_test.go rename to vendor/github.com/json-iterator/go/value_tests/float_test.go index 3955be0be..3c00b2694 100644 --- a/vendor/github.com/json-iterator/go/jsoniter_float_test.go +++ b/vendor/github.com/json-iterator/go/value_tests/float_test.go @@ -1,33 +1,15 @@ -// +build go1.8 - -package jsoniter +package test import ( "bytes" "encoding/json" "fmt" + "github.com/json-iterator/go" + "github.com/stretchr/testify/require" "strconv" "testing" - - "github.com/stretchr/testify/require" ) -func Test_read_big_float(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `12.3`) - val := iter.ReadBigFloat() - val64, _ := val.Float64() - should.Equal(12.3, val64) -} - -func Test_read_big_int(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `92233720368547758079223372036854775807`) - val := iter.ReadBigInt() - should.NotNil(val) - should.Equal(`92233720368547758079223372036854775807`, val.String()) -} - func Test_read_float(t *testing.T) { inputs := []string{ `1.1`, `1000`, `9223372036854775807`, `12.3`, `-12.3`, `720368.54775807`, `720368.547758075`, @@ -37,14 +19,14 @@ func Test_read_float(t *testing.T) { // non-streaming t.Run(fmt.Sprintf("%v", input), func(t *testing.T) { should := require.New(t) - iter := ParseString(ConfigDefault, input+",") + iter := jsoniter.ParseString(jsoniter.ConfigDefault, input+",") expected, err := strconv.ParseFloat(input, 32) should.Nil(err) should.Equal(float32(expected), iter.ReadFloat32()) }) t.Run(fmt.Sprintf("%v", input), func(t *testing.T) { should := require.New(t) - iter := ParseString(ConfigDefault, input+",") + iter := jsoniter.ParseString(jsoniter.ConfigDefault, input+",") expected, err := strconv.ParseFloat(input, 64) should.Nil(err) should.Equal(expected, iter.ReadFloat64()) @@ -52,14 +34,14 @@ func Test_read_float(t *testing.T) { // streaming t.Run(fmt.Sprintf("%v", input), func(t *testing.T) { should := require.New(t) - iter := Parse(ConfigDefault, bytes.NewBufferString(input+","), 2) + iter := jsoniter.Parse(jsoniter.ConfigDefault, bytes.NewBufferString(input+","), 2) expected, err := strconv.ParseFloat(input, 32) should.Nil(err) should.Equal(float32(expected), iter.ReadFloat32()) }) t.Run(fmt.Sprintf("%v", input), func(t *testing.T) { should := require.New(t) - iter := Parse(ConfigDefault, bytes.NewBufferString(input+","), 2) + iter := jsoniter.Parse(jsoniter.ConfigDefault, bytes.NewBufferString(input+","), 2) val := float64(0) err := json.Unmarshal([]byte(input), &val) should.Nil(err) @@ -68,19 +50,6 @@ func Test_read_float(t *testing.T) { } } -func Test_read_float_as_interface(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `12.3`) - should.Equal(float64(12.3), iter.Read()) -} - -func Test_wrap_float(t *testing.T) { - should := require.New(t) - str, err := MarshalToString(WrapFloat64(12.3)) - should.Nil(err) - should.Equal("12.3", str) -} - func Test_write_float32(t *testing.T) { vals := []float32{0, 1, -1, 99, 0xff, 0xfff, 0xffff, 0xfffff, 0xffffff, 0x4ffffff, 0xfffffff, -0x4ffffff, -0xfffffff, 1.2345, 1.23456, 1.234567, 1.001} @@ -88,7 +57,7 @@ func Test_write_float32(t *testing.T) { t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) stream.WriteFloat32Lossy(val) stream.Flush() should.Nil(stream.Error) @@ -99,7 +68,7 @@ func Test_write_float32(t *testing.T) { t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) stream.WriteVal(val) stream.Flush() should.Nil(stream.Error) @@ -110,16 +79,16 @@ func Test_write_float32(t *testing.T) { } should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 10) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 10) stream.WriteRaw("abcdefg") stream.WriteFloat32Lossy(1.123456) stream.Flush() should.Nil(stream.Error) should.Equal("abcdefg1.123456", buf.String()) - stream = NewStream(ConfigDefault, nil, 0) + stream = jsoniter.NewStream(jsoniter.ConfigDefault, nil, 0) stream.WriteFloat32(float32(0.0000001)) - should.Equal("1e-07", string(stream.buf)) + should.Equal("1e-07", string(stream.Buffer())) } func Test_write_float64(t *testing.T) { @@ -129,7 +98,7 @@ func Test_write_float64(t *testing.T) { t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) stream.WriteFloat64Lossy(val) stream.Flush() should.Nil(stream.Error) @@ -138,7 +107,7 @@ func Test_write_float64(t *testing.T) { t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) stream.WriteVal(val) stream.Flush() should.Nil(stream.Error) @@ -147,71 +116,14 @@ func Test_write_float64(t *testing.T) { } should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 10) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 10) stream.WriteRaw("abcdefg") stream.WriteFloat64Lossy(1.123456) stream.Flush() should.Nil(stream.Error) should.Equal("abcdefg1.123456", buf.String()) - stream = NewStream(ConfigDefault, nil, 0) + stream = jsoniter.NewStream(jsoniter.ConfigDefault, nil, 0) stream.WriteFloat64(float64(0.0000001)) - should.Equal("1e-07", string(stream.buf)) -} - -func Test_read_float64_cursor(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, "[1.23456789\n,2,3]") - should.True(iter.ReadArray()) - should.Equal(1.23456789, iter.Read()) - should.True(iter.ReadArray()) - should.Equal(float64(2), iter.Read()) -} - -func Test_read_float_scientific(t *testing.T) { - should := require.New(t) - var obj interface{} - should.Nil(UnmarshalFromString(`1e1`, &obj)) - should.Equal(float64(10), obj) - should.Nil(json.Unmarshal([]byte(`1e1`), &obj)) - should.Equal(float64(10), obj) - should.Nil(UnmarshalFromString(`1.0e1`, &obj)) - should.Equal(float64(10), obj) - should.Nil(json.Unmarshal([]byte(`1.0e1`), &obj)) - should.Equal(float64(10), obj) -} - -func Test_lossy_float_marshal(t *testing.T) { - should := require.New(t) - api := Config{MarshalFloatWith6Digits: true}.Froze() - output, err := api.MarshalToString(float64(0.1234567)) - should.Nil(err) - should.Equal("0.123457", output) - output, err = api.MarshalToString(float32(0.1234567)) - should.Nil(err) - should.Equal("0.123457", output) -} - -func Test_read_number(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `92233720368547758079223372036854775807`) - val := iter.ReadNumber() - should.Equal(`92233720368547758079223372036854775807`, string(val)) -} - -func Benchmark_jsoniter_float(b *testing.B) { - b.ReportAllocs() - input := []byte(`1.1123,`) - iter := NewIterator(ConfigDefault) - for n := 0; n < b.N; n++ { - iter.ResetBytes(input) - iter.ReadFloat64() - } -} - -func Benchmark_json_float(b *testing.B) { - for n := 0; n < b.N; n++ { - result := float64(0) - json.Unmarshal([]byte(`1.1`), &result) - } + should.Equal("1e-07", string(stream.Buffer())) } diff --git a/vendor/github.com/json-iterator/go/value_tests/iface_test.go b/vendor/github.com/json-iterator/go/value_tests/iface_test.go new file mode 100644 index 000000000..b0daf1e00 --- /dev/null +++ b/vendor/github.com/json-iterator/go/value_tests/iface_test.go @@ -0,0 +1,45 @@ +package test + +import "io" + +func init() { + var pCloser1 = func(str string) *io.Closer { + closer := io.Closer(strCloser1(str)) + return &closer + } + var pCloser2 = func(str string) *io.Closer { + strCloser := strCloser2(str) + closer := io.Closer(&strCloser) + return &closer + } + marshalCases = append(marshalCases, + pCloser1("hello"), + pCloser2("hello"), + ) + unmarshalCases = append(unmarshalCases, unmarshalCase{ + ptr: (*[]io.Closer)(nil), + input: "[null]", + }, unmarshalCase{ + obj: func() interface{} { + strCloser := strCloser2("") + return &struct { + Field io.Closer + }{ + &strCloser, + } + }, + input: `{"Field": "hello"}`, + }) +} + +type strCloser1 string + +func (closer strCloser1) Close() error { + return nil +} + +type strCloser2 string + +func (closer *strCloser2) Close() error { + return nil +} diff --git a/vendor/github.com/json-iterator/go/jsoniter_int_test.go b/vendor/github.com/json-iterator/go/value_tests/int_test.go similarity index 63% rename from vendor/github.com/json-iterator/go/jsoniter_int_test.go rename to vendor/github.com/json-iterator/go/value_tests/int_test.go index e0f11835f..9a3165ed5 100644 --- a/vendor/github.com/json-iterator/go/jsoniter_int_test.go +++ b/vendor/github.com/json-iterator/go/value_tests/int_test.go @@ -1,69 +1,55 @@ -// +build go1.8 - -package jsoniter +package test import ( "bytes" - "encoding/json" "fmt" - "io/ioutil" + "github.com/json-iterator/go" + "github.com/stretchr/testify/require" "strconv" "testing" - - "github.com/stretchr/testify/require" ) -func Test_read_uint64_invalid(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, ",") - iter.ReadUint64() - should.NotNil(iter.Error) -} - -func Test_read_int_from_null(t *testing.T) { - - type TestObject struct { - F1 int8 - F2 int16 - F3 int32 - F4 int64 - F5 int - F6 uint8 - F7 uint16 - F8 uint32 - F9 uint64 - F10 uint - F11 float32 - F12 float64 - F13 uintptr - } - - should := require.New(t) - obj := TestObject{} - err := Unmarshal([]byte(`{ - "f1":null, - "f2":null, - "f3":null, - "f4":null, - "f5":null, - "f6":null, - "f7":null, - "f8":null, - "f9":null, - "f10":null, - "f11":null, - "f12":null, - "f13":null - }`), &obj) - should.Nil(err) +func init() { + unmarshalCases = append(unmarshalCases, unmarshalCase{ + ptr: (*struct { + F1 int8 + F2 int16 + F3 int32 + F4 int64 + F5 int + F6 uint8 + F7 uint16 + F8 uint32 + F9 uint64 + F10 uint + F11 float32 + F12 float64 + F13 uintptr + })(nil), + input: `{ + "f1":null, + "f2":null, + "f3":null, + "f4":null, + "f5":null, + "f6":null, + "f7":null, + "f8":null, + "f9":null, + "f10":null, + "f11":null, + "f12":null, + "f13":null + }`, + }) } -func _int8(t *testing.T) { +func Test_int8(t *testing.T) { inputs := []string{`127`, `-128`} for _, input := range inputs { t.Run(fmt.Sprintf("%v", input), func(t *testing.T) { should := require.New(t) - iter := ParseString(ConfigDefault, input) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, input) expected, err := strconv.ParseInt(input, 10, 8) should.Nil(err) should.Equal(int8(expected), iter.ReadInt8()) @@ -76,7 +62,7 @@ func Test_read_int16(t *testing.T) { for _, input := range inputs { t.Run(fmt.Sprintf("%v", input), func(t *testing.T) { should := require.New(t) - iter := ParseString(ConfigDefault, input) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, input) expected, err := strconv.ParseInt(input, 10, 16) should.Nil(err) should.Equal(int16(expected), iter.ReadInt16()) @@ -89,14 +75,14 @@ func Test_read_int32(t *testing.T) { for _, input := range inputs { t.Run(fmt.Sprintf("%v", input), func(t *testing.T) { should := require.New(t) - iter := ParseString(ConfigDefault, input) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, input) expected, err := strconv.ParseInt(input, 10, 32) should.Nil(err) should.Equal(int32(expected), iter.ReadInt32()) }) t.Run(fmt.Sprintf("%v", input), func(t *testing.T) { should := require.New(t) - iter := Parse(ConfigDefault, bytes.NewBufferString(input), 2) + iter := jsoniter.Parse(jsoniter.ConfigDefault, bytes.NewBufferString(input), 2) expected, err := strconv.ParseInt(input, 10, 32) should.Nil(err) should.Equal(int32(expected), iter.ReadInt32()) @@ -104,31 +90,15 @@ func Test_read_int32(t *testing.T) { } } -func Test_read_int32_array(t *testing.T) { - should := require.New(t) - input := `[123,456,789]` - val := make([]int32, 0) - UnmarshalFromString(input, &val) - should.Equal(3, len(val)) -} - -func Test_read_int64_array(t *testing.T) { - should := require.New(t) - input := `[123,456,789]` - val := make([]int64, 0) - UnmarshalFromString(input, &val) - should.Equal(3, len(val)) -} - func Test_read_int_overflow(t *testing.T) { should := require.New(t) inputArr := []string{"123451", "-123451"} for _, s := range inputArr { - iter := ParseString(ConfigDefault, s) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, s) iter.ReadInt8() should.NotNil(iter.Error) - iterU := ParseString(ConfigDefault, s) + iterU := jsoniter.ParseString(jsoniter.ConfigDefault, s) iterU.ReadUint8() should.NotNil(iterU.Error) @@ -136,33 +106,33 @@ func Test_read_int_overflow(t *testing.T) { inputArr = []string{"12345678912", "-12345678912"} for _, s := range inputArr { - iter := ParseString(ConfigDefault, s) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, s) iter.ReadInt16() should.NotNil(iter.Error) - iterUint := ParseString(ConfigDefault, s) + iterUint := jsoniter.ParseString(jsoniter.ConfigDefault, s) iterUint.ReadUint16() should.NotNil(iterUint.Error) } inputArr = []string{"3111111111", "-3111111111", "1234232323232323235678912", "-1234567892323232323212"} for _, s := range inputArr { - iter := ParseString(ConfigDefault, s) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, s) iter.ReadInt32() should.NotNil(iter.Error) - iterUint := ParseString(ConfigDefault, s) + iterUint := jsoniter.ParseString(jsoniter.ConfigDefault, s) iterUint.ReadUint32() should.NotNil(iterUint.Error) } inputArr = []string{"9223372036854775811", "-9523372036854775807", "1234232323232323235678912", "-1234567892323232323212"} for _, s := range inputArr { - iter := ParseString(ConfigDefault, s) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, s) iter.ReadInt64() should.NotNil(iter.Error) - iterUint := ParseString(ConfigDefault, s) + iterUint := jsoniter.ParseString(jsoniter.ConfigDefault, s) iterUint.ReadUint64() should.NotNil(iterUint.Error) } @@ -173,14 +143,14 @@ func Test_read_int64(t *testing.T) { for _, input := range inputs { t.Run(fmt.Sprintf("%v", input), func(t *testing.T) { should := require.New(t) - iter := ParseString(ConfigDefault, input) + iter := jsoniter.ParseString(jsoniter.ConfigDefault, input) expected, err := strconv.ParseInt(input, 10, 64) should.Nil(err) should.Equal(expected, iter.ReadInt64()) }) t.Run(fmt.Sprintf("%v", input), func(t *testing.T) { should := require.New(t) - iter := Parse(ConfigDefault, bytes.NewBufferString(input), 2) + iter := jsoniter.Parse(jsoniter.ConfigDefault, bytes.NewBufferString(input), 2) expected, err := strconv.ParseInt(input, 10, 64) should.Nil(err) should.Equal(expected, iter.ReadInt64()) @@ -188,28 +158,13 @@ func Test_read_int64(t *testing.T) { } } -func Test_read_int64_overflow(t *testing.T) { - should := require.New(t) - input := "123456789123456789123456789123456789," - iter := ParseString(ConfigDefault, input) - iter.ReadInt64() - should.NotNil(iter.Error) -} - -func Test_wrap_int(t *testing.T) { - should := require.New(t) - str, err := MarshalToString(WrapInt64(100)) - should.Nil(err) - should.Equal("100", str) -} - func Test_write_uint8(t *testing.T) { vals := []uint8{0, 1, 11, 111, 255} for _, val := range vals { t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) stream.WriteUint8(val) stream.Flush() should.Nil(stream.Error) @@ -218,7 +173,7 @@ func Test_write_uint8(t *testing.T) { t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) stream.WriteVal(val) stream.Flush() should.Nil(stream.Error) @@ -227,7 +182,7 @@ func Test_write_uint8(t *testing.T) { } should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 3) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 3) stream.WriteRaw("a") stream.WriteUint8(100) // should clear buffer stream.Flush() @@ -241,7 +196,7 @@ func Test_write_int8(t *testing.T) { t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) stream.WriteInt8(val) stream.Flush() should.Nil(stream.Error) @@ -250,7 +205,7 @@ func Test_write_int8(t *testing.T) { t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) stream.WriteVal(val) stream.Flush() should.Nil(stream.Error) @@ -259,7 +214,7 @@ func Test_write_int8(t *testing.T) { } should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4) stream.WriteRaw("a") stream.WriteInt8(-100) // should clear buffer stream.Flush() @@ -273,7 +228,7 @@ func Test_write_uint16(t *testing.T) { t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) stream.WriteUint16(val) stream.Flush() should.Nil(stream.Error) @@ -282,7 +237,7 @@ func Test_write_uint16(t *testing.T) { t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) stream.WriteVal(val) stream.Flush() should.Nil(stream.Error) @@ -291,7 +246,7 @@ func Test_write_uint16(t *testing.T) { } should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 5) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 5) stream.WriteRaw("a") stream.WriteUint16(10000) // should clear buffer stream.Flush() @@ -305,7 +260,7 @@ func Test_write_int16(t *testing.T) { t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) stream.WriteInt16(val) stream.Flush() should.Nil(stream.Error) @@ -314,7 +269,7 @@ func Test_write_int16(t *testing.T) { t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) stream.WriteVal(val) stream.Flush() should.Nil(stream.Error) @@ -323,7 +278,7 @@ func Test_write_int16(t *testing.T) { } should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 6) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 6) stream.WriteRaw("a") stream.WriteInt16(-10000) // should clear buffer stream.Flush() @@ -337,7 +292,7 @@ func Test_write_uint32(t *testing.T) { t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) stream.WriteUint32(val) stream.Flush() should.Nil(stream.Error) @@ -346,7 +301,7 @@ func Test_write_uint32(t *testing.T) { t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) stream.WriteVal(val) stream.Flush() should.Nil(stream.Error) @@ -355,7 +310,7 @@ func Test_write_uint32(t *testing.T) { } should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 10) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 10) stream.WriteRaw("a") stream.WriteUint32(0xffffffff) // should clear buffer stream.Flush() @@ -369,7 +324,7 @@ func Test_write_int32(t *testing.T) { t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) stream.WriteInt32(val) stream.Flush() should.Nil(stream.Error) @@ -378,7 +333,7 @@ func Test_write_int32(t *testing.T) { t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) stream.WriteVal(val) stream.Flush() should.Nil(stream.Error) @@ -387,7 +342,7 @@ func Test_write_int32(t *testing.T) { } should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 11) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 11) stream.WriteRaw("a") stream.WriteInt32(-0x7fffffff) // should clear buffer stream.Flush() @@ -403,7 +358,7 @@ func Test_write_uint64(t *testing.T) { t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) stream.WriteUint64(val) stream.Flush() should.Nil(stream.Error) @@ -412,7 +367,7 @@ func Test_write_uint64(t *testing.T) { t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) stream.WriteVal(val) stream.Flush() should.Nil(stream.Error) @@ -421,7 +376,7 @@ func Test_write_uint64(t *testing.T) { } should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 10) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 10) stream.WriteRaw("a") stream.WriteUint64(0xffffffff) // should clear buffer stream.Flush() @@ -437,7 +392,7 @@ func Test_write_int64(t *testing.T) { t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) stream.WriteInt64(val) stream.Flush() should.Nil(stream.Error) @@ -446,7 +401,7 @@ func Test_write_int64(t *testing.T) { t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 4096) stream.WriteVal(val) stream.Flush() should.Nil(stream.Error) @@ -455,119 +410,10 @@ func Test_write_int64(t *testing.T) { } should := require.New(t) buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 10) + stream := jsoniter.NewStream(jsoniter.ConfigDefault, buf, 10) stream.WriteRaw("a") stream.WriteInt64(0xffffffff) // should clear buffer stream.Flush() should.Nil(stream.Error) should.Equal("a4294967295", buf.String()) } - -func Test_write_val_int(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteVal(1001) - stream.Flush() - should.Nil(stream.Error) - should.Equal("1001", buf.String()) -} - -func Test_write_val_int_ptr(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - val := 1001 - stream.WriteVal(&val) - stream.Flush() - should.Nil(stream.Error) - should.Equal("1001", buf.String()) -} - -func Test_json_number(t *testing.T) { - should := require.New(t) - var arr []json.Number - err := Unmarshal([]byte(`[1]`), &arr) - should.Nil(err) - should.Equal(json.Number("1"), arr[0]) - str, err := MarshalToString(arr) - should.Nil(err) - should.Equal(`[1]`, str) -} - -func Test_jsoniter_number(t *testing.T) { - should := require.New(t) - var arr []Number - err := Unmarshal([]byte(`[1]`), &arr) - should.Nil(err) - should.Equal(Number("1"), arr[0]) - str, isNumber := CastJsonNumber(arr[0]) - should.True(isNumber) - should.Equal("1", str) -} - -func Test_non_numeric_as_number(t *testing.T) { - should := require.New(t) - var v1 json.Number - err := Unmarshal([]byte(`"500"`), &v1) - should.Nil(err) - should.Equal("500", string(v1)) - var v2 Number - err = Unmarshal([]byte(`"500"`), &v2) - should.Nil(err) - should.Equal("500", string(v2)) -} - -func Test_null_as_number(t *testing.T) { - should := require.New(t) - var v1 json.Number - err := json.Unmarshal([]byte(`null`), &v1) - should.Nil(err) - should.Equal("", string(v1)) - output, err := json.Marshal(v1) - should.NoError(err) - should.Equal("0", string(output)) - var v2 Number - err = Unmarshal([]byte(`null`), &v2) - should.Nil(err) - should.Equal("", string(v2)) - output, err = Marshal(v2) - should.NoError(err) - should.Equal("0", string(output)) -} - -func Test_float_as_int(t *testing.T) { - should := require.New(t) - var i int - should.NotNil(Unmarshal([]byte(`1.1`), &i)) -} - -func Benchmark_jsoniter_encode_int(b *testing.B) { - stream := NewStream(ConfigDefault, ioutil.Discard, 64) - for n := 0; n < b.N; n++ { - stream.n = 0 - stream.WriteUint64(0xffffffff) - } -} - -func Benchmark_itoa(b *testing.B) { - for n := 0; n < b.N; n++ { - strconv.FormatInt(0xffffffff, 10) - } -} - -func Benchmark_jsoniter_int(b *testing.B) { - iter := NewIterator(ConfigDefault) - input := []byte(`100`) - for n := 0; n < b.N; n++ { - iter.ResetBytes(input) - iter.ReadInt64() - } -} - -func Benchmark_json_int(b *testing.B) { - for n := 0; n < b.N; n++ { - result := int64(0) - json.Unmarshal([]byte(`-100`), &result) - } -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_invalid_test.go b/vendor/github.com/json-iterator/go/value_tests/invalid_test.go similarity index 66% rename from vendor/github.com/json-iterator/go/jsoniter_invalid_test.go rename to vendor/github.com/json-iterator/go/value_tests/invalid_test.go index a9f3342f6..5b594a95b 100644 --- a/vendor/github.com/json-iterator/go/jsoniter_invalid_test.go +++ b/vendor/github.com/json-iterator/go/value_tests/invalid_test.go @@ -1,8 +1,9 @@ -package jsoniter +package test import ( "bytes" "encoding/json" + "github.com/json-iterator/go" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "io" @@ -16,18 +17,18 @@ func Test_missing_object_end(t *testing.T) { Tags map[string]interface{} `json:"tags"` } obj := TestObject{} - should.NotNil(UnmarshalFromString(`{"metric": "sys.777","tags": {"a":"123"}`, &obj)) + should.NotNil(jsoniter.UnmarshalFromString(`{"metric": "sys.777","tags": {"a":"123"}`, &obj)) } func Test_missing_array_end(t *testing.T) { should := require.New(t) - should.NotNil(UnmarshalFromString(`[1,2,3`, &[]int{})) + should.NotNil(jsoniter.UnmarshalFromString(`[1,2,3`, &[]int{})) } func Test_invalid_any(t *testing.T) { should := require.New(t) - any := Get([]byte("[]")) - should.Equal(InvalidValue, any.Get(0.3).ValueType()) + any := jsoniter.Get([]byte("[]")) + should.Equal(jsoniter.InvalidValue, any.Get(0.3).ValueType()) // is nil correct ? should.Equal(nil, any.Get(0.3).GetInterface()) @@ -43,7 +44,7 @@ func Test_invalid_any(t *testing.T) { should.Equal(float64(0), any.ToFloat64()) should.Equal("", any.ToString()) - should.Equal(InvalidValue, any.Get(0.1).Get(1).ValueType()) + should.Equal(jsoniter.InvalidValue, any.Get(0.1).Get(1).ValueType()) } func Test_invalid_struct_input(t *testing.T) { @@ -51,7 +52,7 @@ func Test_invalid_struct_input(t *testing.T) { type TestObject struct{} input := []byte{54, 141, 30} obj := TestObject{} - should.NotNil(Unmarshal(input, &obj)) + should.NotNil(jsoniter.Unmarshal(input, &obj)) } func Test_invalid_slice_input(t *testing.T) { @@ -59,7 +60,7 @@ func Test_invalid_slice_input(t *testing.T) { type TestObject struct{} input := []byte{93} obj := []string{} - should.NotNil(Unmarshal(input, &obj)) + should.NotNil(jsoniter.Unmarshal(input, &obj)) } func Test_invalid_array_input(t *testing.T) { @@ -67,7 +68,7 @@ func Test_invalid_array_input(t *testing.T) { type TestObject struct{} input := []byte{93} obj := [0]string{} - should.NotNil(Unmarshal(input, &obj)) + should.NotNil(jsoniter.Unmarshal(input, &obj)) } func Test_invalid_float(t *testing.T) { @@ -83,17 +84,17 @@ func Test_invalid_float(t *testing.T) { for _, input := range inputs { t.Run(input, func(t *testing.T) { should := require.New(t) - iter := ParseString(ConfigDefault, input+",") + iter := jsoniter.ParseString(jsoniter.ConfigDefault, input+",") iter.Skip() should.NotEqual(io.EOF, iter.Error) should.NotNil(iter.Error) v := float64(0) should.NotNil(json.Unmarshal([]byte(input), &v)) - iter = ParseString(ConfigDefault, input+",") + iter = jsoniter.ParseString(jsoniter.ConfigDefault, input+",") iter.ReadFloat64() should.NotEqual(io.EOF, iter.Error) should.NotNil(iter.Error) - iter = ParseString(ConfigDefault, input+",") + iter = jsoniter.ParseString(jsoniter.ConfigDefault, input+",") iter.ReadFloat32() should.NotEqual(io.EOF, iter.Error) should.NotNil(iter.Error) @@ -121,10 +122,10 @@ func Test_invalid_number(t *testing.T) { Number int `json:"number"` } obj := Message{} - decoder := ConfigCompatibleWithStandardLibrary.NewDecoder(bytes.NewBufferString(`{"number":"5"}`)) + decoder := jsoniter.ConfigCompatibleWithStandardLibrary.NewDecoder(bytes.NewBufferString(`{"number":"5"}`)) err := decoder.Decode(&obj) invalidStr := err.Error() - result, err := ConfigCompatibleWithStandardLibrary.Marshal(invalidStr) + result, err := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(invalidStr) should := require.New(t) should.Nil(err) result2, err := json.Marshal(invalidStr) @@ -134,8 +135,8 @@ func Test_invalid_number(t *testing.T) { func Test_valid(t *testing.T) { should := require.New(t) - should.True(Valid([]byte(`{}`))) - should.False(Valid([]byte(`{`))) + should.True(jsoniter.Valid([]byte(`{}`))) + should.False(jsoniter.Valid([]byte(`{`))) } func Test_nil_pointer(t *testing.T) { @@ -145,7 +146,7 @@ func Test_nil_pointer(t *testing.T) { X int } var obj *T - err := Unmarshal(data, obj) + err := jsoniter.Unmarshal(data, obj) should.NotNil(err) } @@ -161,7 +162,7 @@ func Test_func_pointer_type(t *testing.T) { output, err := json.Marshal(TestObject1{}) should.Nil(err) should.Equal(`{"Obj":null}`, string(output)) - output, err = Marshal(TestObject1{}) + output, err = jsoniter.Marshal(TestObject1{}) should.Nil(err) should.Equal(`{"Obj":null}`, string(output)) }) @@ -169,32 +170,57 @@ func Test_func_pointer_type(t *testing.T) { should := require.New(t) _, err := json.Marshal(TestObject1{Obj: &TestObject2{}}) should.NotNil(err) - _, err = Marshal(TestObject1{Obj: &TestObject2{}}) + _, err = jsoniter.Marshal(TestObject1{Obj: &TestObject2{}}) should.NotNil(err) }) t.Run("decode null is valid", func(t *testing.T) { should := require.New(t) var obj TestObject1 should.Nil(json.Unmarshal([]byte(`{"Obj":{"F": null}}`), &obj)) - should.Nil(Unmarshal([]byte(`{"Obj":{"F": null}}`), &obj)) + should.Nil(jsoniter.Unmarshal([]byte(`{"Obj":{"F": null}}`), &obj)) }) t.Run("decode not null is invalid", func(t *testing.T) { should := require.New(t) var obj TestObject1 should.NotNil(json.Unmarshal([]byte(`{"Obj":{"F": "hello"}}`), &obj)) - should.NotNil(Unmarshal([]byte(`{"Obj":{"F": "hello"}}`), &obj)) + should.NotNil(jsoniter.Unmarshal([]byte(`{"Obj":{"F": "hello"}}`), &obj)) }) } func TestEOF(t *testing.T) { var s string - err := ConfigCompatibleWithStandardLibrary.NewDecoder(&bytes.Buffer{}).Decode(&s) + err := jsoniter.ConfigCompatibleWithStandardLibrary.NewDecoder(&bytes.Buffer{}).Decode(&s) assert.Equal(t, io.EOF, err) } func TestDecodeErrorType(t *testing.T) { should := require.New(t) var err error - should.Nil(Unmarshal([]byte("null"), &err)) - should.NotNil(Unmarshal([]byte("123"), &err)) + should.Nil(jsoniter.Unmarshal([]byte("null"), &err)) + should.NotNil(jsoniter.Unmarshal([]byte("123"), &err)) +} + +func Test_decode_slash(t *testing.T) { + should := require.New(t) + var obj interface{} + should.NotNil(json.Unmarshal([]byte("\\"), &obj)) + should.NotNil(jsoniter.UnmarshalFromString("\\", &obj)) +} + +func Test_NilInput(t *testing.T) { + var jb []byte // nil + var out string + err := jsoniter.Unmarshal(jb, &out) + if err == nil { + t.Errorf("Expected error") + } +} + +func Test_EmptyInput(t *testing.T) { + jb := []byte("") + var out string + err := jsoniter.Unmarshal(jb, &out) + if err == nil { + t.Errorf("Expected error") + } } diff --git a/vendor/github.com/json-iterator/go/value_tests/map_test.go b/vendor/github.com/json-iterator/go/value_tests/map_test.go new file mode 100644 index 000000000..24cf98ed3 --- /dev/null +++ b/vendor/github.com/json-iterator/go/value_tests/map_test.go @@ -0,0 +1,51 @@ +package test + +import ( + "encoding/json" + "math/big" +) + +func init() { + var pRawMessage = func(val json.RawMessage) *json.RawMessage { + return &val + } + nilMap := map[string]string(nil) + marshalCases = append(marshalCases, + map[string]interface{}{"abc": 1}, + map[string]MyInterface{"hello": MyString("world")}, + map[*big.Float]string{big.NewFloat(1.2): "2"}, + map[string]interface{}{ + "3": 3, + "1": 1, + "2": 2, + }, + map[uint64]interface{}{ + uint64(1): "a", + uint64(2): "a", + uint64(4): "a", + }, + nilMap, + &nilMap, + map[string]*json.RawMessage{"hello": pRawMessage(json.RawMessage("[]"))}, + ) + unmarshalCases = append(unmarshalCases, unmarshalCase{ + ptr: (*map[string]string)(nil), + input: `{"k\"ey": "val"}`, + }, unmarshalCase{ + ptr: (*map[string]string)(nil), + input: `null`, + }, unmarshalCase{ + ptr: (*map[string]*json.RawMessage)(nil), + input: "{\"test\":[{\"key\":\"value\"}]}", + }) +} + +type MyInterface interface { + Hello() string +} + +type MyString string + +func (ms MyString) Hello() string { + return string(ms) +} diff --git a/vendor/github.com/json-iterator/go/value_tests/marshaler_test.go b/vendor/github.com/json-iterator/go/value_tests/marshaler_test.go new file mode 100644 index 000000000..5459495c9 --- /dev/null +++ b/vendor/github.com/json-iterator/go/value_tests/marshaler_test.go @@ -0,0 +1,84 @@ +package test + +import ( + "encoding" + "encoding/json" +) + +func init() { + jm := json.Marshaler(jmOfStruct{}) + tm1 := encoding.TextMarshaler(tmOfStruct{}) + tm2 := encoding.TextMarshaler(&tmOfStructInt{}) + marshalCases = append(marshalCases, + jmOfStruct{}, + &jm, + tmOfStruct{}, + &tm1, + tmOfStructInt{}, + &tm2, + map[tmOfStruct]int{ + {}: 100, + }, + map[*tmOfStruct]int{ + {}: 100, + }, + map[encoding.TextMarshaler]int{ + tm1: 100, + }, + ) + unmarshalCases = append(unmarshalCases, unmarshalCase{ + ptr: (*tmOfMap)(nil), + input: `"{1:2}"`, + }, unmarshalCase{ + ptr: (*tmOfMapPtr)(nil), + input: `"{1:2}"`, + }) +} + +type jmOfStruct struct { + F2 chan []byte +} + +func (q jmOfStruct) MarshalJSON() ([]byte, error) { + return []byte(`""`), nil +} + +func (q *jmOfStruct) UnmarshalJSON(value []byte) error { + return nil +} + +type tmOfStruct struct { + F2 chan []byte +} + +func (q tmOfStruct) MarshalText() ([]byte, error) { + return []byte(`""`), nil +} + +func (q *tmOfStruct) UnmarshalText(value []byte) error { + return nil +} + +type tmOfStructInt struct { + Field2 int +} + +func (q *tmOfStructInt) MarshalText() ([]byte, error) { + return []byte(`"abc"`), nil +} + +func (q *tmOfStructInt) UnmarshalText(value []byte) error { + return nil +} + +type tmOfMap map[int]int + +func (q tmOfMap) UnmarshalText(value []byte) error { + return nil +} + +type tmOfMapPtr map[int]int + +func (q *tmOfMapPtr) UnmarshalText(value []byte) error { + return nil +} diff --git a/vendor/github.com/json-iterator/go/value_tests/number_test.go b/vendor/github.com/json-iterator/go/value_tests/number_test.go new file mode 100644 index 000000000..98ab4b5a4 --- /dev/null +++ b/vendor/github.com/json-iterator/go/value_tests/number_test.go @@ -0,0 +1,17 @@ +package test + +import "encoding/json" + +func init() { + unmarshalCases = append(unmarshalCases, unmarshalCase{ + ptr: (*json.Number)(nil), + input: `"500"`, + }, unmarshalCase{ + ptr: (*json.Number)(nil), + input: `1`, + }, unmarshalCase{ + ptr: (*json.Number)(nil), + input: `null`, + }) + marshalCases = append(marshalCases, json.Number("")) +} diff --git a/vendor/github.com/json-iterator/go/value_tests/ptr_test.go b/vendor/github.com/json-iterator/go/value_tests/ptr_test.go new file mode 100644 index 000000000..222b2d43a --- /dev/null +++ b/vendor/github.com/json-iterator/go/value_tests/ptr_test.go @@ -0,0 +1,39 @@ +package test + +func init() { + var pInt = func(val int) *int { + return &val + } + marshalCases = append(marshalCases, + (*int)(nil), + pInt(100), + ) + unmarshalCases = append(unmarshalCases, unmarshalCase{ + obj: func() interface{} { + var i int + return &i + }, + input: "null", + }, unmarshalCase{ + obj: func() interface{} { + var i *int + return &i + }, + input: "10", + }, unmarshalCase{ + obj: func() interface{} { + var i int + pi := &i + return &pi + }, + input: "null", + }, unmarshalCase{ + obj: func() interface{} { + var i int + pi := &i + ppi := &pi + return &ppi + }, + input: "null", + }) +} diff --git a/vendor/github.com/json-iterator/go/value_tests/raw_message_test.go b/vendor/github.com/json-iterator/go/value_tests/raw_message_test.go new file mode 100644 index 000000000..210451d20 --- /dev/null +++ b/vendor/github.com/json-iterator/go/value_tests/raw_message_test.go @@ -0,0 +1,13 @@ +package test + +import "encoding/json" + +func init() { + marshalCases = append(marshalCases, + json.RawMessage("{}"), + ) + unmarshalCases = append(unmarshalCases, unmarshalCase{ + ptr: (*json.RawMessage)(nil), + input: `[1,2,3]`, + }) +} diff --git a/vendor/github.com/json-iterator/go/value_tests/slice_test.go b/vendor/github.com/json-iterator/go/value_tests/slice_test.go new file mode 100644 index 000000000..3e4c34840 --- /dev/null +++ b/vendor/github.com/json-iterator/go/value_tests/slice_test.go @@ -0,0 +1,25 @@ +package test + +func init() { + nilSlice := []string(nil) + marshalCases = append(marshalCases, + []interface{}{"hello"}, + nilSlice, + &nilSlice, + selectedMarshalCase{[]byte{1,2,3}}, + ) + unmarshalCases = append(unmarshalCases, unmarshalCase{ + ptr: (*[]string)(nil), + input: "null", + }, unmarshalCase{ + ptr: (*[]string)(nil), + input: "[]", + }, unmarshalCase{ + ptr: (*[]byte)(nil), + input: "[1,2,3]", + }, unmarshalCase{ + ptr: (*[]byte)(nil), + input: `"aGVsbG8="`, + selected: true, + }) +} diff --git a/vendor/github.com/json-iterator/go/value_tests/string_test.go b/vendor/github.com/json-iterator/go/value_tests/string_test.go new file mode 100644 index 000000000..5f34f9d88 --- /dev/null +++ b/vendor/github.com/json-iterator/go/value_tests/string_test.go @@ -0,0 +1,88 @@ +package test + +import ( + "encoding/json" + "github.com/json-iterator/go" + "testing" + "unicode/utf8" +) + +func init() { + marshalCases = append(marshalCases, + `>`, + `"数字山谷"`, + "he\u2029\u2028he", + ) + for i := 0; i < utf8.RuneSelf; i++ { + marshalCases = append(marshalCases, string([]byte{byte(i)})) + } +} + +func Test_read_string(t *testing.T) { + badInputs := []string{ + ``, + `"`, + `"\"`, + `"\\\"`, + "\"\n\"", + `"\U0001f64f"`, + `"\uD83D\u00"`, + } + for i := 0; i < 32; i++ { + // control characters are invalid + badInputs = append(badInputs, string([]byte{'"', byte(i), '"'})) + } + + for _, input := range badInputs { + testReadString(t, input, "", true, "json.Unmarshal", json.Unmarshal) + testReadString(t, input, "", true, "jsoniter.Unmarshal", jsoniter.Unmarshal) + testReadString(t, input, "", true, "jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) + } + + goodInputs := []struct { + input string + expectValue string + }{ + {`""`, ""}, + {`"a"`, "a"}, + {`null`, ""}, + {`"Iñtërnâtiônàlizætiøn,💝🐹🌇⛔"`, "Iñtërnâtiônàlizætiøn,💝🐹🌇⛔"}, + {`"\uD83D"`, string([]byte{239, 191, 189})}, + {`"\uD83D\\"`, string([]byte{239, 191, 189, '\\'})}, + {`"\uD83D\ub000"`, string([]byte{239, 191, 189, 235, 128, 128})}, + {`"\uD83D\ude04"`, "😄"}, + {`"\uDEADBEEF"`, string([]byte{239, 191, 189, 66, 69, 69, 70})}, + {`"hel\"lo"`, `hel"lo`}, + {`"hel\\\/lo"`, `hel\/lo`}, + {`"hel\\blo"`, `hel\blo`}, + {`"hel\\\blo"`, "hel\\\blo"}, + {`"hel\\nlo"`, `hel\nlo`}, + {`"hel\\\nlo"`, "hel\\\nlo"}, + {`"hel\\tlo"`, `hel\tlo`}, + {`"hel\\flo"`, `hel\flo`}, + {`"hel\\\flo"`, "hel\\\flo"}, + {`"hel\\\rlo"`, "hel\\\rlo"}, + {`"hel\\\tlo"`, "hel\\\tlo"}, + {`"\u4e2d\u6587"`, "中文"}, + {`"\ud83d\udc4a"`, "\xf0\x9f\x91\x8a"}, + } + + for _, tc := range goodInputs { + testReadString(t, tc.input, tc.expectValue, false, "json.Unmarshal", json.Unmarshal) + testReadString(t, tc.input, tc.expectValue, false, "jsoniter.Unmarshal", jsoniter.Unmarshal) + testReadString(t, tc.input, tc.expectValue, false, "jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal) + } +} + +func testReadString(t *testing.T, input string, expectValue string, expectError bool, marshalerName string, marshaler func([]byte, interface{}) error) { + var value string + err := marshaler([]byte(input), &value) + if expectError != (err != nil) { + t.Errorf("%q: %s: expected error %v, got %v", input, marshalerName, expectError, err) + return + } + if value != expectValue { + t.Errorf("%q: %s: expected %q, got %q", input, marshalerName, expectValue, value) + return + } +} diff --git a/vendor/github.com/json-iterator/go/value_tests/struct_test.go b/vendor/github.com/json-iterator/go/value_tests/struct_test.go new file mode 100644 index 000000000..2335d0786 --- /dev/null +++ b/vendor/github.com/json-iterator/go/value_tests/struct_test.go @@ -0,0 +1,200 @@ +package test + +import ( + "bytes" + "encoding/json" + "time" +) + +func init() { + var pString = func(val string) *string { + return &val + } + epoch := time.Unix(0, 0) + unmarshalCases = append(unmarshalCases, unmarshalCase{ + ptr: (*struct { + Field interface{} + })(nil), + input: `{"Field": "hello"}`, + }, unmarshalCase{ + ptr: (*struct { + Field interface{} + })(nil), + input: `{"Field": "hello"} `, + }, unmarshalCase{ + ptr: (*struct { + Field int `json:"field"` + })(nil), + input: `{"field": null}`, + }, unmarshalCase{ + ptr: (*struct { + ID int `json:"id"` + Payload map[string]interface{} `json:"payload"` + buf *bytes.Buffer + })(nil), + input: ` {"id":1, "payload":{"account":"123","password":"456"}}`, + }, unmarshalCase{ + ptr: (*struct { + Field1 string + })(nil), + input: `{"Field\"1":"hello"}`, + }, unmarshalCase{ + ptr: (*struct { + Field1 string + })(nil), + input: `{"\u0046ield1":"hello"}`, + }, unmarshalCase{ + ptr: (*struct { + Field1 *string + Field2 *string + })(nil), + input: `{"field1": null, "field2": "world"}`, + }, unmarshalCase{ + ptr: (*struct { + Field1 string + Field2 json.RawMessage + })(nil), + input: `{"field1": "hello", "field2":[1,2,3]}`, + }, unmarshalCase{ + ptr: (*struct { + a int + b <-chan int + C int + d *time.Timer + })(nil), + input: `{"a": 444, "b":"bad", "C":256, "d":{"not":"a timer"}}`, + }) + marshalCases = append(marshalCases, + struct { + Field map[string]interface{} + }{ + map[string]interface{}{"hello": "world"}, + }, + struct { + Field map[string]interface{} + Field2 string + }{ + map[string]interface{}{"hello": "world"}, "", + }, + struct { + Field interface{} + }{ + 1024, + }, + struct { + Field MyInterface + }{ + MyString("hello"), + }, + struct { + F *float64 + }{}, + struct { + *time.Time + }{&epoch}, + struct { + *StructVarious + }{&StructVarious{}}, + struct { + *StructVarious + Field int + }{nil, 10}, + struct { + Field1 int + Field2 [1]*float64 + }{}, + struct { + Field interface{} `json:"field,omitempty"` + }{}, + struct { + Field MyInterface `json:"field,omitempty"` + }{}, + struct { + Field MyInterface `json:"field,omitempty"` + }{MyString("hello")}, + struct { + Field json.Marshaler `json:"field"` + }{}, + struct { + Field MyInterface `json:"field"` + }{}, + struct { + Field MyInterface `json:"field"` + }{MyString("hello")}, + struct { + Field1 string `json:"field-1,omitempty"` + Field2 func() `json:"-"` + }{}, + structRecursive{}, + struct { + *CacheItem + + // Omit bad keys + OmitMaxAge omit `json:"cacheAge,omitempty"` + + // Add nice keys + MaxAge int `json:"max_age"` + }{ + CacheItem: &CacheItem{ + Key: "value", + MaxAge: 100, + }, + MaxAge: 20, + }, + structOrder{}, + struct { + Field1 *string + Field2 *string + }{Field2: pString("world")}, + struct { + a int + b <-chan int + C int + d *time.Timer + }{ + a: 42, + b: make(<-chan int, 10), + C: 21, + d: time.NewTimer(10 * time.Second), + }, + ) +} + +type StructVarious struct { + Field0 string + Field1 []string + Field2 map[string]interface{} +} + +type structRecursive struct { + Field1 string + Me *structRecursive +} + +type omit *struct{} +type CacheItem struct { + Key string `json:"key"` + MaxAge int `json:"cacheAge"` +} + +type orderA struct { + Field2 string +} + +type orderC struct { + Field5 string +} + +type orderB struct { + Field4 string + orderC + Field6 string +} + +type structOrder struct { + Field1 string + orderA + Field3 string + orderB + Field7 string +} diff --git a/vendor/github.com/json-iterator/go/value_tests/value_test.go b/vendor/github.com/json-iterator/go/value_tests/value_test.go new file mode 100644 index 000000000..ec1bed77f --- /dev/null +++ b/vendor/github.com/json-iterator/go/value_tests/value_test.go @@ -0,0 +1,80 @@ +package test + +import ( + "encoding/json" + "fmt" + "github.com/json-iterator/go" + "github.com/stretchr/testify/require" + "github.com/modern-go/reflect2" + "testing" +) + +type unmarshalCase struct { + obj func() interface{} + ptr interface{} + input string + selected bool +} + +var unmarshalCases []unmarshalCase + +var marshalCases = []interface{}{ + nil, +} + +type selectedMarshalCase struct { + marshalCase interface{} +} + +func Test_unmarshal(t *testing.T) { + for _, testCase := range unmarshalCases { + if testCase.selected { + unmarshalCases = []unmarshalCase{testCase} + break + } + } + for i, testCase := range unmarshalCases { + t.Run(fmt.Sprintf("[%v]%s", i, testCase.input), func(t *testing.T) { + should := require.New(t) + var obj1 interface{} + var obj2 interface{} + if testCase.obj != nil { + obj1 = testCase.obj() + obj2 = testCase.obj() + } else { + valType := reflect2.TypeOfPtr(testCase.ptr).Elem() + obj1 = valType.New() + obj2 = valType.New() + } + err1 := json.Unmarshal([]byte(testCase.input), obj1) + should.NoError(err1, "json") + err2 := jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal([]byte(testCase.input), obj2) + should.NoError(err2, "jsoniter") + should.Equal(obj1, obj2) + }) + } +} + +func Test_marshal(t *testing.T) { + for _, testCase := range marshalCases { + selectedMarshalCase, found := testCase.(selectedMarshalCase) + if found { + marshalCases = []interface{}{selectedMarshalCase.marshalCase} + break + } + } + for i, testCase := range marshalCases { + var name string + if testCase != nil { + name = fmt.Sprintf("[%v]%v/%s", i, testCase, reflect2.TypeOf(testCase).String()) + } + t.Run(name, func(t *testing.T) { + should := require.New(t) + output1, err1 := json.Marshal(testCase) + should.NoError(err1, "json") + output2, err2 := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(testCase) + should.NoError(err2, "jsoniter") + should.Equal(string(output1), string(output2)) + }) + } +} diff --git a/vendor/github.com/kubernetes-csi/csi-test/Gopkg.lock b/vendor/github.com/kubernetes-csi/csi-test/Gopkg.lock index 95c54da29..8517fe6f3 100644 --- a/vendor/github.com/kubernetes-csi/csi-test/Gopkg.lock +++ b/vendor/github.com/kubernetes-csi/csi-test/Gopkg.lock @@ -2,10 +2,10 @@ [[projects]] - branch = "master" name = "github.com/container-storage-interface/spec" packages = ["lib/go/csi/v0"] revision = "35d9f9d77954980e449e52c3f3e43c21bd8171f5" + version = "v0.2.0" [[projects]] name = "github.com/golang/mock" @@ -70,6 +70,18 @@ revision = "003f63b7f4cff3fc95357005358af2de0f5fe152" version = "v1.3.0" +[[projects]] + name = "github.com/sirupsen/logrus" + packages = ["."] + revision = "d682213848ed68c0a260ca37d6dd5ace8423f5ba" + version = "v1.0.4" + +[[projects]] + branch = "master" + name = "golang.org/x/crypto" + packages = ["ssh/terminal"] + revision = "91a49db82a88618983a78a06c1cbd4e00ab749ab" + [[projects]] branch = "master" name = "golang.org/x/net" @@ -85,13 +97,16 @@ "lex/httplex", "trace" ] - revision = "cbe0f9307d0156177f9dd5dc85da1a31abc5f2fb" + revision = "22ae77b79946ea320088417e4d50825671d82d57" [[projects]] branch = "master" name = "golang.org/x/sys" - packages = ["unix"] - revision = "f6cff0780e542efa0c8e864dc8fa522808f6a598" + packages = [ + "unix", + "windows" + ] + revision = "dd2ff4accc098aceecb86b36eaa7829b2a17b1c9" [[projects]] name = "golang.org/x/text" @@ -130,7 +145,7 @@ branch = "master" name = "google.golang.org/genproto" packages = ["googleapis/rpc/status"] - revision = "2d9486acae19cf9bd0c093d7dc236a323726a9e4" + revision = "2c5e7ac708aaa719366570dd82bda44541ca2a63" [[projects]] name = "google.golang.org/grpc" @@ -173,6 +188,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "f47d1f5025e3e4b4b099c879060a3775aa05c29c21f95144c129fa4ba1ad128b" + inputs-digest = "b3d02999b00cc5a342dc8b65dd941fbd0f9af728d5d42c433d82c6fcb93bb0cd" solver-name = "gps-cdcl" solver-version = 1 diff --git a/vendor/github.com/kubernetes-csi/csi-test/Gopkg.toml b/vendor/github.com/kubernetes-csi/csi-test/Gopkg.toml index 91e1cabe9..ea61655a2 100644 --- a/vendor/github.com/kubernetes-csi/csi-test/Gopkg.toml +++ b/vendor/github.com/kubernetes-csi/csi-test/Gopkg.toml @@ -27,7 +27,7 @@ [[constraint]] name = "github.com/container-storage-interface/spec" - branch = "master" + version = "~0.2.0" [[constraint]] name = "github.com/golang/mock" diff --git a/vendor/github.com/kubernetes-csi/csi-test/hack/e2e.sh b/vendor/github.com/kubernetes-csi/csi-test/hack/e2e.sh index 4784085a1..43fcba84c 100755 --- a/vendor/github.com/kubernetes-csi/csi-test/hack/e2e.sh +++ b/vendor/github.com/kubernetes-csi/csi-test/hack/e2e.sh @@ -24,16 +24,10 @@ runTest() fi } -# -# TODO Once 0.2.0 change gets merged into gocsi repo, switch back to "go get" -# -git clone https://github.com/thecodeteam/gocsi $GOPATH/src/github.com/thecodeteam/gocsi -pushd $GOPATH/src/github.com/thecodeteam/gocsi -git checkout $CSI_MOCK_VERSION -make build -popd -# -#go get -u github.com/thecodeteam/gocsi/mock +cd mock + make clean mock || exit 1 +cd .. + cd cmd/csi-sanity make clean install || exit 1 cd ../.. diff --git a/vendor/github.com/kubernetes-csi/csi-test/mock/.gitignore b/vendor/github.com/kubernetes-csi/csi-test/mock/.gitignore new file mode 100644 index 000000000..ce020eb6a --- /dev/null +++ b/vendor/github.com/kubernetes-csi/csi-test/mock/.gitignore @@ -0,0 +1 @@ +/mock diff --git a/vendor/github.com/kubernetes-csi/csi-test/mock/AUTHORS b/vendor/github.com/kubernetes-csi/csi-test/mock/AUTHORS new file mode 100644 index 000000000..3a6118575 --- /dev/null +++ b/vendor/github.com/kubernetes-csi/csi-test/mock/AUTHORS @@ -0,0 +1 @@ +TheCodeTeam diff --git a/vendor/github.com/kubernetes-csi/csi-test/mock/Makefile b/vendor/github.com/kubernetes-csi/csi-test/mock/Makefile new file mode 100644 index 000000000..1555ead70 --- /dev/null +++ b/vendor/github.com/kubernetes-csi/csi-test/mock/Makefile @@ -0,0 +1,17 @@ +all: build + +PROG := mock + +$(PROG): *.go ./provider/*.go ./service/*.go + @go install . + go build -o "$@" . + +build: $(PROG) + +clean: + go clean -i -v . + rm -f $(PROG) + +clobber: clean + +.PHONY: clean clobber diff --git a/vendor/github.com/kubernetes-csi/csi-test/mock/README.md b/vendor/github.com/kubernetes-csi/csi-test/mock/README.md new file mode 100644 index 000000000..4236b8b5c --- /dev/null +++ b/vendor/github.com/kubernetes-csi/csi-test/mock/README.md @@ -0,0 +1,46 @@ +# Mock Plug-in +The mock plug-in is a stand-alone binary that implements the CSI +Controller, Identity, and Node RPCs in addition to the specification's +requirements regarding idempotency. + +The mock plug-in always starts with a deterministic state and maintains +state for the duration of the process. The state can also be modified. +For example, while the plug-in launches with three volumes, a +`CreateVolume` RPC will update the plug-in's internal data map so that a +subsequent `ListVolumes` RPC will indicate four volumes are present. + +Per the specification the Mock plug-in starts a gRPC server using the +value of the environment variable `CSI_ENDPOINT`. The plug-in process +runs in the foreground, logging activity to `STDOUT` and errors to +`STDERR`, only returning control to the user when `CTRL-C` is entered +or the process is sent a `kill` signal. + +```bash +$ CSI_ENDPOINT=/tmp/csi.sock mock/mock +INFO 2017/08/22 16:22:15 main.go:154: mock.Serve: /tmp/csi.sock +INFO 2017/08/22 16:22:18 main.go:133: /csi.Controller/CreateVolume: REQ 0001: Version=minor:1 , Name=Test Volume, CapacityRange=required_bytes:10740000000 limit_bytes:107400000000 , VolumeCapabilities=[mount: ], Parameters=map[tag:gold] +INFO 2017/08/22 16:22:18 main.go:133: /csi.Controller/CreateVolume: REP 0001: Reply=&{volume_info: values: > metadata:<> > } +INFO 2017/08/22 16:23:53 main.go:94: received signal: interrupt: shutting down +INFO 2017/08/22 16:23:53 main.go:188: mock.GracefulStop +INFO 2017/08/22 16:23:53 main.go:53: removed sock file: /tmp/csi.sock +INFO 2017/08/22 16:23:53 main.go:64: server stopped gracefully +``` + +## Configuration +The Mock CSI plug-in is created using the GoCSI CSP package. Please +see its [configuration section](../csp/README.md#configuration) for +a complete list of the environment variables that may be used to +configure the Mock SP. + +The following table is a list of the Mock SP's default configuration +values: + +| Name | Value | +|------|---------| +| `X_CSI_IDEMP` | `true` | +| `X_CSI_IDEMP_REQUIRE_VOL` | `true` | +| `X_CSI_REQUIRE_NODE_ID` | `true` | +| `X_CSI_REQUIRE_PUB_VOL_INFO` | `true` | +| `X_CSI_CREATE_VOL_ALREADY_EXISTS` | `true` | +| `X_CSI_DELETE_VOL_NOT_FOUND` | `true` | +| `X_CSI_SUPPORTED_VERSIONS` | `0.2.0 1.0.0 1.1.0` | diff --git a/vendor/github.com/kubernetes-csi/csi-test/mock/context/context.go b/vendor/github.com/kubernetes-csi/csi-test/mock/context/context.go new file mode 100644 index 000000000..694ed65ee --- /dev/null +++ b/vendor/github.com/kubernetes-csi/csi-test/mock/context/context.go @@ -0,0 +1,128 @@ +package context + +import ( + "context" + "os" + "strconv" + "strings" + + "google.golang.org/grpc/metadata" +) + +// RequestIDKey is the key used to put/get a CSI request ID +// in/fromt a Go context. +const RequestIDKey = "csi.requestid" + +var ( + // ctxRequestIDKey is an interface-wrapped key used to access the + // gRPC request ID injected into an outgoing or incoming context + // via the GoCSI request ID injection interceptor + ctxRequestIDKey = interface{}("x-csi-request-id") + + // ctxOSEnviron is an interface-wrapped key used to access a string + // slice that contains one or more environment variables stored as + // KEY=VALUE. + ctxOSEnviron = interface{}("os.Environ") + + // ctxOSLookupEnvKey is an interface-wrapped key used to access a function + // with the signature func(string) (string, bool) that returns the value of + // an environment variable. + ctxOSLookupEnvKey = interface{}("os.LookupEnv") + + // ctxOSSetenvKey is an interface-wrapped key used to access a function + // with the signature func(string, string) that can be used to set the + // value of an environment variable + ctxOSSetenvKey = interface{}("os.Setenev") +) + +type lookupEnvFunc func(string) (string, bool) +type setenvFunc func(string, string) error + +// GetRequestID inspects the context for gRPC metadata and returns +// its request ID if available. +func GetRequestID(ctx context.Context) (uint64, bool) { + var ( + szID []string + szIDOK bool + ) + + // Prefer the incoming context, but look in both types. + if md, ok := metadata.FromIncomingContext(ctx); ok { + szID, szIDOK = md[RequestIDKey] + } else if md, ok := metadata.FromOutgoingContext(ctx); ok { + szID, szIDOK = md[RequestIDKey] + } + + if szIDOK && len(szID) == 1 { + if id, err := strconv.ParseUint(szID[0], 10, 64); err == nil { + return id, true + } + } + + return 0, false +} + +// WithEnviron returns a new Context with the provided environment variable +// string slice. +func WithEnviron(ctx context.Context, v []string) context.Context { + return context.WithValue(ctx, ctxOSEnviron, v) +} + +// WithLookupEnv returns a new Context with the provided function. +func WithLookupEnv(ctx context.Context, f lookupEnvFunc) context.Context { + return context.WithValue(ctx, ctxOSLookupEnvKey, f) +} + +// WithSetenv returns a new Context with the provided function. +func WithSetenv(ctx context.Context, f setenvFunc) context.Context { + return context.WithValue(ctx, ctxOSSetenvKey, f) +} + +// LookupEnv returns the value of the provided environment variable by: +// +// 1. Inspecting the context for a key "os.Environ" with a string +// slice value. If such a key and value exist then the string slice +// is searched for the specified key and if found its value is returned. +// +// 2. Inspecting the context for a key "os.LookupEnv" with a value of +// func(string) (string, bool). If such a key and value exist then the +// function is used to attempt to discover the key's value. If the +// key and value are found they are returned. +// +// 3. Returning the result of os.LookupEnv. +func LookupEnv(ctx context.Context, key string) (string, bool) { + if s, ok := ctx.Value(ctxOSEnviron).([]string); ok { + for _, v := range s { + p := strings.SplitN(v, "=", 2) + if len(p) > 0 && strings.EqualFold(p[0], key) { + if len(p) > 1 { + return p[1], true + } + return "", true + } + } + } + if f, ok := ctx.Value(ctxOSLookupEnvKey).(lookupEnvFunc); ok { + if v, ok := f(key); ok { + return v, true + } + } + return os.LookupEnv(key) +} + +// Getenv is an alias for LookupEnv and drops the boolean return value. +func Getenv(ctx context.Context, key string) string { + val, _ := LookupEnv(ctx, key) + return val +} + +// Setenv sets the value of the provided environment variable to the +// specified value by first inspecting the context for a key "os.Setenv" +// with a value of func(string, string) error. If the context does not +// contain such a function then os.Setenv is used instead. +func Setenv(ctx context.Context, key, val string) error { + if f, ok := ctx.Value(ctxOSSetenvKey).(setenvFunc); ok { + return f(key, val) + } + return os.Setenv(key, val) +} diff --git a/vendor/github.com/kubernetes-csi/csi-test/mock/gocsi/envvars.go b/vendor/github.com/kubernetes-csi/csi-test/mock/gocsi/envvars.go new file mode 100644 index 000000000..28f3c376c --- /dev/null +++ b/vendor/github.com/kubernetes-csi/csi-test/mock/gocsi/envvars.go @@ -0,0 +1,325 @@ +package gocsi + +import ( + "context" + "strconv" + "strings" + + log "github.com/sirupsen/logrus" + + csictx "github.com/kubernetes-csi/csi-test/mock/context" + "github.com/kubernetes-csi/csi-test/mock/utils" +) + +const ( + // EnvVarEndpoint is the name of the environment variable used to + // specify the CSI endpoint. + EnvVarEndpoint = "CSI_ENDPOINT" + + // EnvVarEndpointPerms is the name of the environment variable used + // to specify the file permissions for the CSI endpoint when it is + // a UNIX socket file. This setting has no effect if CSI_ENDPOINT + // specifies a TCP socket. The default value is 0755. + EnvVarEndpointPerms = "X_CSI_ENDPOINT_PERMS" + + // EnvVarEndpointUser is the name of the environment variable used + // to specify the UID or name of the user that owns the endpoint's + // UNIX socket file. This setting has no effect if CSI_ENDPOINT + // specifies a TCP socket. The default value is the user that starts + // the process. + EnvVarEndpointUser = "X_CSI_ENDPOINT_USER" + + // EnvVarEndpointGroup is the name of the environment variable used + // to specify the GID or name of the group that owns the endpoint's + // UNIX socket file. This setting has no effect if CSI_ENDPOINT + // specifies a TCP socket. The default value is the group that starts + // the process. + EnvVarEndpointGroup = "X_CSI_ENDPOINT_GROUP" + + // EnvVarDebug is the name of the environment variable used to + // determine whether or not debug mode is enabled. + // + // Setting this environment variable to a truthy value is the + // equivalent of X_CSI_LOG_LEVEL=DEBUG, X_CSI_REQ_LOGGING=true, + // and X_CSI_REP_LOGGING=true. + EnvVarDebug = "X_CSI_DEBUG" + + // EnvVarLogLevel is the name of the environment variable used to + // specify the log level. Valid values include PANIC, FATAL, ERROR, + // WARN, INFO, and DEBUG. + EnvVarLogLevel = "X_CSI_LOG_LEVEL" + + // EnvVarSupportedVersions is the name of the environment variable used + // to specify a list of comma-separated versions supported by the SP. If + // no value is specified then the SP does not perform a version check on + // the RPC. + EnvVarSupportedVersions = "X_CSI_SUPPORTED_VERSIONS" + + // EnvVarPluginInfo is the name of the environment variable used to + // specify the plug-in info in the format: + // + // NAME, VENDOR_VERSION[, MANIFEST...] + // + // The MANIFEST value may be a series of additional comma-separated + // key/value pairs. + // + // Please see the encoding/csv package (https://goo.gl/1j1xb9) for + // information on how to quote keys and/or values to include leading + // and trailing whitespace. + // + // Setting this environment variable will cause the program to + // bypass the SP's GetPluginInfo RPC and returns the specified + // information instead. + EnvVarPluginInfo = "X_CSI_PLUGIN_INFO" + + // EnvVarMode is the name of the environment variable used to specify + // the service mode of the storage plug-in. Valie values are: + // + // * + // * controller + // * node + // + // If unset or set to an empty value the storage plug-in activates + // both controller and node services. The identity service is always + // activated. + EnvVarMode = "X_CSI_MODE" + + // EnvVarReqLogging is the name of the environment variable + // used to determine whether or not to enable request logging. + // + // Setting this environment variable to a truthy value enables + // request logging to STDOUT. + EnvVarReqLogging = "X_CSI_REQ_LOGGING" + + // EnvVarRepLogging is the name of the environment variable + // used to determine whether or not to enable response logging. + // + // Setting this environment variable to a truthy value enables + // response logging to STDOUT. + EnvVarRepLogging = "X_CSI_REP_LOGGING" + + // EnvVarReqIDInjection is the name of the environment variable + // used to determine whether or not to enable request ID injection. + EnvVarReqIDInjection = "X_CSI_REQ_ID_INJECTION" + + // EnvVarSpecValidation is the name of the environment variable + // used to determine whether or not to enable validation of CSI + // request and response messages. Setting X_CSI_SPEC_VALIDATION=true + // is the equivalent to setting X_CSI_SPEC_REQ_VALIDATION=true and + // X_CSI_SPEC_REP_VALIDATION=true. + EnvVarSpecValidation = "X_CSI_SPEC_VALIDATION" + + // EnvVarSpecReqValidation is the name of the environment variable + // used to determine whether or not to enable validation of CSI request + // messages. + EnvVarSpecReqValidation = "X_CSI_SPEC_REQ_VALIDATION" + + // EnvVarSpecRepValidation is the name of the environment variable + // used to determine whether or not to enable validation of CSI response + // messages. Invalid responses are marshalled into a gRPC error with + // a code of "Internal." + EnvVarSpecRepValidation = "X_CSI_SPEC_REP_VALIDATION" + + // EnvVarRequireNodeID is the name of the environment variable used + // to determine whether or not the node ID value is required for + // requests that accept it and responses that return it such as + // ControllerPublishVolume and GetNodeId. + EnvVarRequireNodeID = "X_CSI_REQUIRE_NODE_ID" + + // EnvVarRequirePubVolInfo is the name of the environment variable used + // to determine whether or not publish volume info is required for + // requests that accept it and responses that return it such as + // NodePublishVolume and ControllerPublishVolume. + EnvVarRequirePubVolInfo = "X_CSI_REQUIRE_PUB_VOL_INFO" + + // EnvVarRequireVolAttribs is the name of the environment variable used + // to determine whether or not volume attributes are required for + // requests that accept them and responses that return them such as + // ControllerPublishVolume and CreateVolume. + EnvVarRequireVolAttribs = "X_CSI_REQUIRE_VOL_ATTRIBS" + + // EnvVarCreds is the name of the environment variable + // used to determine whether or not user credentials are required for + // all RPCs. This value may be overridden for specific RPCs. + EnvVarCreds = "X_CSI_REQUIRE_CREDS" + + // EnvVarCredsCreateVol is the name of the environment variable + // used to determine whether or not user credentials are required for + // the eponymous RPC. + EnvVarCredsCreateVol = "X_CSI_REQUIRE_CREDS_CREATE_VOL" + + // EnvVarCredsDeleteVol is the name of the environment variable + // used to determine whether or not user credentials are required for + // the eponymous RPC. + EnvVarCredsDeleteVol = "X_CSI_REQUIRE_CREDS_DELETE_VOL" + + // EnvVarCredsCtrlrPubVol is the name of the environment + // variable used to determine whether or not user credentials are required + // for the eponymous RPC. + EnvVarCredsCtrlrPubVol = "X_CSI_REQUIRE_CREDS_CTRLR_PUB_VOL" + + // EnvVarCredsCtrlrUnpubVol is the name of the + // environment variable used to determine whether or not user credentials + // are required for the eponymous RPC. + EnvVarCredsCtrlrUnpubVol = "X_CSI_REQUIRE_CREDS_CTRLR_UNPUB_VOL" + + // EnvVarCredsNodePubVol is the name of the environment + // variable used to determine whether or not user credentials are required + // for the eponymous RPC. + EnvVarCredsNodePubVol = "X_CSI_REQUIRE_CREDS_NODE_PUB_VOL" + + // EnvVarCredsNodeUnpubVol is the name of the environment + // variable used to determine whether or not user credentials are required + // for the eponymous RPC. + EnvVarCredsNodeUnpubVol = "X_CSI_REQUIRE_CREDS_NODE_UNPUB_VOL" + + // EnvVarSerialVolAccess is the name of the environment variable + // used to determine whether or not to enable serial volume access. + EnvVarSerialVolAccess = "X_CSI_SERIAL_VOL_ACCESS" + + // EnvVarSerialVolAccessTimeout is the name of the environment variable + // used to specify the timeout for obtaining a volume lock. + EnvVarSerialVolAccessTimeout = "X_CSI_SERIAL_VOL_ACCESS_TIMEOUT" + + // EnvVarSerialVolAccessEtcdDomain is the name of the environment + // variable that defines the lock provider's concurrency domain. + EnvVarSerialVolAccessEtcdDomain = "X_CSI_SERIAL_VOL_ACCESS_ETCD_DOMAIN" + + // EnvVarSerialVolAccessEtcdTTL is the name of the environment + // variable that defines the length of time etcd will wait before + // releasing ownership of a distributed lock if the lock's session + // has not been renewed. + EnvVarSerialVolAccessEtcdTTL = "X_CSI_SERIAL_VOL_ACCESS_ETCD_TTL" + + // EnvVarSerialVolAccessEtcdEndpoints is the name of the environment + // variable that defines the lock provider's etcd endoints. + EnvVarSerialVolAccessEtcdEndpoints = "X_CSI_SERIAL_VOL_ACCESS_ETCD_ENDPOINTS" + + // EnvVarSerialVolAccessEtcdAutoSyncInterval is the name of the environment + // variable that defines the interval to update endpoints with its latest + // members. 0 disables auto-sync. By default auto-sync is disabled. + EnvVarSerialVolAccessEtcdAutoSyncInterval = "X_CSI_SERIAL_VOL_ACCESS_ETCD_AUTO_SYNC_INTERVAL" + + // EnvVarSerialVolAccessEtcdDialTimeout is the name of the environment + // variable that defines the timeout for failing to establish a connection. + EnvVarSerialVolAccessEtcdDialTimeout = "X_CSI_SERIAL_VOL_ACCESS_ETCD_DIAL_TIMEOUT" + + // EnvVarSerialVolAccessEtcdDialKeepAliveTime is the name of the environment + // variable that defines the time after which client pings the server to see + // if transport is alive. + EnvVarSerialVolAccessEtcdDialKeepAliveTime = "X_CSI_SERIAL_VOL_ACCESS_ETCD_DIAL_KEEP_ALIVE_TIME" + + // EnvVarSerialVolAccessEtcdDialKeepAliveTimeout is the name of the + // environment variable that defines the time that the client waits for a + // response for the keep-alive probe. If the response is not received in + // this time, the connection is closed. + EnvVarSerialVolAccessEtcdDialKeepAliveTimeout = "X_CSI_SERIAL_VOL_ACCESS_ETCD_DIAL_KEEP_ALIVE_TIMEOUT" + + // EnvVarSerialVolAccessEtcdMaxCallSendMsgSz is the name of the environment + // variable that defines the client-side request send limit in bytes. + // If 0, it defaults to 2.0 MiB (2 * 1024 * 1024). + // Make sure that "MaxCallSendMsgSize" < server-side default send/recv + // limit. ("--max-request-bytes" flag to etcd or + // "embed.Config.MaxRequestBytes"). + EnvVarSerialVolAccessEtcdMaxCallSendMsgSz = "X_CSI_SERIAL_VOL_ACCESS_ETCD_MAX_CALL_SEND_MSG_SZ" + + // EnvVarSerialVolAccessEtcdMaxCallRecvMsgSz is the name of the environment + // variable that defines the client-side response receive limit. + // If 0, it defaults to "math.MaxInt32", because range response can + // easily exceed request send limits. + // Make sure that "MaxCallRecvMsgSize" >= server-side default send/recv + // limit. ("--max-request-bytes" flag to etcd or + // "embed.Config.MaxRequestBytes"). + EnvVarSerialVolAccessEtcdMaxCallRecvMsgSz = "X_CSI_SERIAL_VOL_ACCESS_ETCD_MAX_CALL_RECV_MSG_SZ" + + // EnvVarSerialVolAccessEtcdUsername is the name of the environment + // variable that defines the user name used for authentication. + EnvVarSerialVolAccessEtcdUsername = "X_CSI_SERIAL_VOL_ACCESS_ETCD_USERNAME" + + // EnvVarSerialVolAccessEtcdPassword is the name of the environment + // variable that defines the password used for authentication. + EnvVarSerialVolAccessEtcdPassword = "X_CSI_SERIAL_VOL_ACCESS_ETCD_PASSWORD" + + // EnvVarSerialVolAccessEtcdRejectOldCluster is the name of the environment + // variable that defines when set will refuse to create a client against + // an outdated cluster. + EnvVarSerialVolAccessEtcdRejectOldCluster = "X_CSI_SERIAL_VOL_ACCESS_ETCD_REJECT_OLD_CLUSTER" + + // EnvVarSerialVolAccessEtcdTLS is the name of the environment + // variable that defines whether or not the client should attempt + // to use TLS when connecting to the server. + EnvVarSerialVolAccessEtcdTLS = "X_CSI_SERIAL_VOL_ACCESS_ETCD_TLS" + + // EnvVarSerialVolAccessEtcdTLSInsecure is the name of the environment + // variable that defines whether or not the TLS connection should + // verify certificates. + EnvVarSerialVolAccessEtcdTLSInsecure = "X_CSI_SERIAL_VOL_ACCESS_ETCD_TLS_INSECURE" +) + +func (sp *StoragePlugin) initEnvVars(ctx context.Context) { + + // Copy the environment variables from the public EnvVar + // string slice to the private envVars map for quick lookup. + sp.envVars = map[string]string{} + for _, v := range sp.EnvVars { + // Environment variables must adhere to one of the following + // formats: + // + // - ENV_VAR_KEY= + // - ENV_VAR_KEY=ENV_VAR_VAL + pair := strings.SplitN(v, "=", 2) + if len(pair) < 1 || len(pair) > 2 { + continue + } + + // Ensure the environment variable is stored in all upper-case + // to make subsequent map-lookups deterministic. + key := strings.ToUpper(pair[0]) + + // Check to see if the value for the key is available from the + // context's os.Environ or os.LookupEnv functions. If neither + // return a value then use the provided default value. + var val string + if v, ok := csictx.LookupEnv(ctx, key); ok { + val = v + } else if len(pair) > 1 { + val = pair[1] + } + sp.envVars[key] = val + } + + // Check for the debug value. + if v, ok := csictx.LookupEnv(ctx, EnvVarDebug); ok { + if ok, _ := strconv.ParseBool(v); ok { + csictx.Setenv(ctx, EnvVarReqLogging, "true") + csictx.Setenv(ctx, EnvVarRepLogging, "true") + } + } + + return +} + +func (sp *StoragePlugin) initPluginInfo(ctx context.Context) { + szInfo, ok := csictx.LookupEnv(ctx, EnvVarPluginInfo) + if !ok { + return + } + info := strings.SplitN(szInfo, ",", 3) + fields := map[string]interface{}{} + if len(info) > 0 { + sp.pluginInfo.Name = strings.TrimSpace(info[0]) + fields["name"] = sp.pluginInfo.Name + } + if len(info) > 1 { + sp.pluginInfo.VendorVersion = strings.TrimSpace(info[1]) + fields["vendorVersion"] = sp.pluginInfo.VendorVersion + } + if len(info) > 2 { + sp.pluginInfo.Manifest = utils.ParseMap(strings.TrimSpace(info[2])) + fields["manifest"] = sp.pluginInfo.Manifest + } + + if len(fields) > 0 { + log.WithFields(fields).Debug("init plug-in info") + } +} diff --git a/vendor/github.com/kubernetes-csi/csi-test/mock/gocsi/gocsi.go b/vendor/github.com/kubernetes-csi/csi-test/mock/gocsi/gocsi.go new file mode 100644 index 000000000..4b70ecc46 --- /dev/null +++ b/vendor/github.com/kubernetes-csi/csi-test/mock/gocsi/gocsi.go @@ -0,0 +1,545 @@ +//go:generate make + +// Package gocsi provides a Container Storage Interface (CSI) library, +// client, and other helpful utilities. +package gocsi + +import ( + "bufio" + "context" + "errors" + "flag" + "fmt" + "io" + "net" + "os" + "os/signal" + "os/user" + "regexp" + "strconv" + "strings" + "sync" + "syscall" + "text/template" + + log "github.com/sirupsen/logrus" + "google.golang.org/grpc" + + "github.com/container-storage-interface/spec/lib/go/csi/v0" + + csictx "github.com/kubernetes-csi/csi-test/mock/context" + "github.com/kubernetes-csi/csi-test/mock/utils" +) + +// Run launches a CSI storage plug-in. +func Run( + ctx context.Context, + appName, appDescription, appUsage string, + sp StoragePluginProvider) { + + // Check for the debug value. + if v, ok := csictx.LookupEnv(ctx, EnvVarDebug); ok { + if ok, _ := strconv.ParseBool(v); ok { + csictx.Setenv(ctx, EnvVarLogLevel, "debug") + csictx.Setenv(ctx, EnvVarReqLogging, "true") + csictx.Setenv(ctx, EnvVarRepLogging, "true") + } + } + + // Adjust the log level. + lvl := log.InfoLevel + if v, ok := csictx.LookupEnv(ctx, EnvVarLogLevel); ok { + var err error + if lvl, err = log.ParseLevel(v); err != nil { + lvl = log.InfoLevel + } + } + log.SetLevel(lvl) + + printUsage := func() { + // app is the information passed to the printUsage function + app := struct { + Name string + Description string + Usage string + BinPath string + }{ + appName, + appDescription, + appUsage, + os.Args[0], + } + + t, err := template.New("t").Parse(usage) + if err != nil { + log.WithError(err).Fatalln("failed to parse usage template") + } + if err := t.Execute(os.Stderr, app); err != nil { + log.WithError(err).Fatalln("failed emitting usage") + } + return + } + + // Check for a help flag. + fs := flag.NewFlagSet("csp", flag.ExitOnError) + fs.Usage = printUsage + var help bool + fs.BoolVar(&help, "?", false, "") + err := fs.Parse(os.Args) + if err == flag.ErrHelp || help { + printUsage() + os.Exit(1) + } + + // If no endpoint is set then print the usage. + if os.Getenv(EnvVarEndpoint) == "" { + printUsage() + os.Exit(1) + } + + l, err := utils.GetCSIEndpointListener() + if err != nil { + log.WithError(err).Fatalln("failed to listen") + } + + // Define a lambda that can be used in the exit handler + // to remove a potential UNIX sock file. + var rmSockFileOnce sync.Once + rmSockFile := func() { + rmSockFileOnce.Do(func() { + if l == nil || l.Addr() == nil { + return + } + if l.Addr().Network() == netUnix { + sockFile := l.Addr().String() + os.RemoveAll(sockFile) + log.WithField("path", sockFile).Info("removed sock file") + } + }) + } + + trapSignals(func() { + sp.GracefulStop(ctx) + rmSockFile() + log.Info("server stopped gracefully") + }, func() { + sp.Stop(ctx) + rmSockFile() + log.Info("server aborted") + }) + + if err := sp.Serve(ctx, l); err != nil { + rmSockFile() + log.WithError(err).Fatal("grpc failed") + } +} + +// StoragePluginProvider is able to serve a gRPC endpoint that provides +// the CSI services: Controller, Identity, Node. +type StoragePluginProvider interface { + + // Serve accepts incoming connections on the listener lis, creating + // a new ServerTransport and service goroutine for each. The service + // goroutine read gRPC requests and then call the registered handlers + // to reply to them. Serve returns when lis.Accept fails with fatal + // errors. lis will be closed when this method returns. + // Serve always returns non-nil error. + Serve(ctx context.Context, lis net.Listener) error + + // Stop stops the gRPC server. It immediately closes all open + // connections and listeners. + // It cancels all active RPCs on the server side and the corresponding + // pending RPCs on the client side will get notified by connection + // errors. + Stop(ctx context.Context) + + // GracefulStop stops the gRPC server gracefully. It stops the server + // from accepting new connections and RPCs and blocks until all the + // pending RPCs are finished. + GracefulStop(ctx context.Context) +} + +// StoragePlugin is the collection of services and data used to server +// a new gRPC endpoint that acts as a CSI storage plug-in (SP). +type StoragePlugin struct { + // Controller is the eponymous CSI service. + Controller csi.ControllerServer + + // Identity is the eponymous CSI service. + Identity csi.IdentityServer + + // Node is the eponymous CSI service. + Node csi.NodeServer + + // ServerOpts is a list of gRPC server options used when serving + // the SP. This list should not include a gRPC interceptor option + // as one is created automatically based on the interceptor configuration + // or provided list of interceptors. + ServerOpts []grpc.ServerOption + + // Interceptors is a list of gRPC server interceptors to use when + // serving the SP. This list should not include the interceptors + // defined in the GoCSI package as those are configured by default + // based on runtime configuration settings. + Interceptors []grpc.UnaryServerInterceptor + + // BeforeServe is an optional callback that is invoked after the + // StoragePlugin has been initialized, just prior to the creation + // of the gRPC server. This callback may be used to perform custom + // initialization logic, modify the interceptors and server options, + // or prevent the server from starting by returning a non-nil error. + BeforeServe func(context.Context, *StoragePlugin, net.Listener) error + + // EnvVars is a list of default environment variables and values. + EnvVars []string + + serveOnce sync.Once + stopOnce sync.Once + server *grpc.Server + + envVars map[string]string + pluginInfo csi.GetPluginInfoResponse +} + +// Serve accepts incoming connections on the listener lis, creating +// a new ServerTransport and service goroutine for each. The service +// goroutine read gRPC requests and then call the registered handlers +// to reply to them. Serve returns when lis.Accept fails with fatal +// errors. lis will be closed when this method returns. +// Serve always returns non-nil error. +func (sp *StoragePlugin) Serve(ctx context.Context, lis net.Listener) error { + var err error + sp.serveOnce.Do(func() { + // Please note that the order of the below init functions is + // important and should not be altered unless by someone aware + // of how they work. + + // Adding this function to the context allows `csictx.LookupEnv` + // to search this SP's default env vars for a value. + ctx = csictx.WithLookupEnv(ctx, sp.lookupEnv) + + // Adding this function to the context allows `csictx.Setenv` + // to set environment variables in this SP's env var store. + ctx = csictx.WithSetenv(ctx, sp.setenv) + + // Initialize the storage plug-in's environment variables map. + sp.initEnvVars(ctx) + + // Adjust the endpoint's file permissions. + if err = sp.initEndpointPerms(ctx, lis); err != nil { + return + } + + // Adjust the endpoint's file ownership. + if err = sp.initEndpointOwner(ctx, lis); err != nil { + return + } + + // Initialize the storage plug-in's info. + sp.initPluginInfo(ctx) + + // Initialize the interceptors. + // sp.initInterceptors(ctx) + + // Invoke the SP's BeforeServe function to give the SP a chance + // to perform any local initialization routines. + if f := sp.BeforeServe; f != nil { + if err = f(ctx, sp, lis); err != nil { + return + } + } + + // Add the interceptors to the server if any are configured. + if i := sp.Interceptors; len(i) > 0 { + sp.ServerOpts = append(sp.ServerOpts, + grpc.UnaryInterceptor(utils.ChainUnaryServer(i...))) + } + + // Initialize the gRPC server. + sp.server = grpc.NewServer(sp.ServerOpts...) + + // Register the CSI services. + // Always require the identity service. + if sp.Identity == nil { + err = errors.New("identity service is required") + return + } + // Either a Controller or Node service should be supplied. + if sp.Controller == nil && sp.Node == nil { + err = errors.New( + "either a controller or node service is required") + return + } + + // Always register the identity service. + csi.RegisterIdentityServer(sp.server, sp.Identity) + log.Info("identity service registered") + + // Determine which of the controller/node services to register + mode := csictx.Getenv(ctx, EnvVarMode) + if strings.EqualFold(mode, "controller") { + mode = "controller" + } else if strings.EqualFold(mode, "node") { + mode = "node" + } else { + mode = "" + } + + if mode == "" || mode == "controller" { + if sp.Controller == nil { + err = errors.New("controller service is required") + return + } + csi.RegisterControllerServer(sp.server, sp.Controller) + log.Info("controller service registered") + } + if mode == "" || mode == "node" { + if sp.Node == nil { + err = errors.New("node service is required") + return + } + csi.RegisterNodeServer(sp.server, sp.Node) + log.Info("node service registered") + } + + endpoint := fmt.Sprintf( + "%s://%s", + lis.Addr().Network(), lis.Addr().String()) + log.WithField("endpoint", endpoint).Info("serving") + + // Start the gRPC server. + err = sp.server.Serve(lis) + return + }) + return err +} + +// Stop stops the gRPC server. It immediately closes all open +// connections and listeners. +// It cancels all active RPCs on the server side and the corresponding +// pending RPCs on the client side will get notified by connection +// errors. +func (sp *StoragePlugin) Stop(ctx context.Context) { + sp.stopOnce.Do(func() { + sp.server.Stop() + log.Info("stopped") + }) +} + +// GracefulStop stops the gRPC server gracefully. It stops the server +// from accepting new connections and RPCs and blocks until all the +// pending RPCs are finished. +func (sp *StoragePlugin) GracefulStop(ctx context.Context) { + sp.stopOnce.Do(func() { + sp.server.GracefulStop() + log.Info("gracefully stopped") + }) +} + +const netUnix = "unix" + +func (sp *StoragePlugin) initEndpointPerms( + ctx context.Context, lis net.Listener) error { + + if lis.Addr().Network() != netUnix { + return nil + } + + v, ok := csictx.LookupEnv(ctx, EnvVarEndpointPerms) + if !ok || v == "0755" { + return nil + } + u, err := strconv.ParseUint(v, 8, 32) + if err != nil { + return err + } + + p := lis.Addr().String() + m := os.FileMode(u) + + log.WithFields(map[string]interface{}{ + "path": p, + "mode": m, + }).Info("chmod csi endpoint") + + if err := os.Chmod(p, m); err != nil { + return err + } + + return nil +} + +func (sp *StoragePlugin) initEndpointOwner( + ctx context.Context, lis net.Listener) error { + + if lis.Addr().Network() != netUnix { + return nil + } + + var ( + usrName string + grpName string + + uid = os.Getuid() + gid = os.Getgid() + puid = uid + pgid = gid + ) + + if v, ok := csictx.LookupEnv(ctx, EnvVarEndpointUser); ok { + m, err := regexp.MatchString(`^\d+$`, v) + if err != nil { + return err + } + usrName = v + szUID := v + if m { + u, err := user.LookupId(v) + if err != nil { + return err + } + usrName = u.Username + } else { + u, err := user.Lookup(v) + if err != nil { + return err + } + szUID = u.Uid + } + iuid, err := strconv.Atoi(szUID) + if err != nil { + return err + } + uid = iuid + } + + if v, ok := csictx.LookupEnv(ctx, EnvVarEndpointGroup); ok { + m, err := regexp.MatchString(`^\d+$`, v) + if err != nil { + return err + } + grpName = v + szGID := v + if m { + u, err := user.LookupGroupId(v) + if err != nil { + return err + } + grpName = u.Name + } else { + u, err := user.LookupGroup(v) + if err != nil { + return err + } + szGID = u.Gid + } + igid, err := strconv.Atoi(szGID) + if err != nil { + return err + } + gid = igid + } + + if uid != puid || gid != pgid { + f := lis.Addr().String() + log.WithFields(map[string]interface{}{ + "uid": usrName, + "gid": grpName, + "path": f, + }).Info("chown csi endpoint") + if err := os.Chown(f, uid, gid); err != nil { + return err + } + } + + return nil +} + +func (sp *StoragePlugin) lookupEnv(key string) (string, bool) { + val, ok := sp.envVars[key] + return val, ok +} + +func (sp *StoragePlugin) setenv(key, val string) error { + sp.envVars[key] = val + return nil +} + +func (sp *StoragePlugin) getEnvBool(ctx context.Context, key string) bool { + v, ok := csictx.LookupEnv(ctx, key) + if !ok { + return false + } + if b, err := strconv.ParseBool(v); err == nil { + return b + } + return false +} + +func trapSignals(onExit, onAbort func()) { + sigc := make(chan os.Signal, 1) + sigs := []os.Signal{ + syscall.SIGTERM, + syscall.SIGHUP, + syscall.SIGINT, + syscall.SIGQUIT, + } + signal.Notify(sigc, sigs...) + go func() { + for s := range sigc { + ok, graceful := isExitSignal(s) + if !ok { + continue + } + if !graceful { + log.WithField("signal", s).Error("received signal; aborting") + if onAbort != nil { + onAbort() + } + os.Exit(1) + } + log.WithField("signal", s).Info("received signal; shutting down") + if onExit != nil { + onExit() + } + os.Exit(0) + } + }() +} + +// isExitSignal returns a flag indicating whether a signal SIGHUP, +// SIGINT, SIGTERM, or SIGQUIT. The second return value is whether it is a +// graceful exit. This flag is true for SIGTERM, SIGHUP, SIGINT, and SIGQUIT. +func isExitSignal(s os.Signal) (bool, bool) { + switch s { + case syscall.SIGTERM, + syscall.SIGHUP, + syscall.SIGINT, + syscall.SIGQUIT: + return true, true + default: + return false, false + } +} + +type logger struct { + f func(msg string, args ...interface{}) + w io.Writer +} + +func newLogger(f func(msg string, args ...interface{})) *logger { + l := &logger{f: f} + r, w := io.Pipe() + l.w = w + go func() { + scan := bufio.NewScanner(r) + for scan.Scan() { + f(scan.Text()) + } + }() + return l +} + +func (l *logger) Write(data []byte) (int, error) { + return l.w.Write(data) +} diff --git a/vendor/github.com/kubernetes-csi/csi-test/mock/gocsi/usage.go b/vendor/github.com/kubernetes-csi/csi-test/mock/gocsi/usage.go new file mode 100644 index 000000000..29b05fca8 --- /dev/null +++ b/vendor/github.com/kubernetes-csi/csi-test/mock/gocsi/usage.go @@ -0,0 +1,269 @@ +package gocsi + +const usage = `NAME + {{.Name}} -- {{.Description}} + +SYNOPSIS + {{.BinPath}} +{{if .Usage}} +STORAGE OPTIONS +{{.Usage}}{{end}} +GLOBAL OPTIONS + CSI_ENDPOINT + The CSI endpoint may also be specified by the environment variable + CSI_ENDPOINT. The endpoint should adhere to Go's network address + pattern: + + * tcp://host:port + * unix:///path/to/file.sock. + + If the network type is omitted then the value is assumed to be an + absolute or relative filesystem path to a UNIX socket file + + X_CSI_MODE + Specifies the service mode of the storage plug-in. Valid values are: + + * + * controller + * node + + If unset or set to an empty value the storage plug-in activates + both controller and node services. The identity service is always + activated. + + X_CSI_ENDPOINT_PERMS + When CSI_ENDPOINT is set to a UNIX socket file this environment + variable may be used to specify the socket's file permissions + as an octal number, ex. 0644. Please note this value has no + effect if CSI_ENDPOINT specifies a TCP socket. + + The default value is 0755. + + X_CSI_ENDPOINT_USER + When CSI_ENDPOINT is set to a UNIX socket file this environment + variable may be used to specify the UID or user name of the + user that owns the file. Please note this value has no + effect if CSI_ENDPOINT specifies a TCP socket. + + If no value is specified then the user owner of the file is the + same as the user that starts the process. + + X_CSI_ENDPOINT_GROUP + When CSI_ENDPOINT is set to a UNIX socket file this environment + variable may be used to specify the GID or group name of the + group that owns the file. Please note this value has no + effect if CSI_ENDPOINT specifies a TCP socket. + + If no value is specified then the group owner of the file is the + same as the group that starts the process. + + X_CSI_DEBUG + Enabling this option is the same as: + X_CSI_LOG_LEVEL=debug + X_CSI_REQ_LOGGING=true + X_CSI_REP_LOGGING=true + + X_CSI_LOG_LEVEL + The log level. Valid values include: + * PANIC + * FATAL + * ERROR + * WARN + * INFO + * DEBUG + + The default value is WARN. + + X_CSI_SUPPORTED_VERSIONS + A list of comma-separated versions strings: MAJOR.MINOR.PATCH. + Setting this environment variable will cause the program to + bypass the SP's GetSupportedVersions RPC and return the list of + specified versions instead. + + X_CSI_PLUGIN_INFO + The plug-in information is specified via the following + comma-separated format: + + NAME, VENDOR_VERSION[, MANIFEST...] + + The MANIFEST value may be a series of additional + comma-separated key/value pairs. + + Please see the encoding/csv package (https://goo.gl/1j1xb9) for + information on how to quote keys and/or values to include + leading and trailing whitespace. + + Setting this environment variable will cause the program to + bypass the SP's GetPluginInfo RPC and returns the specified + information instead. + + X_CSI_REQ_LOGGING + A flag that enables logging of incoming requests to STDOUT. + + Enabling this option sets X_CSI_REQ_ID_INJECTION=true. + + X_CSI_REP_LOGGING + A flag that enables logging of outgoing responses to STDOUT. + + Enabling this option sets X_CSI_REQ_ID_INJECTION=true. + + X_CSI_REQ_ID_INJECTION + A flag that enables request ID injection. The ID is parsed from + the incoming request's metadata with a key of "csi.requestid". + If no value for that key is found then a new request ID is + generated using an atomic sequence counter. + + X_CSI_SPEC_VALIDATION + Setting X_CSI_SPEC_VALIDATION=true is the same as: + X_CSI_SPEC_REQ_VALIDATION=true + X_CSI_SPEC_REP_VALIDATION=true + + X_CSI_SPEC_REQ_VALIDATION + A flag that enables the validation of CSI request messages. + + X_CSI_SPEC_REP_VALIDATION + A flag that enables the validation of CSI response messages. + Invalid responses are marshalled into a gRPC error with a code + of "Internal." + + X_CSI_REQUIRE_NODE_ID + A flag that enables treating the following fields as required: + * ControllerPublishVolumeRequest.NodeId + * NodeGetIdResponse.NodeId + + Enabling this option sets X_CSI_SPEC_REQ_VALIDATION=true. + + X_CSI_REQUIRE_PUB_VOL_INFO + A flag that enables treating the following fields as required: + * ControllerPublishVolumeResponse.PublishVolumeInfo + * NodePublishVolumeRequest.PublishVolumeInfo + + Enabling this option sets X_CSI_SPEC_REQ_VALIDATION=true. + + X_CSI_REQUIRE_VOL_ATTRIBS + A flag that enables treating the following fields as required: + * ControllerPublishVolumeRequest.VolumeAttributes + * ValidateVolumeCapabilitiesRequest.VolumeAttributes + * NodePublishVolumeRequest.VolumeAttributes + + Enabling this option sets X_CSI_SPEC_REQ_VALIDATION=true. + + X_CSI_REQUIRE_CREDS + Setting X_CSI_REQUIRE_CREDS=true is the same as: + X_CSI_REQUIRE_CREDS_CREATE_VOL=true + X_CSI_REQUIRE_CREDS_DELETE_VOL=true + X_CSI_REQUIRE_CREDS_CTRLR_PUB_VOL=true + X_CSI_REQUIRE_CREDS_CTRLR_UNPUB_VOL=true + X_CSI_REQUIRE_CREDS_NODE_PUB_VOL=true + X_CSI_REQUIRE_CREDS_NODE_UNPUB_VOL=true + + Enabling this option sets X_CSI_SPEC_REQ_VALIDATION=true. + + X_CSI_REQUIRE_CREDS_CREATE_VOL + A flag that enables treating the following fields as required: + * CreateVolumeRequest.UserCredentials + + Enabling this option sets X_CSI_SPEC_REQ_VALIDATION=true. + + X_CSI_REQUIRE_CREDS_DELETE_VOL + A flag that enables treating the following fields as required: + * DeleteVolumeRequest.UserCredentials + + Enabling this option sets X_CSI_SPEC_REQ_VALIDATION=true. + + X_CSI_REQUIRE_CREDS_CTRLR_PUB_VOL + A flag that enables treating the following fields as required: + * ControllerPublishVolumeRequest.UserCredentials + + Enabling this option sets X_CSI_SPEC_REQ_VALIDATION=true. + + X_CSI_REQUIRE_CREDS_CTRLR_UNPUB_VOL + A flag that enables treating the following fields as required: + * ControllerUnpublishVolumeRequest.UserCredentials + + Enabling this option sets X_CSI_SPEC_REQ_VALIDATION=true. + + X_CSI_REQUIRE_CREDS_NODE_PUB_VOL + A flag that enables treating the following fields as required: + * NodePublishVolumeRequest.UserCredentials + + Enabling this option sets X_CSI_SPEC_REQ_VALIDATION=true. + + X_CSI_REQUIRE_CREDS_NODE_UNPUB_VOL + A flag that enables treating the following fields as required: + * NodeUnpublishVolumeRequest.UserCredentials + + Enabling this option sets X_CSI_SPEC_REQ_VALIDATION=true. + + X_CSI_SERIAL_VOL_ACCESS + A flag that enables the serial volume access middleware. + + X_CSI_SERIAL_VOL_ACCESS_TIMEOUT + A time.Duration string that determines how long the serial volume + access middleware waits to obtain a lock for the request's volume before + returning a the gRPC error code FailedPrecondition (5) to indicate + an operation is already pending for the specified volume. + + X_CSI_SERIAL_VOL_ACCESS_ETCD_DOMAIN + The name of the environment variable that defines the etcd lock + provider's concurrency domain. + + X_CSI_SERIAL_VOL_ACCESS_ETCD_TTL + The length of time etcd will wait before releasing ownership of a + distributed lock if the lock's session has not been renewed. + + X_CSI_SERIAL_VOL_ACCESS_ETCD_ENDPOINTS + A comma-separated list of etcd endpoints. If specified then the + SP's serial volume access middleware will leverage etcd to enable + distributed locking. + + X_CSI_SERIAL_VOL_ACCESS_ETCD_AUTO_SYNC_INTERVAL + A time.Duration string that specifies the interval to update + endpoints with its latest members. A value of 0 disables + auto-sync. By default auto-sync is disabled. + + X_CSI_SERIAL_VOL_ACCESS_ETCD_DIAL_TIMEOUT + A time.Duration string that specifies the timeout for failing to + establish a connection. + + X_CSI_SERIAL_VOL_ACCESS_ETCD_DIAL_KEEP_ALIVE_TIME + A time.Duration string that defines the time after which the client + pings the server to see if the transport is alive. + + X_CSI_SERIAL_VOL_ACCESS_ETCD_DIAL_KEEP_ALIVE_TIMEOUT + A time.Duration string that defines the time that the client waits for + a response for the keep-alive probe. If the response is not received + in this time, the connection is closed. + + X_CSI_SERIAL_VOL_ACCESS_ETCD_MAX_CALL_SEND_MSG_SZ + Defines the client-side request send limit in bytes. If 0, it defaults + to 2.0 MiB (2 * 1024 * 1024). Make sure that "MaxCallSendMsgSize" < + server-side default send/recv limit. ("--max-request-bytes" flag to + etcd or "embed.Config.MaxRequestBytes"). + + X_CSI_SERIAL_VOL_ACCESS_ETCD_MAX_CALL_RECV_MSG_SZ + Defines the client-side response receive limit. If 0, it defaults to + "math.MaxInt32", because range response can easily exceed request send + limits. Make sure that "MaxCallRecvMsgSize" >= server-side default + send/recv limit. ("--max-request-bytes" flag to etcd or + "embed.Config.MaxRequestBytes"). + + X_CSI_SERIAL_VOL_ACCESS_ETCD_USERNAME + The user name used for authentication. + + X_CSI_SERIAL_VOL_ACCESS_ETCD_PASSWORD + The password used for authentication. + + X_CSI_SERIAL_VOL_ACCESS_ETCD_REJECT_OLD_CLUSTER + A flag that indicates refusal to create a client against an outdated + cluster. + + X_CSI_SERIAL_VOL_ACCESS_ETCD_TLS + A flag that indicates the client should attempt a TLS connection. + + X_CSI_SERIAL_VOL_ACCESS_ETCD_TLS_INSECURE + A flag that indicates the TLS connection should not verify peer + certificates. + +The flags -?,-h,-help may be used to print this screen. +` diff --git a/vendor/github.com/kubernetes-csi/csi-test/mock/main.go b/vendor/github.com/kubernetes-csi/csi-test/mock/main.go new file mode 100644 index 000000000..17dce66dc --- /dev/null +++ b/vendor/github.com/kubernetes-csi/csi-test/mock/main.go @@ -0,0 +1,19 @@ +package main + +import ( + "context" + + "github.com/kubernetes-csi/csi-test/mock/gocsi" + "github.com/kubernetes-csi/csi-test/mock/provider" + "github.com/kubernetes-csi/csi-test/mock/service" +) + +// main is ignored when this package is built as a go plug-in +func main() { + gocsi.Run( + context.Background(), + service.Name, + "A Mock Container Storage Interface (CSI) Storage Plug-in (SP)", + "", + provider.New()) +} diff --git a/vendor/github.com/kubernetes-csi/csi-test/mock/plugin.go b/vendor/github.com/kubernetes-csi/csi-test/mock/plugin.go new file mode 100644 index 000000000..c3d0aac31 --- /dev/null +++ b/vendor/github.com/kubernetes-csi/csi-test/mock/plugin.go @@ -0,0 +1,23 @@ +// +build linux,plugin + +package main + +import "C" + +import ( + "github.com/kubernetes-csi/csi-test/mock/provider" + "github.com/kubernetes-csi/csi-test/mock/service" +) + +//////////////////////////////////////////////////////////////////////////////// +// Go Plug-in // +//////////////////////////////////////////////////////////////////////////////// + +// SupportedVersions is a space-delimited list of supported CSI versions. +var SupportedVersions = service.SupportedVersions + +// ServiceProviders is an exported symbol that provides a host program +// with a map of the service provider names and constructors. +var ServiceProviders = map[string]func() interface{}{ + service.Name: func() interface{} { return provider.New() }, +} diff --git a/vendor/github.com/kubernetes-csi/csi-test/mock/provider/provider.go b/vendor/github.com/kubernetes-csi/csi-test/mock/provider/provider.go new file mode 100644 index 000000000..6b36cb4fd --- /dev/null +++ b/vendor/github.com/kubernetes-csi/csi-test/mock/provider/provider.go @@ -0,0 +1,53 @@ +package provider + +import ( + "context" + "net" + + log "github.com/sirupsen/logrus" + + "github.com/kubernetes-csi/csi-test/mock/gocsi" + "github.com/kubernetes-csi/csi-test/mock/service" +) + +// New returns a new Mock Storage Plug-in Provider. +func New() gocsi.StoragePluginProvider { + svc := service.New() + return &gocsi.StoragePlugin{ + Controller: svc, + Identity: svc, + Node: svc, + + // BeforeServe allows the SP to participate in the startup + // sequence. This function is invoked directly before the + // gRPC server is created, giving the callback the ability to + // modify the SP's interceptors, server options, or prevent the + // server from starting by returning a non-nil error. + BeforeServe: func( + ctx context.Context, + sp *gocsi.StoragePlugin, + lis net.Listener) error { + + log.WithField("service", service.Name).Debug("BeforeServe") + return nil + }, + + EnvVars: []string{ + // Enable serial volume access. + gocsi.EnvVarSerialVolAccess + "=true", + + // Enable request and response validation. + gocsi.EnvVarSpecValidation + "=true", + + // Treat the following fields as required: + // * ControllerPublishVolumeRequest.NodeId + // * NodeGetNodeIdResponse.NodeId + gocsi.EnvVarRequireNodeID + "=true", + + // Treat the following fields as required: + // * ControllerPublishVolumeResponse.PublishInfo + // * NodePublishVolumeRequest.PublishInfo + gocsi.EnvVarRequirePubVolInfo + "=true", + }, + } +} diff --git a/vendor/github.com/kubernetes-csi/csi-test/mock/service/controller.go b/vendor/github.com/kubernetes-csi/csi-test/mock/service/controller.go new file mode 100644 index 000000000..2c30881db --- /dev/null +++ b/vendor/github.com/kubernetes-csi/csi-test/mock/service/controller.go @@ -0,0 +1,287 @@ +package service + +import ( + "fmt" + "math" + "path" + "strconv" + + log "github.com/sirupsen/logrus" + "golang.org/x/net/context" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/container-storage-interface/spec/lib/go/csi/v0" +) + +func (s *service) CreateVolume( + ctx context.Context, + req *csi.CreateVolumeRequest) ( + *csi.CreateVolumeResponse, error) { + + if len(req.Name) == 0 { + return nil, status.Error(codes.InvalidArgument, "Volume Name canot be empty") + } + if req.VolumeCapabilities == nil { + return nil, status.Error(codes.InvalidArgument, "Volume Capabilities cannot be empty") + } + + // Check to see if the volume already exists. + if i, v := s.findVolByName(ctx, req.Name); i >= 0 { + return &csi.CreateVolumeResponse{Volume: &v}, nil + } + + // If no capacity is specified then use 100GiB + capacity := gib100 + if cr := req.CapacityRange; cr != nil { + if rb := cr.RequiredBytes; rb > 0 { + capacity = rb + } + if lb := cr.LimitBytes; lb > 0 { + capacity = lb + } + } + + // Create the volume and add it to the service's in-mem volume slice. + v := s.newVolume(req.Name, capacity) + s.volsRWL.Lock() + defer s.volsRWL.Unlock() + s.vols = append(s.vols, v) + + return &csi.CreateVolumeResponse{Volume: &v}, nil +} + +func (s *service) DeleteVolume( + ctx context.Context, + req *csi.DeleteVolumeRequest) ( + *csi.DeleteVolumeResponse, error) { + + s.volsRWL.Lock() + defer s.volsRWL.Unlock() + + // If the volume does not exist then return an idempotent response. + i, _ := s.findVolNoLock("id", req.VolumeId) + if i < 0 { + return &csi.DeleteVolumeResponse{}, nil + } + + // This delete logic preserves order and prevents potential memory + // leaks. The slice's elements may not be pointers, but the structs + // themselves have fields that are. + copy(s.vols[i:], s.vols[i+1:]) + s.vols[len(s.vols)-1] = csi.Volume{} + s.vols = s.vols[:len(s.vols)-1] + log.WithField("volumeID", req.VolumeId).Debug("mock delete volume") + return &csi.DeleteVolumeResponse{}, nil +} + +func (s *service) ControllerPublishVolume( + ctx context.Context, + req *csi.ControllerPublishVolumeRequest) ( + *csi.ControllerPublishVolumeResponse, error) { + + s.volsRWL.Lock() + defer s.volsRWL.Unlock() + + i, v := s.findVolNoLock("id", req.VolumeId) + if i < 0 { + return nil, status.Error(codes.NotFound, req.VolumeId) + } + + // devPathKey is the key in the volume's attributes that is set to a + // mock device path if the volume has been published by the controller + // to the specified node. + devPathKey := path.Join(req.NodeId, "dev") + + // Check to see if the volume is already published. + if device := v.Attributes[devPathKey]; device != "" { + return &csi.ControllerPublishVolumeResponse{ + PublishInfo: map[string]string{ + "device": device, + }, + }, nil + } + + // Publish the volume. + device := "/dev/mock" + v.Attributes[devPathKey] = device + s.vols[i] = v + + return &csi.ControllerPublishVolumeResponse{ + PublishInfo: map[string]string{ + "device": device, + }, + }, nil +} + +func (s *service) ControllerUnpublishVolume( + ctx context.Context, + req *csi.ControllerUnpublishVolumeRequest) ( + *csi.ControllerUnpublishVolumeResponse, error) { + + s.volsRWL.Lock() + defer s.volsRWL.Unlock() + + i, v := s.findVolNoLock("id", req.VolumeId) + if i < 0 { + return nil, status.Error(codes.NotFound, req.VolumeId) + } + + // devPathKey is the key in the volume's attributes that is set to a + // mock device path if the volume has been published by the controller + // to the specified node. + devPathKey := path.Join(req.NodeId, "dev") + + // Check to see if the volume is already unpublished. + if v.Attributes[devPathKey] == "" { + return &csi.ControllerUnpublishVolumeResponse{}, nil + } + + // Unpublish the volume. + delete(v.Attributes, devPathKey) + s.vols[i] = v + + return &csi.ControllerUnpublishVolumeResponse{}, nil +} + +func (s *service) ValidateVolumeCapabilities( + ctx context.Context, + req *csi.ValidateVolumeCapabilitiesRequest) ( + *csi.ValidateVolumeCapabilitiesResponse, error) { + + i, _ := s.findVolNoLock("id", req.VolumeId) + if i < 0 { + return nil, status.Error(codes.NotFound, req.VolumeId) + } + if len(req.VolumeCapabilities) == 0 { + return nil, status.Error(codes.NotFound, req.VolumeId) + } + + return &csi.ValidateVolumeCapabilitiesResponse{ + Supported: true, + }, nil +} + +func (s *service) ListVolumes( + ctx context.Context, + req *csi.ListVolumesRequest) ( + *csi.ListVolumesResponse, error) { + + // Copy the mock volumes into a new slice in order to avoid + // locking the service's volume slice for the duration of the + // ListVolumes RPC. + var vols []csi.Volume + func() { + s.volsRWL.RLock() + defer s.volsRWL.RUnlock() + vols = make([]csi.Volume, len(s.vols)) + copy(vols, s.vols) + }() + + var ( + ulenVols = int32(len(vols)) + maxEntries = req.MaxEntries + startingToken int32 + ) + + if v := req.StartingToken; v != "" { + i, err := strconv.ParseUint(v, 10, 32) + if err != nil { + return nil, status.Errorf( + codes.InvalidArgument, + "startingToken=%d !< int32=%d", + startingToken, math.MaxUint32) + } + startingToken = int32(i) + } + + if startingToken > ulenVols { + return nil, status.Errorf( + codes.InvalidArgument, + "startingToken=%d > len(vols)=%d", + startingToken, ulenVols) + } + + // Discern the number of remaining entries. + rem := ulenVols - startingToken + + // If maxEntries is 0 or greater than the number of remaining entries then + // set maxEntries to the number of remaining entries. + if maxEntries == 0 || maxEntries > rem { + maxEntries = rem + } + + var ( + i int + j = startingToken + entries = make( + []*csi.ListVolumesResponse_Entry, + maxEntries) + ) + + for i = 0; i < len(entries); i++ { + entries[i] = &csi.ListVolumesResponse_Entry{ + Volume: &vols[j], + } + j++ + } + + var nextToken string + if n := startingToken + int32(i); n < ulenVols { + nextToken = fmt.Sprintf("%d", n) + } + + return &csi.ListVolumesResponse{ + Entries: entries, + NextToken: nextToken, + }, nil +} + +func (s *service) GetCapacity( + ctx context.Context, + req *csi.GetCapacityRequest) ( + *csi.GetCapacityResponse, error) { + + return &csi.GetCapacityResponse{ + AvailableCapacity: tib100, + }, nil +} + +func (s *service) ControllerGetCapabilities( + ctx context.Context, + req *csi.ControllerGetCapabilitiesRequest) ( + *csi.ControllerGetCapabilitiesResponse, error) { + + return &csi.ControllerGetCapabilitiesResponse{ + Capabilities: []*csi.ControllerServiceCapability{ + { + Type: &csi.ControllerServiceCapability_Rpc{ + Rpc: &csi.ControllerServiceCapability_RPC{ + Type: csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME, + }, + }, + }, + { + Type: &csi.ControllerServiceCapability_Rpc{ + Rpc: &csi.ControllerServiceCapability_RPC{ + Type: csi.ControllerServiceCapability_RPC_PUBLISH_UNPUBLISH_VOLUME, + }, + }, + }, + { + Type: &csi.ControllerServiceCapability_Rpc{ + Rpc: &csi.ControllerServiceCapability_RPC{ + Type: csi.ControllerServiceCapability_RPC_LIST_VOLUMES, + }, + }, + }, + { + Type: &csi.ControllerServiceCapability_Rpc{ + Rpc: &csi.ControllerServiceCapability_RPC{ + Type: csi.ControllerServiceCapability_RPC_GET_CAPACITY, + }, + }, + }, + }, + }, nil +} diff --git a/vendor/github.com/kubernetes-csi/csi-test/mock/service/identity.go b/vendor/github.com/kubernetes-csi/csi-test/mock/service/identity.go new file mode 100644 index 000000000..c83daea5f --- /dev/null +++ b/vendor/github.com/kubernetes-csi/csi-test/mock/service/identity.go @@ -0,0 +1,45 @@ +package service + +import ( + "golang.org/x/net/context" + + "github.com/container-storage-interface/spec/lib/go/csi/v0" +) + +func (s *service) GetPluginInfo( + ctx context.Context, + req *csi.GetPluginInfoRequest) ( + *csi.GetPluginInfoResponse, error) { + + return &csi.GetPluginInfoResponse{ + Name: Name, + VendorVersion: VendorVersion, + Manifest: Manifest, + }, nil +} + +func (s *service) Probe( + ctx context.Context, + req *csi.ProbeRequest) ( + *csi.ProbeResponse, error) { + + return &csi.ProbeResponse{}, nil +} + +func (s *service) GetPluginCapabilities( + ctx context.Context, + req *csi.GetPluginCapabilitiesRequest) ( + *csi.GetPluginCapabilitiesResponse, error) { + + return &csi.GetPluginCapabilitiesResponse{ + Capabilities: []*csi.PluginCapability{ + { + Type: &csi.PluginCapability_Service_{ + Service: &csi.PluginCapability_Service{ + Type: csi.PluginCapability_Service_CONTROLLER_SERVICE, + }, + }, + }, + }, + }, nil +} diff --git a/vendor/github.com/kubernetes-csi/csi-test/mock/service/node.go b/vendor/github.com/kubernetes-csi/csi-test/mock/service/node.go new file mode 100644 index 000000000..e6432f267 --- /dev/null +++ b/vendor/github.com/kubernetes-csi/csi-test/mock/service/node.go @@ -0,0 +1,128 @@ +package service + +import ( + "path" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "golang.org/x/net/context" + + "github.com/container-storage-interface/spec/lib/go/csi/v0" +) + +func (s *service) NodeStageVolume( + ctx context.Context, + req *csi.NodeStageVolumeRequest) ( + *csi.NodeStageVolumeResponse, error) { + + return nil, status.Error(codes.Unimplemented, "") +} + +func (s *service) NodeUnstageVolume( + ctx context.Context, + req *csi.NodeUnstageVolumeRequest) ( + *csi.NodeUnstageVolumeResponse, error) { + + return nil, status.Error(codes.Unimplemented, "") +} + +func (s *service) NodePublishVolume( + ctx context.Context, + req *csi.NodePublishVolumeRequest) ( + *csi.NodePublishVolumeResponse, error) { + + device, ok := req.PublishInfo["device"] + if !ok { + return nil, status.Error( + codes.InvalidArgument, + "publish volume info 'device' key required") + } + + s.volsRWL.Lock() + defer s.volsRWL.Unlock() + + i, v := s.findVolNoLock("id", req.VolumeId) + if i < 0 { + return nil, status.Error(codes.NotFound, req.VolumeId) + } + + // nodeMntPathKey is the key in the volume's attributes that is set to a + // mock mount path if the volume has been published by the node + nodeMntPathKey := path.Join(s.nodeID, req.TargetPath) + + // Check to see if the volume has already been published. + if v.Attributes[nodeMntPathKey] != "" { + + // Requests marked Readonly fail due to volumes published by + // the Mock driver supporting only RW mode. + if req.Readonly { + return nil, status.Error(codes.AlreadyExists, req.VolumeId) + } + + return &csi.NodePublishVolumeResponse{}, nil + } + + // Publish the volume. + v.Attributes[nodeMntPathKey] = device + s.vols[i] = v + + return &csi.NodePublishVolumeResponse{}, nil +} + +func (s *service) NodeUnpublishVolume( + ctx context.Context, + req *csi.NodeUnpublishVolumeRequest) ( + *csi.NodeUnpublishVolumeResponse, error) { + + s.volsRWL.Lock() + defer s.volsRWL.Unlock() + + i, v := s.findVolNoLock("id", req.VolumeId) + if i < 0 { + return nil, status.Error(codes.NotFound, req.VolumeId) + } + + // nodeMntPathKey is the key in the volume's attributes that is set to a + // mock mount path if the volume has been published by the node + nodeMntPathKey := path.Join(s.nodeID, req.TargetPath) + + // Check to see if the volume has already been unpublished. + if v.Attributes[nodeMntPathKey] == "" { + return &csi.NodeUnpublishVolumeResponse{}, nil + } + + // Unpublish the volume. + delete(v.Attributes, nodeMntPathKey) + s.vols[i] = v + + return &csi.NodeUnpublishVolumeResponse{}, nil +} + +func (s *service) NodeGetId( + ctx context.Context, + req *csi.NodeGetIdRequest) ( + *csi.NodeGetIdResponse, error) { + + return &csi.NodeGetIdResponse{ + NodeId: s.nodeID, + }, nil +} + +func (s *service) NodeGetCapabilities( + ctx context.Context, + req *csi.NodeGetCapabilitiesRequest) ( + *csi.NodeGetCapabilitiesResponse, error) { + + return &csi.NodeGetCapabilitiesResponse{ + Capabilities: []*csi.NodeServiceCapability{ + { + Type: &csi.NodeServiceCapability_Rpc{ + Rpc: &csi.NodeServiceCapability_RPC{ + Type: csi.NodeServiceCapability_RPC_UNKNOWN, + }, + }, + }, + }, + }, nil +} diff --git a/vendor/github.com/kubernetes-csi/csi-test/mock/service/service.go b/vendor/github.com/kubernetes-csi/csi-test/mock/service/service.go new file mode 100644 index 000000000..94681449b --- /dev/null +++ b/vendor/github.com/kubernetes-csi/csi-test/mock/service/service.go @@ -0,0 +1,98 @@ +package service + +import ( + "fmt" + "strings" + "sync" + "sync/atomic" + + "github.com/container-storage-interface/spec/lib/go/csi/v0" + "golang.org/x/net/context" +) + +const ( + // Name is the name of the CSI plug-in. + Name = "io.kubernetes.storage.mock" + + // VendorVersion is the version returned by GetPluginInfo. + VendorVersion = "0.2.0" +) + +// Manifest is the SP's manifest. +var Manifest = map[string]string{ + "url": "https://github.com/kubernetes-csi/csi-test/mock", +} + +// Service is the CSI Mock service provider. +type Service interface { + csi.ControllerServer + csi.IdentityServer + csi.NodeServer +} + +type service struct { + sync.Mutex + nodeID string + vols []csi.Volume + volsRWL sync.RWMutex + volsNID uint64 +} + +// New returns a new Service. +func New() Service { + s := &service{nodeID: Name} + s.vols = []csi.Volume{ + s.newVolume("Mock Volume 1", gib100), + s.newVolume("Mock Volume 2", gib100), + s.newVolume("Mock Volume 3", gib100), + } + return s +} + +const ( + kib int64 = 1024 + mib int64 = kib * 1024 + gib int64 = mib * 1024 + gib100 int64 = gib * 100 + tib int64 = gib * 1024 + tib100 int64 = tib * 100 +) + +func (s *service) newVolume(name string, capcity int64) csi.Volume { + return csi.Volume{ + Id: fmt.Sprintf("%d", atomic.AddUint64(&s.volsNID, 1)), + Attributes: map[string]string{"name": name}, + CapacityBytes: capcity, + } +} + +func (s *service) findVol(k, v string) (volIdx int, volInfo csi.Volume) { + s.volsRWL.RLock() + defer s.volsRWL.RUnlock() + return s.findVolNoLock(k, v) +} + +func (s *service) findVolNoLock(k, v string) (volIdx int, volInfo csi.Volume) { + volIdx = -1 + + for i, vi := range s.vols { + switch k { + case "id": + if strings.EqualFold(v, vi.Id) { + return i, vi + } + case "name": + if n, ok := vi.Attributes["name"]; ok && strings.EqualFold(v, n) { + return i, vi + } + } + } + + return +} + +func (s *service) findVolByName( + ctx context.Context, name string) (int, csi.Volume) { + + return s.findVol("name", name) +} diff --git a/vendor/github.com/kubernetes-csi/csi-test/mock/utils/utils.go b/vendor/github.com/kubernetes-csi/csi-test/mock/utils/utils.go new file mode 100644 index 000000000..5e64cdceb --- /dev/null +++ b/vendor/github.com/kubernetes-csi/csi-test/mock/utils/utils.go @@ -0,0 +1,586 @@ +package utils + +import ( + "bytes" + "context" + "encoding/csv" + "errors" + "fmt" + "io" + "net" + "os" + "regexp" + "sort" + "strings" + "sync" + + log "github.com/sirupsen/logrus" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/container-storage-interface/spec/lib/go/csi/v0" +) + +const maxuint32 = 4294967295 + +// GetCSIEndpoint returns the network address specified by the +// environment variable CSI_ENDPOINT. +func GetCSIEndpoint() (network, addr string, err error) { + protoAddr := os.Getenv(CSIEndpoint) + if emptyRX.MatchString(protoAddr) { + return "", "", errors.New("missing CSI_ENDPOINT") + } + return ParseProtoAddr(protoAddr) +} + +// GetCSIEndpointListener returns the net.Listener for the endpoint +// specified by the environment variable CSI_ENDPOINT. +func GetCSIEndpointListener() (net.Listener, error) { + proto, addr, err := GetCSIEndpoint() + if err != nil { + return nil, err + } + return net.Listen(proto, addr) +} + +const ( + protoAddrGuessPatt = `(?i)^(?:tcp|udp|ip|unix)[^:]*://` + + protoAddrExactPatt = `(?i)^((?:(?:tcp|udp|ip)[46]?)|` + + `(?:unix(?:gram|packet)?))://(.+)$` +) + +var ( + emptyRX = regexp.MustCompile(`^\s*$`) + protoAddrGuessRX = regexp.MustCompile(protoAddrGuessPatt) + protoAddrExactRX = regexp.MustCompile(protoAddrExactPatt) +) + +// ErrParseProtoAddrRequired occurs when an empty string is provided +// to ParseProtoAddr. +var ErrParseProtoAddrRequired = errors.New( + "non-empty network address is required") + +// ParseProtoAddr parses a Golang network address. +func ParseProtoAddr(protoAddr string) (proto string, addr string, err error) { + + if emptyRX.MatchString(protoAddr) { + return "", "", ErrParseProtoAddrRequired + } + + // If the provided network address does not begin with one + // of the valid network protocols then treat the string as a + // file path. + // + // First check to see if the file exists at the specified path. + // If it does then assume it's a valid file path and return it. + // + // Otherwise attempt to create the file. If the file can be created + // without error then remove the file and return the result a UNIX + // socket file path. + if !protoAddrGuessRX.MatchString(protoAddr) { + + // If the file already exists then assume it's a valid sock + // file and return it. + if _, err := os.Stat(protoAddr); !os.IsNotExist(err) { + return "unix", protoAddr, nil + } + + f, err := os.Create(protoAddr) + if err != nil { + return "", "", fmt.Errorf( + "invalid implied sock file: %s: %v", protoAddr, err) + } + if err := f.Close(); err != nil { + return "", "", fmt.Errorf( + "failed to verify network address as sock file: %s", protoAddr) + } + if err := os.RemoveAll(protoAddr); err != nil { + return "", "", fmt.Errorf( + "failed to remove verified sock file: %s", protoAddr) + } + return "unix", protoAddr, nil + } + + // Parse the provided network address into the protocol and address parts. + m := protoAddrExactRX.FindStringSubmatch(protoAddr) + if m == nil { + return "", "", fmt.Errorf("invalid network address: %s", protoAddr) + } + return m[1], m[2], nil +} + +// ParseMap parses a string into a map. The string's expected pattern is: +// +// KEY1=VAL1, "KEY2=VAL2 ", "KEY 3= VAL3" +// +// The key/value pairs are separated by a comma and optional whitespace. +// Please see the encoding/csv package (https://goo.gl/1j1xb9) for information +// on how to quote keys and/or values to include leading and trailing +// whitespace. +func ParseMap(line string) map[string]string { + line = strings.TrimSpace(line) + if line == "" { + return nil + } + + r := csv.NewReader(strings.NewReader(line)) + r.TrimLeadingSpace = true + + record, err := r.Read() + if err == io.EOF { + return nil + } + if err != nil { + panic(err) + } + + data := map[string]string{} + for i := range record { + p := strings.SplitN(record[i], "=", 2) + if len(p) == 0 { + continue + } + k := p[0] + var v string + if len(p) > 1 { + v = p[1] + } + data[k] = v + } + + return data +} + +// ParseSlice parses a string into a slice. The string's expected pattern is: +// +// VAL1, "VAL2 ", " VAL3 " +// +// The values are separated by a comma and optional whitespace. Please see +// the encoding/csv package (https://goo.gl/1j1xb9) for information on how to +// quote values to include leading and trailing whitespace. +func ParseSlice(line string) []string { + line = strings.TrimSpace(line) + if line == "" { + return nil + } + + r := csv.NewReader(strings.NewReader(line)) + r.TrimLeadingSpace = true + + record, err := r.Read() + if err == io.EOF { + return nil + } + if err != nil { + panic(err) + } + + return record +} + +// ParseMapWS parses a string into a map. The string's expected pattern is: +// +// KEY1=VAL1 KEY2="VAL2 " "KEY 3"=' VAL3' +// +// The key/value pairs are separated by one or more whitespace characters. +// Keys and/or values with whitespace should be quoted with either single +// or double quotes. +func ParseMapWS(line string) map[string]string { + if line == "" { + return nil + } + + var ( + escp bool + quot rune + ckey string + keyb = &bytes.Buffer{} + valb = &bytes.Buffer{} + word = keyb + data = map[string]string{} + ) + + for i, c := range line { + // Check to see if the character is a quote character. + switch c { + case '\\': + // If not already escaped then activate escape. + if !escp { + escp = true + continue + } + case '\'', '"': + // If the quote or double quote is the first char or + // an unescaped char then determine if this is the + // beginning of a quote or end of one. + if i == 0 || !escp { + if quot == c { + quot = 0 + } else { + quot = c + } + continue + } + case '=': + // If the word buffer is currently the key buffer, + // quoting is not enabled, and the preceeding character + // is not the escape character then the equal sign indicates + // a transition from key to value. + if word == keyb && quot == 0 && !escp { + ckey = keyb.String() + keyb.Reset() + word = valb + continue + } + case ' ', '\t': + // If quoting is not enabled and the preceeding character is + // not the escape character then record the value into the + // map and fast-forward the cursor to the next, non-whitespace + // character. + if quot == 0 && !escp { + // Record the value into the map for the current key. + if ckey != "" { + data[ckey] = valb.String() + valb.Reset() + word = keyb + ckey = "" + } + continue + } + } + if escp { + escp = false + } + word.WriteRune(c) + } + + // If the current key string is not empty then record it with the value + // buffer's string value as a new pair. + if ckey != "" { + data[ckey] = valb.String() + } + + return data +} + +// NewMountCapability returns a new *csi.VolumeCapability for a +// volume that is to be mounted. +func NewMountCapability( + mode csi.VolumeCapability_AccessMode_Mode, + fsType string, + mountFlags ...string) *csi.VolumeCapability { + + return &csi.VolumeCapability{ + AccessMode: &csi.VolumeCapability_AccessMode{ + Mode: mode, + }, + AccessType: &csi.VolumeCapability_Mount{ + Mount: &csi.VolumeCapability_MountVolume{ + FsType: fsType, + MountFlags: mountFlags, + }, + }, + } +} + +// NewBlockCapability returns a new *csi.VolumeCapability for a +// volume that is to be accessed as a raw device. +func NewBlockCapability( + mode csi.VolumeCapability_AccessMode_Mode) *csi.VolumeCapability { + + return &csi.VolumeCapability{ + AccessMode: &csi.VolumeCapability_AccessMode{ + Mode: mode, + }, + AccessType: &csi.VolumeCapability_Block{ + Block: &csi.VolumeCapability_BlockVolume{}, + }, + } +} + +// PageVolumes issues one or more ListVolumes requests to retrieve +// all available volumes, returning them over a Go channel. +func PageVolumes( + ctx context.Context, + client csi.ControllerClient, + req csi.ListVolumesRequest, + opts ...grpc.CallOption) (<-chan csi.Volume, <-chan error) { + + var ( + cvol = make(chan csi.Volume) + cerr = make(chan error) + ) + + // Execute the RPC in a goroutine, looping until there are no + // more volumes available. + go func() { + var ( + wg sync.WaitGroup + pages int + cancel context.CancelFunc + ) + + // Get a cancellation context used to control the interaction + // between returning volumes and the possibility of an error. + ctx, cancel = context.WithCancel(ctx) + + // waitAndClose closes the volume and error channels after all + // channel-dependent goroutines have completed their work + defer func() { + wg.Wait() + close(cerr) + close(cvol) + log.WithField("pages", pages).Debug("PageAllVolumes: exit") + }() + + sendVolumes := func(res csi.ListVolumesResponse) { + // Loop over the volume entries until they're all gone + // or the context is cancelled. + var i int + for i = 0; i < len(res.Entries) && ctx.Err() == nil; i++ { + + // Send the volume over the channel. + cvol <- *res.Entries[i].Volume + + // Let the wait group know that this worker has completed + // its task. + wg.Done() + } + // If not all volumes have been sent over the channel then + // deduct the remaining number from the wait group. + if i != len(res.Entries) { + rem := len(res.Entries) - i + log.WithFields(map[string]interface{}{ + "cancel": ctx.Err(), + "remaining": rem, + }).Warn("PageAllVolumes: cancelled w unprocessed results") + wg.Add(-rem) + } + } + + // listVolumes returns true if there are more volumes to list. + listVolumes := func() bool { + + // The wait group "wg" is blocked during the execution of + // this function. + wg.Add(1) + defer wg.Done() + + res, err := client.ListVolumes(ctx, &req, opts...) + if err != nil { + cerr <- err + + // Invoke the cancellation context function to + // ensure that work wraps up as quickly as possible. + cancel() + + return false + } + + // Add to the number of workers + wg.Add(len(res.Entries)) + + // Process the retrieved volumes. + go sendVolumes(*res) + + // Set the request's starting token to the response's + // next token. + req.StartingToken = res.NextToken + return req.StartingToken != "" + } + + // List volumes until there are no more volumes or the context + // is cancelled. + for { + if ctx.Err() != nil { + break + } + if !listVolumes() { + break + } + pages++ + } + }() + + return cvol, cerr +} + +// IsSuccess returns nil if the provided error is an RPC error with an error +// code that is OK (0) or matches one of the additional, provided successful +// error codes. Otherwise the original error is returned. +func IsSuccess(err error, successCodes ...codes.Code) error { + + // Shortcut the process by first checking to see if the error is nil. + if err == nil { + return nil + } + + // Check to see if the provided error is an RPC error. + stat, ok := status.FromError(err) + if !ok { + return err + } + + if stat.Code() == codes.OK { + return nil + } + for _, c := range successCodes { + if stat.Code() == c { + return nil + } + } + + return err +} + +// IsSuccessfulResponse uses IsSuccess to determine if the response for +// a specific CSI method is successful. If successful a nil value is +// returned; otherwise the original error is returned. +func IsSuccessfulResponse(method string, err error) error { + switch method { + case CreateVolume: + return IsSuccess(err, codes.AlreadyExists) + case DeleteVolume: + return IsSuccess(err, codes.NotFound) + } + return err +} + +// AreVolumeCapabilitiesCompatible returns a flag indicating whether +// the volume capability array "a" is compatible with "b". A true value +// indicates that "a" and "b" are equivalent or "b" is a superset of "a". +func AreVolumeCapabilitiesCompatible( + a, b []*csi.VolumeCapability) (bool, error) { + + if len(a) > len(b) { + return false, status.Error( + codes.AlreadyExists, + "requested capabilities exceed existing") + } + + var i int + + for _, va := range a { + for _, vb := range b { + if EqualVolumeCapability(va, vb) { + i++ + } + } + } + + return i >= len(a), nil +} + +// IsVolumeCapabilityCompatible returns a flag indicating whether +// the volume capability "a" is compatible with the set "b". A true value +// indicates that "a" and "b" are equivalent or "b" is a superset of "a". +func IsVolumeCapabilityCompatible( + a *csi.VolumeCapability, b []*csi.VolumeCapability) (bool, error) { + + return AreVolumeCapabilitiesCompatible([]*csi.VolumeCapability{a}, b) +} + +// EqualVolumeCapability returns a flag indicating if two csi.VolumeCapability +// objects are equal. If a and b are both nil then false is returned. +func EqualVolumeCapability(a, b *csi.VolumeCapability) bool { + if a == nil || b == nil { + return false + } + + // Compare access modes. + if a.AccessMode != nil && b.AccessMode == nil { + return false + } + if a.AccessMode == nil && b.AccessMode != nil { + return false + } + if a.AccessMode != nil && b.AccessMode != nil && + a.AccessMode.Mode != b.AccessMode.Mode { + return false + } + + // If both capabilities are block then return true. + if a.GetBlock() != nil && b.GetBlock() != nil { + return true + } + + aMount := a.GetMount() + bMount := b.GetMount() + if aMount != nil && bMount != nil { + + // If the filesystem types are incompatible then return false. + if aMount.FsType != bMount.FsType { + return false + } + + // Compare the mount flags lengths. + if len(aMount.MountFlags) != len(bMount.MountFlags) { + return false + } + + // Copy the mount flags to prevent the original order + // from changing due to the sort operation below. + af := append([]string{}, aMount.MountFlags...) + bf := append([]string{}, bMount.MountFlags...) + + // Sort the mount flags prior to comparison. + sort.Strings(af) + sort.Strings(bf) + + // Compare the mount flags. + for j := range af { + if af[j] != bf[j] { + return false + } + } + + // The mount capabilities are compatible; return true. + return true + } + + return false +} + +// EqualVolume returns a flag indicating if two csi.Volume +// objects are equal. If a and b are both nil then false is returned. +func EqualVolume(a, b *csi.Volume) bool { + if a == nil || b == nil { + return false + } + return CompareVolume(*a, *b) == 0 +} + +// CompareVolume compares two csi.Volume objects and returns a +// negative number if a < b, a positive number if a > b, and zero if +// a == b. +func CompareVolume(a, b csi.Volume) int { + if a.Id < b.Id { + return -1 + } + if a.Id > b.Id { + return 1 + } + if a.CapacityBytes < b.CapacityBytes { + return -1 + } + if a.CapacityBytes > b.CapacityBytes { + return 1 + } + if len(a.Attributes) < len(b.Attributes) { + return -1 + } + if len(a.Attributes) > len(b.Attributes) { + return 1 + } + for k, v := range a.Attributes { + if v < b.Attributes[k] { + return -1 + } + if v > b.Attributes[k] { + return 1 + } + } + return 0 +} diff --git a/vendor/github.com/kubernetes-csi/csi-test/mock/utils/utils_middleware.go b/vendor/github.com/kubernetes-csi/csi-test/mock/utils/utils_middleware.go new file mode 100644 index 000000000..f9966f05e --- /dev/null +++ b/vendor/github.com/kubernetes-csi/csi-test/mock/utils/utils_middleware.go @@ -0,0 +1,143 @@ +package utils + +import ( + "golang.org/x/net/context" + "google.golang.org/grpc" + + "github.com/container-storage-interface/spec/lib/go/csi/v0" +) + +// ChainUnaryClient chains one or more unary, client interceptors +// together into a left-to-right series that can be provided to a +// new gRPC client. +func ChainUnaryClient( + i ...grpc.UnaryClientInterceptor) grpc.UnaryClientInterceptor { + + switch len(i) { + case 0: + return func( + ctx context.Context, + method string, + req, rep interface{}, + cc *grpc.ClientConn, + invoker grpc.UnaryInvoker, + opts ...grpc.CallOption) error { + return invoker(ctx, method, req, rep, cc, opts...) + } + case 1: + return i[0] + } + + return func( + ctx context.Context, + method string, + req, rep interface{}, + cc *grpc.ClientConn, + invoker grpc.UnaryInvoker, + opts ...grpc.CallOption) error { + + bc := func( + cur grpc.UnaryClientInterceptor, + nxt grpc.UnaryInvoker) grpc.UnaryInvoker { + + return func( + curCtx context.Context, + curMethod string, + curReq, curRep interface{}, + curCC *grpc.ClientConn, + curOpts ...grpc.CallOption) error { + + return cur( + curCtx, + curMethod, + curReq, curRep, + curCC, nxt, + curOpts...) + } + } + + c := invoker + for j := len(i) - 1; j >= 0; j-- { + c = bc(i[j], c) + } + + return c(ctx, method, req, rep, cc, opts...) + } +} + +// ChainUnaryServer chains one or more unary, server interceptors +// together into a left-to-right series that can be provided to a +// new gRPC server. +func ChainUnaryServer( + i ...grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor { + + switch len(i) { + case 0: + return func( + ctx context.Context, + req interface{}, + _ *grpc.UnaryServerInfo, + handler grpc.UnaryHandler) (interface{}, error) { + return handler(ctx, req) + } + case 1: + return i[0] + } + + return func( + ctx context.Context, + req interface{}, + info *grpc.UnaryServerInfo, + handler grpc.UnaryHandler) (interface{}, error) { + + bc := func( + cur grpc.UnaryServerInterceptor, + nxt grpc.UnaryHandler) grpc.UnaryHandler { + return func( + curCtx context.Context, + curReq interface{}) (interface{}, error) { + return cur(curCtx, curReq, info, nxt) + } + } + c := handler + for j := len(i) - 1; j >= 0; j-- { + c = bc(i[j], c) + } + return c(ctx, req) + } +} + +// nilResponses exceeds the 80char code limit, but to modify it would render +// it less readable than leaving it as is +var nilResponses = map[string]interface{}{ + CreateVolume: (*csi.CreateVolumeResponse)(nil), + DeleteVolume: (*csi.DeleteVolumeResponse)(nil), + ControllerPublishVolume: (*csi.ControllerPublishVolumeResponse)(nil), + ControllerUnpublishVolume: (*csi.ControllerUnpublishVolumeResponse)(nil), + ValidateVolumeCapabilities: (*csi.ValidateVolumeCapabilitiesResponse)(nil), + ListVolumes: (*csi.ListVolumesResponse)(nil), + GetCapacity: (*csi.GetCapacityResponse)(nil), + ControllerGetCapabilities: (*csi.ControllerGetCapabilitiesResponse)(nil), + GetPluginInfo: (*csi.GetPluginInfoResponse)(nil), + NodeGetId: (*csi.NodeGetIdResponse)(nil), + NodePublishVolume: (*csi.NodePublishVolumeResponse)(nil), + NodeUnpublishVolume: (*csi.NodeUnpublishVolumeResponse)(nil), + NodeGetCapabilities: (*csi.NodeGetCapabilitiesResponse)(nil), +} + +// IsNilResponse returns a flag indicating whether or not the provided +// response object is a nil object wrapped inside a non-nil interface. +func IsNilResponse(method string, rep interface{}) bool { + // Determine whether or not the resposne is nil. Otherwise it + // will no longer be possible to perform a nil equality check on the + // response to the interface{} rules for nil comparison. For more info + // please see https://golang.org/doc/faq#nil_error and + // https://github.com/grpc/grpc-go/issues/532. + if rep == nil { + return true + } + if nilRep := nilResponses[method]; rep == nilRep { + return true + } + return false +} diff --git a/vendor/github.com/kubernetes-csi/csi-test/mock/utils/utils_rpcs.go b/vendor/github.com/kubernetes-csi/csi-test/mock/utils/utils_rpcs.go new file mode 100644 index 000000000..55c20f886 --- /dev/null +++ b/vendor/github.com/kubernetes-csi/csi-test/mock/utils/utils_rpcs.go @@ -0,0 +1,89 @@ +package utils + +const ( + // Namespace is the namesapce used by the protobuf. + Namespace = "csi" + + // CSIEndpoint is the name of the environment variable that + // contains the CSI endpoint. + CSIEndpoint = "CSI_ENDPOINT" + + // + // Controller Service + // + ctrlSvc = "/" + Namespace + ".Controller/" + + // CreateVolume is the full method name for the + // eponymous RPC message. + CreateVolume = ctrlSvc + "CreateVolume" + + // DeleteVolume is the full method name for the + // eponymous RPC message. + DeleteVolume = ctrlSvc + "DeleteVolume" + + // ControllerPublishVolume is the full method name for the + // eponymous RPC message. + ControllerPublishVolume = ctrlSvc + "ControllerPublishVolume" + + // ControllerUnpublishVolume is the full method name for the + // eponymous RPC message. + ControllerUnpublishVolume = ctrlSvc + "ControllerUnpublishVolume" + + // ValidateVolumeCapabilities is the full method name for the + // eponymous RPC message. + ValidateVolumeCapabilities = ctrlSvc + "ValidateVolumeCapabilities" + + // ListVolumes is the full method name for the + // eponymous RPC message. + ListVolumes = ctrlSvc + "ListVolumes" + + // GetCapacity is the full method name for the + // eponymous RPC message. + GetCapacity = ctrlSvc + "GetCapacity" + + // ControllerGetCapabilities is the full method name for the + // eponymous RPC message. + ControllerGetCapabilities = ctrlSvc + "ControllerGetCapabilities" + + // ControllerProbe is the full method name for the + // eponymous RPC message. + ControllerProbe = ctrlSvc + "ControllerProbe" + + // + // Identity Service + // + identSvc = "/" + Namespace + ".Identity/" + + // GetSupportedVersions is the full method name for the + // eponymous RPC message. + GetSupportedVersions = identSvc + "GetSupportedVersions" + + // GetPluginInfo is the full method name for the + // eponymous RPC message. + GetPluginInfo = identSvc + "GetPluginInfo" + + // + // Node Service + // + nodeSvc = "/" + Namespace + ".Node/" + + // NodeGetId is the full method name for the + // eponymous RPC message. + NodeGetId = nodeSvc + "NodeGetId" + + // NodePublishVolume is the full method name for the + // eponymous RPC message. + NodePublishVolume = nodeSvc + "NodePublishVolume" + + // NodeUnpublishVolume is the full method name for the + // eponymous RPC message. + NodeUnpublishVolume = nodeSvc + "NodeUnpublishVolume" + + // NodeProbe is the full method name for the + // eponymous RPC message. + NodeProbe = nodeSvc + "NodeProbe" + + // NodeGetCapabilities is the full method name for the + // eponymous RPC message. + NodeGetCapabilities = nodeSvc + "NodeGetCapabilities" +) diff --git a/vendor/github.com/kubernetes-csi/csi-test/mock/utils/utils_suite_test.go b/vendor/github.com/kubernetes-csi/csi-test/mock/utils/utils_suite_test.go new file mode 100644 index 000000000..bdc906817 --- /dev/null +++ b/vendor/github.com/kubernetes-csi/csi-test/mock/utils/utils_suite_test.go @@ -0,0 +1,118 @@ +package utils_test + +import ( + "github.com/onsi/ginkgo" + "github.com/onsi/gomega" + log "github.com/sirupsen/logrus" + + "testing" +) + +func TestUtils(t *testing.T) { + log.SetLevel(log.DebugLevel) + log.SetOutput(GinkgoWriter) + RegisterFailHandler(Fail) + RunSpecs(t, "Utils Suite") +} + +// Declarations for Ginkgo DSL +type Done ginkgo.Done +type Benchmarker ginkgo.Benchmarker + +var GinkgoWriter = ginkgo.GinkgoWriter +var GinkgoRandomSeed = ginkgo.GinkgoRandomSeed +var GinkgoParallelNode = ginkgo.GinkgoParallelNode +var GinkgoT = ginkgo.GinkgoT +var CurrentGinkgoTestDescription = ginkgo.CurrentGinkgoTestDescription +var RunSpecs = ginkgo.RunSpecs +var RunSpecsWithDefaultAndCustomReporters = ginkgo.RunSpecsWithDefaultAndCustomReporters +var RunSpecsWithCustomReporters = ginkgo.RunSpecsWithCustomReporters +var Skip = ginkgo.Skip +var Fail = ginkgo.Fail +var GinkgoRecover = ginkgo.GinkgoRecover +var Describe = ginkgo.Describe +var FDescribe = ginkgo.FDescribe +var PDescribe = ginkgo.PDescribe +var XDescribe = ginkgo.XDescribe +var Context = ginkgo.Context +var FContext = ginkgo.FContext +var PContext = ginkgo.PContext +var XContext = ginkgo.XContext +var It = ginkgo.It +var FIt = ginkgo.FIt +var PIt = ginkgo.PIt +var XIt = ginkgo.XIt +var Specify = ginkgo.Specify +var FSpecify = ginkgo.FSpecify +var PSpecify = ginkgo.PSpecify +var XSpecify = ginkgo.XSpecify +var By = ginkgo.By +var Measure = ginkgo.Measure +var FMeasure = ginkgo.FMeasure +var PMeasure = ginkgo.PMeasure +var XMeasure = ginkgo.XMeasure +var BeforeSuite = ginkgo.BeforeSuite +var AfterSuite = ginkgo.AfterSuite +var SynchronizedBeforeSuite = ginkgo.SynchronizedBeforeSuite +var SynchronizedAfterSuite = ginkgo.SynchronizedAfterSuite +var BeforeEach = ginkgo.BeforeEach +var JustBeforeEach = ginkgo.JustBeforeEach +var AfterEach = ginkgo.AfterEach + +// Declarations for Gomega DSL +var RegisterFailHandler = gomega.RegisterFailHandler +var RegisterTestingT = gomega.RegisterTestingT +var InterceptGomegaFailures = gomega.InterceptGomegaFailures +var Ω = gomega.Ω +var Expect = gomega.Expect +var ExpectWithOffset = gomega.ExpectWithOffset +var Eventually = gomega.Eventually +var EventuallyWithOffset = gomega.EventuallyWithOffset +var Consistently = gomega.Consistently +var ConsistentlyWithOffset = gomega.ConsistentlyWithOffset +var SetDefaultEventuallyTimeout = gomega.SetDefaultEventuallyTimeout +var SetDefaultEventuallyPollingInterval = gomega.SetDefaultEventuallyPollingInterval +var SetDefaultConsistentlyDuration = gomega.SetDefaultConsistentlyDuration +var SetDefaultConsistentlyPollingInterval = gomega.SetDefaultConsistentlyPollingInterval + +// Declarations for Gomega Matchers +var Equal = gomega.Equal +var BeEquivalentTo = gomega.BeEquivalentTo +var BeIdenticalTo = gomega.BeIdenticalTo +var BeNil = gomega.BeNil +var BeTrue = gomega.BeTrue +var BeFalse = gomega.BeFalse +var HaveOccurred = gomega.HaveOccurred +var Succeed = gomega.Succeed +var MatchError = gomega.MatchError +var BeClosed = gomega.BeClosed +var Receive = gomega.Receive +var BeSent = gomega.BeSent +var MatchRegexp = gomega.MatchRegexp +var ContainSubstring = gomega.ContainSubstring +var HavePrefix = gomega.HavePrefix +var HaveSuffix = gomega.HaveSuffix +var MatchJSON = gomega.MatchJSON +var MatchXML = gomega.MatchXML +var MatchYAML = gomega.MatchYAML +var BeEmpty = gomega.BeEmpty +var HaveLen = gomega.HaveLen +var HaveCap = gomega.HaveCap +var BeZero = gomega.BeZero +var ContainElement = gomega.ContainElement +var ConsistOf = gomega.ConsistOf +var HaveKey = gomega.HaveKey +var HaveKeyWithValue = gomega.HaveKeyWithValue +var BeNumerically = gomega.BeNumerically +var BeTemporally = gomega.BeTemporally +var BeAssignableToTypeOf = gomega.BeAssignableToTypeOf +var Panic = gomega.Panic +var BeAnExistingFile = gomega.BeAnExistingFile +var BeARegularFile = gomega.BeARegularFile +var BeADirectory = gomega.BeADirectory +var And = gomega.And +var SatisfyAll = gomega.SatisfyAll +var Or = gomega.Or +var SatisfyAny = gomega.SatisfyAny +var Not = gomega.Not +var WithTransform = gomega.WithTransform diff --git a/vendor/github.com/kubernetes-csi/csi-test/mock/utils/utils_test.go b/vendor/github.com/kubernetes-csi/csi-test/mock/utils/utils_test.go new file mode 100644 index 000000000..d6748a73e --- /dev/null +++ b/vendor/github.com/kubernetes-csi/csi-test/mock/utils/utils_test.go @@ -0,0 +1,415 @@ +package utils_test + +import ( + "errors" + "fmt" + "os" + + "github.com/container-storage-interface/spec/lib/go/csi/v0" + "github.com/kubernetes-csi/csi-test/mock/utils" +) + +var errMissingCSIEndpoint = errors.New("missing CSI_ENDPOINT") + +var _ = Describe("GetCSIEndpoint", func() { + var ( + err error + proto string + addr string + expEndpoint string + expProto string + expAddr string + ) + BeforeEach(func() { + expEndpoint = CurrentGinkgoTestDescription().ComponentTexts[2] + os.Setenv(utils.CSIEndpoint, expEndpoint) + }) + AfterEach(func() { + proto = "" + addr = "" + expEndpoint = "" + expProto = "" + expAddr = "" + os.Unsetenv(utils.CSIEndpoint) + }) + JustBeforeEach(func() { + proto, addr, err = utils.GetCSIEndpoint() + }) + + Context("Valid Endpoint", func() { + shouldBeValid := func() { + Ω(os.Getenv(utils.CSIEndpoint)).Should(Equal(expEndpoint)) + Ω(proto).Should(Equal(expProto)) + Ω(addr).Should(Equal(expAddr)) + } + Context("tcp://127.0.0.1", func() { + BeforeEach(func() { + expProto = "tcp" + expAddr = "127.0.0.1" + }) + It("Should Be Valid", shouldBeValid) + }) + Context("tcp://127.0.0.1:8080", func() { + BeforeEach(func() { + expProto = "tcp" + expAddr = "127.0.0.1:8080" + }) + It("Should Be Valid", shouldBeValid) + }) + Context("tcp://*:8080", func() { + BeforeEach(func() { + expProto = "tcp" + expAddr = "*:8080" + }) + It("Should Be Valid", shouldBeValid) + }) + Context("unix://path/to/sock.sock", func() { + BeforeEach(func() { + expProto = "unix" + expAddr = "path/to/sock.sock" + }) + It("Should Be Valid", shouldBeValid) + }) + Context("unix:///path/to/sock.sock", func() { + BeforeEach(func() { + expProto = "unix" + expAddr = "/path/to/sock.sock" + }) + It("Should Be Valid", shouldBeValid) + }) + Context("sock.sock", func() { + BeforeEach(func() { + expProto = "unix" + expAddr = "sock.sock" + }) + It("Should Be Valid", shouldBeValid) + }) + Context("/tmp/sock.sock", func() { + BeforeEach(func() { + expProto = "unix" + expAddr = "/tmp/sock.sock" + }) + It("Should Be Valid", shouldBeValid) + }) + }) + + Context("Missing Endpoint", func() { + Context("", func() { + It("Should Be Missing", func() { + Ω(err).Should(HaveOccurred()) + Ω(err).Should(Equal(errMissingCSIEndpoint)) + }) + }) + Context(" ", func() { + It("Should Be Missing", func() { + Ω(err).Should(HaveOccurred()) + Ω(err).Should(Equal(errMissingCSIEndpoint)) + }) + }) + }) + + Context("Invalid Network Address", func() { + shouldBeInvalid := func() { + Ω(err).Should(HaveOccurred()) + Ω(err.Error()).Should(Equal(fmt.Sprintf( + "invalid network address: %s", expEndpoint))) + } + Context("tcp5://localhost:5000", func() { + It("Should Be An Invalid Endpoint", shouldBeInvalid) + }) + Context("unixpcket://path/to/sock.sock", func() { + It("Should Be An Invalid Endpoint", shouldBeInvalid) + }) + }) + + Context("Invalid Implied Sock File", func() { + shouldBeInvalid := func() { + Ω(err).Should(HaveOccurred()) + Ω(err.Error()).Should(Equal(fmt.Sprintf( + "invalid implied sock file: %[1]s: "+ + "open %[1]s: no such file or directory", + expEndpoint))) + } + Context("Xtcp5://localhost:5000", func() { + It("Should Be An Invalid Implied Sock File", shouldBeInvalid) + }) + Context("Xunixpcket://path/to/sock.sock", func() { + It("Should Be An Invalid Implied Sock File", shouldBeInvalid) + }) + }) +}) + +var _ = Describe("ParseProtoAddr", func() { + Context("Empty Address", func() { + It("Should Be An Empty Address", func() { + _, _, err := utils.ParseProtoAddr("") + Ω(err).Should(HaveOccurred()) + Ω(err).Should(Equal(utils.ErrParseProtoAddrRequired)) + }) + It("Should Be An Empty Address", func() { + _, _, err := utils.ParseProtoAddr(" ") + Ω(err).Should(HaveOccurred()) + Ω(err).Should(Equal(utils.ErrParseProtoAddrRequired)) + }) + }) +}) + +var _ = Describe("ParseMap", func() { + Context("One Pair", func() { + It("Should Be Valid", func() { + data := utils.ParseMap("k1=v1") + Ω(data).Should(HaveLen(1)) + Ω(data["k1"]).Should(Equal("v1")) + }) + }) + Context("Empty Line", func() { + It("Should Be Valid", func() { + data := utils.ParseMap("") + Ω(data).Should(HaveLen(0)) + }) + }) + Context("Key Sans Value", func() { + It("Should Be Valid", func() { + data := utils.ParseMap("k1") + Ω(data).Should(HaveLen(1)) + }) + }) + Context("Two Pair", func() { + It("Should Be Valid", func() { + data := utils.ParseMap("k1=v1, k2=v2") + Ω(data).Should(HaveLen(2)) + Ω(data["k1"]).Should(Equal("v1")) + Ω(data["k2"]).Should(Equal("v2")) + }) + }) + Context("Two Pair with Quoting & Escaping", func() { + It("Should Be Valid", func() { + data := utils.ParseMap(`k1=v1, "k2=v2""s"`) + Ω(data).Should(HaveLen(2)) + Ω(data["k1"]).Should(Equal("v1")) + Ω(data["k2"]).Should(Equal(`v2"s`)) + }) + It("Should Be Valid", func() { + data := utils.ParseMap(`k1=v1, "k2=v2\'s"`) + Ω(data).Should(HaveLen(2)) + Ω(data["k1"]).Should(Equal("v1")) + Ω(data["k2"]).Should(Equal(`v2\'s`)) + }) + It("Should Be Valid", func() { + data := utils.ParseMap(`k1=v1, k2=v2's`) + Ω(data).Should(HaveLen(2)) + Ω(data["k1"]).Should(Equal("v1")) + Ω(data["k2"]).Should(Equal(`v2's`)) + }) + }) + Context("Two Pair with Three Spaces Between Them", func() { + It("Should Be Valid", func() { + data := utils.ParseMap("k1=v1, k2=v2") + Ω(data).Should(HaveLen(2)) + Ω(data["k1"]).Should(Equal("v1")) + Ω(data["k2"]).Should(Equal("v2")) + }) + }) + Context("Two Pair with One Sans Value", func() { + It("Should Be Valid", func() { + data := utils.ParseMap("k1=, k2=v2") + Ω(data).Should(HaveLen(2)) + Ω(data["k1"]).Should(Equal("")) + Ω(data["k2"]).Should(Equal("v2")) + }) + }) + Context("Two Pair with One Sans Value & Three Spaces Between Them", func() { + It("Should Be Valid", func() { + data := utils.ParseMap("k1=, k2=v2") + Ω(data).Should(HaveLen(2)) + Ω(data["k1"]).Should(Equal("")) + Ω(data["k2"]).Should(Equal("v2")) + }) + }) + Context("One Pair with Quoted Value", func() { + It("Should Be Valid", func() { + data := utils.ParseMap("k1=v 1") + Ω(data).Should(HaveLen(1)) + Ω(data["k1"]).Should(Equal("v 1")) + }) + }) + Context("Three Pair with Mixed Values", func() { + It("Should Be Valid", func() { + data := utils.ParseMap(`"k1=v 1", "k2=v 2 ", "k3 =v3" `) + Ω(data).Should(HaveLen(3)) + Ω(data["k1"]).Should(Equal("v 1")) + Ω(data["k2"]).Should(Equal("v 2 ")) + Ω(data["k3 "]).Should(Equal("v3")) + }) + }) +}) + +var _ = Describe("CompareVolume", func() { + It("a == b", func() { + a := csi.Volume{Id: "0"} + b := csi.Volume{Id: "0"} + Ω(utils.CompareVolume(a, b)).Should(Equal(0)) + a.CapacityBytes = 1 + b.CapacityBytes = 1 + Ω(utils.CompareVolume(a, b)).Should(Equal(0)) + a.Attributes = map[string]string{"key": "val"} + b.Attributes = map[string]string{"key": "val"} + Ω(utils.CompareVolume(a, b)).Should(Equal(0)) + }) + It("a > b", func() { + a := csi.Volume{Id: "0"} + b := csi.Volume{} + Ω(utils.CompareVolume(a, b)).Should(Equal(1)) + b.Id = "0" + Ω(utils.CompareVolume(a, b)).Should(Equal(0)) + a.CapacityBytes = 1 + Ω(utils.CompareVolume(a, b)).Should(Equal(1)) + b.CapacityBytes = 1 + Ω(utils.CompareVolume(a, b)).Should(Equal(0)) + a.Attributes = map[string]string{"key": "val"} + Ω(utils.CompareVolume(a, b)).Should(Equal(1)) + b.Attributes = map[string]string{"key": "val"} + Ω(utils.CompareVolume(a, b)).Should(Equal(0)) + }) + It("a < b", func() { + b := csi.Volume{Id: "0"} + a := csi.Volume{} + Ω(utils.CompareVolume(a, b)).Should(Equal(-1)) + a.Id = "0" + Ω(utils.CompareVolume(a, b)).Should(Equal(0)) + b.CapacityBytes = 1 + Ω(utils.CompareVolume(a, b)).Should(Equal(-1)) + a.CapacityBytes = 1 + Ω(utils.CompareVolume(a, b)).Should(Equal(0)) + b.Attributes = map[string]string{"key": "val"} + Ω(utils.CompareVolume(a, b)).Should(Equal(-1)) + a.Attributes = map[string]string{"key": "val"} + Ω(utils.CompareVolume(a, b)).Should(Equal(0)) + }) +}) + +var _ = Describe("EqualVolumeCapability", func() { + It("a == b", func() { + a := &csi.VolumeCapability{ + AccessMode: &csi.VolumeCapability_AccessMode{ + Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER, + }, + AccessType: &csi.VolumeCapability_Block{ + Block: &csi.VolumeCapability_BlockVolume{}, + }, + } + b := &csi.VolumeCapability{ + AccessMode: &csi.VolumeCapability_AccessMode{ + Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER, + }, + AccessType: &csi.VolumeCapability_Block{ + Block: &csi.VolumeCapability_BlockVolume{}, + }, + } + Ω(utils.EqualVolumeCapability(a, b)).Should(BeTrue()) + a.AccessMode.Mode = csi.VolumeCapability_AccessMode_MULTI_NODE_READER_ONLY + Ω(utils.EqualVolumeCapability(a, b)).Should(BeFalse()) + b.AccessMode.Mode = csi.VolumeCapability_AccessMode_MULTI_NODE_READER_ONLY + Ω(utils.EqualVolumeCapability(a, b)).Should(BeTrue()) + a.AccessMode = nil + Ω(utils.EqualVolumeCapability(a, b)).Should(BeFalse()) + b.AccessMode = nil + Ω(utils.EqualVolumeCapability(a, b)).Should(BeTrue()) + a = nil + Ω(utils.EqualVolumeCapability(nil, b)).Should(BeFalse()) + b = nil + Ω(utils.EqualVolumeCapability(a, b)).Should(BeFalse()) + + aAT := &csi.VolumeCapability_Mount{ + Mount: &csi.VolumeCapability_MountVolume{ + FsType: "ext4", + MountFlags: []string{"rw"}, + }, + } + bAT := &csi.VolumeCapability_Mount{ + Mount: &csi.VolumeCapability_MountVolume{ + FsType: "ext4", + MountFlags: []string{"rw"}, + }, + } + + a = &csi.VolumeCapability{ + AccessMode: &csi.VolumeCapability_AccessMode{ + Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER, + }, + AccessType: aAT, + } + b = &csi.VolumeCapability{ + AccessMode: &csi.VolumeCapability_AccessMode{ + Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER, + }, + AccessType: bAT, + } + Ω(utils.EqualVolumeCapability(a, b)).Should(BeTrue()) + aAT.Mount.FsType = "xfs" + Ω(utils.EqualVolumeCapability(a, b)).Should(BeFalse()) + bAT.Mount.FsType = "xfs" + Ω(utils.EqualVolumeCapability(a, b)).Should(BeTrue()) + aAT.Mount.MountFlags = append(aAT.Mount.MountFlags, "nosuid") + Ω(utils.EqualVolumeCapability(a, b)).Should(BeFalse()) + bAT.Mount.MountFlags = append(bAT.Mount.MountFlags, "nosuid") + Ω(utils.EqualVolumeCapability(a, b)).Should(BeTrue()) + aAT.Mount.MountFlags[0] = "ro" + Ω(utils.EqualVolumeCapability(a, b)).Should(BeFalse()) + bAT.Mount.MountFlags[0] = "ro" + Ω(utils.EqualVolumeCapability(a, b)).Should(BeTrue()) + aAT.Mount.MountFlags = nil + Ω(utils.EqualVolumeCapability(a, b)).Should(BeFalse()) + bAT.Mount.MountFlags = nil + Ω(utils.EqualVolumeCapability(a, b)).Should(BeTrue()) + }) +}) + +var _ = Describe("AreVolumeCapabilitiesCompatible", func() { + It("compatible", func() { + aMountAT := &csi.VolumeCapability_Mount{ + Mount: &csi.VolumeCapability_MountVolume{ + FsType: "ext4", + MountFlags: []string{"rw"}, + }, + } + a := []*csi.VolumeCapability{ + { + AccessMode: &csi.VolumeCapability_AccessMode{ + Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER, + }, + AccessType: aMountAT, + }, + } + + b := []*csi.VolumeCapability{ + { + AccessMode: &csi.VolumeCapability_AccessMode{ + Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER, + }, + AccessType: &csi.VolumeCapability_Block{ + Block: &csi.VolumeCapability_BlockVolume{}, + }, + }, + { + AccessMode: &csi.VolumeCapability_AccessMode{ + Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER, + }, + AccessType: &csi.VolumeCapability_Mount{ + Mount: &csi.VolumeCapability_MountVolume{ + FsType: "ext4", + MountFlags: []string{"rw"}, + }, + }, + }, + } + + Ω(utils.AreVolumeCapabilitiesCompatible(a, b)).Should(BeTrue()) + aMountAT.Mount.MountFlags[0] = "ro" + Ω(utils.AreVolumeCapabilitiesCompatible(a, b)).Should(BeFalse()) + a[0].AccessType = &csi.VolumeCapability_Block{ + Block: &csi.VolumeCapability_BlockVolume{}, + } + Ω(utils.AreVolumeCapabilitiesCompatible(a, b)).Should(BeTrue()) + }) +}) diff --git a/vendor/github.com/kubernetes-csi/csi-test/pkg/sanity/controller.go b/vendor/github.com/kubernetes-csi/csi-test/pkg/sanity/controller.go index 2ea3709a7..7fcd41a55 100644 --- a/vendor/github.com/kubernetes-csi/csi-test/pkg/sanity/controller.go +++ b/vendor/github.com/kubernetes-csi/csi-test/pkg/sanity/controller.go @@ -269,16 +269,12 @@ var _ = Describe("DeleteVolume [Controller Server]", func() { } }) - It("should fail when no volume id is provided", func() { + It("should not fail when no volume id is provided", func() { _, err := c.DeleteVolume( context.Background(), &csi.DeleteVolumeRequest{}) - Expect(err).To(HaveOccurred()) - - serverError, ok := status.FromError(err) - Expect(ok).To(BeTrue()) - Expect(serverError.Code()).To(Equal(codes.InvalidArgument)) + Expect(err).NotTo(HaveOccurred()) }) It("should succeed when an invalid volume id is used", func() { @@ -346,7 +342,7 @@ var _ = Describe("ValidateVolumeCapabilities [Controller Server]", func() { serverError, ok := status.FromError(err) Expect(ok).To(BeTrue()) - Expect(serverError.Code()).To(Equal(codes.InvalidArgument)) + Expect(serverError.Code()).To(Equal(codes.NotFound)) }) It("should fail when no volume capabilities are provided", func() { @@ -360,7 +356,7 @@ var _ = Describe("ValidateVolumeCapabilities [Controller Server]", func() { serverError, ok := status.FromError(err) Expect(ok).To(BeTrue()) - Expect(serverError.Code()).To(Equal(codes.InvalidArgument)) + Expect(serverError.Code()).To(Equal(codes.NotFound)) }) It("should return appropriate values (no optional values added)", func() { @@ -444,7 +440,7 @@ var _ = Describe("ControllerPublishVolume [Controller Server]", func() { serverError, ok := status.FromError(err) Expect(ok).To(BeTrue()) - Expect(serverError.Code()).To(Equal(codes.InvalidArgument)) + Expect(serverError.Code()).To(Equal(codes.NotFound)) }) It("should fail when no node id is provided", func() { @@ -458,7 +454,7 @@ var _ = Describe("ControllerPublishVolume [Controller Server]", func() { serverError, ok := status.FromError(err) Expect(ok).To(BeTrue()) - Expect(serverError.Code()).To(Equal(codes.InvalidArgument)) + Expect(serverError.Code()).To(Equal(codes.NotFound)) }) It("should fail when no volume capability is provided", func() { @@ -473,7 +469,7 @@ var _ = Describe("ControllerPublishVolume [Controller Server]", func() { serverError, ok := status.FromError(err) Expect(ok).To(BeTrue()) - Expect(serverError.Code()).To(Equal(codes.InvalidArgument)) + Expect(serverError.Code()).To(Equal(codes.NotFound)) }) It("should return appropriate values (no optional values added)", func() { @@ -574,7 +570,7 @@ var _ = Describe("ControllerUnpublishVolume [Controller Server]", func() { serverError, ok := status.FromError(err) Expect(ok).To(BeTrue()) - Expect(serverError.Code()).To(Equal(codes.InvalidArgument)) + Expect(serverError.Code()).To(Equal(codes.NotFound)) }) It("should return appropriate values (no optional values added)", func() { diff --git a/vendor/github.com/kubernetes-csi/csi-test/pkg/sanity/node.go b/vendor/github.com/kubernetes-csi/csi-test/pkg/sanity/node.go index 7943c5ad9..9ed48cf65 100644 --- a/vendor/github.com/kubernetes-csi/csi-test/pkg/sanity/node.go +++ b/vendor/github.com/kubernetes-csi/csi-test/pkg/sanity/node.go @@ -269,7 +269,7 @@ var _ = Describe("NodeUnpublishVolume [Node Server]", func() { serverError, ok := status.FromError(err) Expect(ok).To(BeTrue()) - Expect(serverError.Code()).To(Equal(codes.InvalidArgument)) + Expect(serverError.Code()).To(Equal(codes.NotFound)) }) It("should fail when no target path is provided", func() { @@ -283,7 +283,7 @@ var _ = Describe("NodeUnpublishVolume [Node Server]", func() { serverError, ok := status.FromError(err) Expect(ok).To(BeTrue()) - Expect(serverError.Code()).To(Equal(codes.InvalidArgument)) + Expect(serverError.Code()).To(Equal(codes.NotFound)) }) It("should return appropriate values (no optional values added)", func() { diff --git a/vendor/github.com/modern-go/concurrent/.gitignore b/vendor/github.com/modern-go/concurrent/.gitignore new file mode 100644 index 000000000..3f2bc4741 --- /dev/null +++ b/vendor/github.com/modern-go/concurrent/.gitignore @@ -0,0 +1 @@ +/coverage.txt diff --git a/vendor/github.com/modern-go/concurrent/.travis.yml b/vendor/github.com/modern-go/concurrent/.travis.yml new file mode 100644 index 000000000..449e67cd0 --- /dev/null +++ b/vendor/github.com/modern-go/concurrent/.travis.yml @@ -0,0 +1,14 @@ +language: go + +go: + - 1.8.x + - 1.x + +before_install: + - go get -t -v ./... + +script: + - ./test.sh + +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/modern-go/concurrent/LICENSE b/vendor/github.com/modern-go/concurrent/LICENSE new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/vendor/github.com/modern-go/concurrent/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/modern-go/concurrent/README.md b/vendor/github.com/modern-go/concurrent/README.md new file mode 100644 index 000000000..b4381f1c4 --- /dev/null +++ b/vendor/github.com/modern-go/concurrent/README.md @@ -0,0 +1,11 @@ +# concurrent + +[![Sourcegraph](https://sourcegraph.com/github.com/modern-go/concurrent/-/badge.svg)](https://sourcegraph.com/github.com/modern-go/concurrent?badge) +[![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](http://godoc.org/github.com/modern-go/concurrent) +[![Build Status](https://travis-ci.org/modern-go/concurrent.svg?branch=master)](https://travis-ci.org/modern-go/concurrent) +[![codecov](https://codecov.io/gh/modern-go/concurrent/branch/master/graph/badge.svg)](https://codecov.io/gh/modern-go/concurrent) +[![rcard](https://goreportcard.com/badge/github.com/modern-go/concurrent)](https://goreportcard.com/report/github.com/modern-go/concurrent) +[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://raw.githubusercontent.com/modern-go/concurrent/master/LICENSE) + +* concurrent.Map: backport sync.Map for go below 1.9 +* concurrent.Executor: goroutine with explicit ownership and cancellable \ No newline at end of file diff --git a/vendor/github.com/modern-go/concurrent/executor.go b/vendor/github.com/modern-go/concurrent/executor.go new file mode 100644 index 000000000..623dba1ac --- /dev/null +++ b/vendor/github.com/modern-go/concurrent/executor.go @@ -0,0 +1,14 @@ +package concurrent + +import "context" + +// Executor replace go keyword to start a new goroutine +// the goroutine should cancel itself if the context passed in has been cancelled +// the goroutine started by the executor, is owned by the executor +// we can cancel all executors owned by the executor just by stop the executor itself +// however Executor interface does not Stop method, the one starting and owning executor +// should use the concrete type of executor, instead of this interface. +type Executor interface { + // Go starts a new goroutine controlled by the context + Go(handler func(ctx context.Context)) +} diff --git a/vendor/github.com/modern-go/concurrent/go_above_19.go b/vendor/github.com/modern-go/concurrent/go_above_19.go new file mode 100644 index 000000000..aeabf8c4f --- /dev/null +++ b/vendor/github.com/modern-go/concurrent/go_above_19.go @@ -0,0 +1,15 @@ +//+build go1.9 + +package concurrent + +import "sync" + +// Map is a wrapper for sync.Map introduced in go1.9 +type Map struct { + sync.Map +} + +// NewMap creates a thread safe Map +func NewMap() *Map { + return &Map{} +} diff --git a/vendor/github.com/modern-go/concurrent/go_below_19.go b/vendor/github.com/modern-go/concurrent/go_below_19.go new file mode 100644 index 000000000..b9c8df7f4 --- /dev/null +++ b/vendor/github.com/modern-go/concurrent/go_below_19.go @@ -0,0 +1,33 @@ +//+build !go1.9 + +package concurrent + +import "sync" + +// Map implements a thread safe map for go version below 1.9 using mutex +type Map struct { + lock sync.RWMutex + data map[interface{}]interface{} +} + +// NewMap creates a thread safe map +func NewMap() *Map { + return &Map{ + data: make(map[interface{}]interface{}, 32), + } +} + +// Load is same as sync.Map Load +func (m *Map) Load(key interface{}) (elem interface{}, found bool) { + m.lock.RLock() + elem, found = m.data[key] + m.lock.RUnlock() + return +} + +// Load is same as sync.Map Store +func (m *Map) Store(key interface{}, elem interface{}) { + m.lock.Lock() + m.data[key] = elem + m.lock.Unlock() +} diff --git a/vendor/github.com/modern-go/concurrent/log.go b/vendor/github.com/modern-go/concurrent/log.go new file mode 100644 index 000000000..9756fcc75 --- /dev/null +++ b/vendor/github.com/modern-go/concurrent/log.go @@ -0,0 +1,13 @@ +package concurrent + +import ( + "os" + "log" + "io/ioutil" +) + +// ErrorLogger is used to print out error, can be set to writer other than stderr +var ErrorLogger = log.New(os.Stderr, "", 0) + +// InfoLogger is used to print informational message, default to off +var InfoLogger = log.New(ioutil.Discard, "", 0) \ No newline at end of file diff --git a/vendor/github.com/modern-go/concurrent/map_test.go b/vendor/github.com/modern-go/concurrent/map_test.go new file mode 100644 index 000000000..16ba3e5f7 --- /dev/null +++ b/vendor/github.com/modern-go/concurrent/map_test.go @@ -0,0 +1,18 @@ +package concurrent_test + +import ( + "github.com/modern-go/concurrent" + "testing" +) + +func TestMap_Load(t *testing.T) { + m := concurrent.NewMap() + m.Store("hello", "world") + value, found := m.Load("hello") + if !found { + t.Fail() + } + if value != "world" { + t.Fail() + } +} diff --git a/vendor/github.com/modern-go/concurrent/test.sh b/vendor/github.com/modern-go/concurrent/test.sh new file mode 100755 index 000000000..d1e6b2ec5 --- /dev/null +++ b/vendor/github.com/modern-go/concurrent/test.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -e +echo "" > coverage.txt + +for d in $(go list ./... | grep -v vendor); do + go test -coverprofile=profile.out -coverpkg=github.com/modern-go/concurrent $d + if [ -f profile.out ]; then + cat profile.out >> coverage.txt + rm profile.out + fi +done diff --git a/vendor/github.com/modern-go/concurrent/unbounded_executor.go b/vendor/github.com/modern-go/concurrent/unbounded_executor.go new file mode 100644 index 000000000..31f52a9eb --- /dev/null +++ b/vendor/github.com/modern-go/concurrent/unbounded_executor.go @@ -0,0 +1,120 @@ +package concurrent + +import ( + "context" + "fmt" + "runtime" + "runtime/debug" + "sync" + "time" + "reflect" +) + +// HandlePanic logs goroutine panic by default +var HandlePanic = func(recovered interface{}, funcName string) { + ErrorLogger.Println(fmt.Sprintf("%s panic: %v", funcName, recovered)) + ErrorLogger.Println(string(debug.Stack())) +} + +// StopSignal will not be recovered, will propagate to upper level goroutine +const StopSignal = "STOP!" + +// UnboundedExecutor is a executor without limits on counts of alive goroutines +// it tracks the goroutine started by it, and can cancel them when shutdown +type UnboundedExecutor struct { + ctx context.Context + cancel context.CancelFunc + activeGoroutinesMutex *sync.Mutex + activeGoroutines map[string]int + HandlePanic func(recovered interface{}, funcName string) +} + +// GlobalUnboundedExecutor has the life cycle of the program itself +// any goroutine want to be shutdown before main exit can be started from this executor +// GlobalUnboundedExecutor expects the main function to call stop +// it does not magically knows the main function exits +var GlobalUnboundedExecutor = NewUnboundedExecutor() + +// NewUnboundedExecutor creates a new UnboundedExecutor, +// UnboundedExecutor can not be created by &UnboundedExecutor{} +// HandlePanic can be set with a callback to override global HandlePanic +func NewUnboundedExecutor() *UnboundedExecutor { + ctx, cancel := context.WithCancel(context.TODO()) + return &UnboundedExecutor{ + ctx: ctx, + cancel: cancel, + activeGoroutinesMutex: &sync.Mutex{}, + activeGoroutines: map[string]int{}, + } +} + +// Go starts a new goroutine and tracks its lifecycle. +// Panic will be recovered and logged automatically, except for StopSignal +func (executor *UnboundedExecutor) Go(handler func(ctx context.Context)) { + pc := reflect.ValueOf(handler).Pointer() + f := runtime.FuncForPC(pc) + funcName := f.Name() + file, line := f.FileLine(pc) + executor.activeGoroutinesMutex.Lock() + defer executor.activeGoroutinesMutex.Unlock() + startFrom := fmt.Sprintf("%s:%d", file, line) + executor.activeGoroutines[startFrom] += 1 + go func() { + defer func() { + recovered := recover() + if recovered != nil && recovered != StopSignal { + if executor.HandlePanic == nil { + HandlePanic(recovered, funcName) + } else { + executor.HandlePanic(recovered, funcName) + } + } + executor.activeGoroutinesMutex.Lock() + defer executor.activeGoroutinesMutex.Unlock() + executor.activeGoroutines[startFrom] -= 1 + }() + handler(executor.ctx) + }() +} + +// Stop cancel all goroutines started by this executor without wait +func (executor *UnboundedExecutor) Stop() { + executor.cancel() +} + +// StopAndWaitForever cancel all goroutines started by this executor and +// wait until all goroutines exited +func (executor *UnboundedExecutor) StopAndWaitForever() { + executor.StopAndWait(context.Background()) +} + +// StopAndWait cancel all goroutines started by this executor and wait. +// Wait can be cancelled by the context passed in. +func (executor *UnboundedExecutor) StopAndWait(ctx context.Context) { + executor.cancel() + for { + fiveSeconds := time.NewTimer(time.Millisecond * 100) + select { + case <-fiveSeconds.C: + case <-ctx.Done(): + return + } + if executor.checkGoroutines() { + return + } + } +} + +func (executor *UnboundedExecutor) checkGoroutines() bool { + executor.activeGoroutinesMutex.Lock() + defer executor.activeGoroutinesMutex.Unlock() + for startFrom, count := range executor.activeGoroutines { + if count > 0 { + InfoLogger.Println("event!unbounded_executor.still waiting goroutines to quit", + "startFrom", startFrom, + "count", count) + return false + } + } + return true +} diff --git a/vendor/github.com/modern-go/concurrent/unbounded_executor_test.go b/vendor/github.com/modern-go/concurrent/unbounded_executor_test.go new file mode 100644 index 000000000..dbd89904f --- /dev/null +++ b/vendor/github.com/modern-go/concurrent/unbounded_executor_test.go @@ -0,0 +1,54 @@ +package concurrent_test + +import ( + "context" + "fmt" + "time" + "github.com/modern-go/concurrent" +) + +func ExampleUnboundedExecutor_Go() { + executor := concurrent.NewUnboundedExecutor() + executor.Go(func(ctx context.Context) { + fmt.Println("abc") + }) + time.Sleep(time.Second) + // output: abc +} + +func ExampleUnboundedExecutor_StopAndWaitForever() { + executor := concurrent.NewUnboundedExecutor() + executor.Go(func(ctx context.Context) { + everyMillisecond := time.NewTicker(time.Millisecond) + for { + select { + case <-ctx.Done(): + fmt.Println("goroutine exited") + return + case <-everyMillisecond.C: + // do something + } + } + }) + time.Sleep(time.Second) + executor.StopAndWaitForever() + fmt.Println("exectuor stopped") + // output: + // goroutine exited + // exectuor stopped +} + +func ExampleUnboundedExecutor_Go_panic() { + concurrent.HandlePanic = func(recovered interface{}, funcName string) { + fmt.Println(funcName) + } + executor := concurrent.NewUnboundedExecutor() + executor.Go(willPanic) + time.Sleep(time.Second) + // output: + // github.com/modern-go/concurrent_test.willPanic +} + +func willPanic(ctx context.Context) { + panic("!!!") +} diff --git a/vendor/github.com/modern-go/reflect2/.gitignore b/vendor/github.com/modern-go/reflect2/.gitignore new file mode 100644 index 000000000..61ead8666 --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/.gitignore @@ -0,0 +1 @@ +/vendor diff --git a/vendor/github.com/modern-go/reflect2/Gopkg.lock b/vendor/github.com/modern-go/reflect2/Gopkg.lock new file mode 100644 index 000000000..2a3a69893 --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/Gopkg.lock @@ -0,0 +1,15 @@ +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + + +[[projects]] + name = "github.com/modern-go/concurrent" + packages = ["."] + revision = "e0a39a4cb4216ea8db28e22a69f4ec25610d513a" + version = "1.0.0" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-digest = "daee8a88b3498b61c5640056665b8b9eea062006f5e596bbb6a3ed9119a11ec7" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/vendor/github.com/modern-go/reflect2/Gopkg.toml b/vendor/github.com/modern-go/reflect2/Gopkg.toml new file mode 100644 index 000000000..3593fd041 --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/Gopkg.toml @@ -0,0 +1,35 @@ +# Gopkg.toml example +# +# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html +# for detailed Gopkg.toml documentation. +# +# required = ["github.com/user/thing/cmd/thing"] +# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] +# +# [[constraint]] +# name = "github.com/user/project" +# version = "1.0.0" +# +# [[constraint]] +# name = "github.com/user/project2" +# branch = "dev" +# source = "github.com/myfork/project2" +# +# [[override]] +# name = "github.com/x/y" +# version = "2.4.0" +# +# [prune] +# non-go = false +# go-tests = true +# unused-packages = true + +ignored = ["github.com/modern-go/test","github.com/modern-go/test/must","github.com/modern-go/test/should"] + +[[constraint]] + name = "github.com/modern-go/concurrent" + version = "1.0.0" + +[prune] + go-tests = true + unused-packages = true diff --git a/vendor/github.com/modern-go/reflect2/LICENSE b/vendor/github.com/modern-go/reflect2/LICENSE new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/modern-go/reflect2/README.md b/vendor/github.com/modern-go/reflect2/README.md new file mode 100644 index 000000000..6b429efdd --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/README.md @@ -0,0 +1,2 @@ +# reflect2 +reflect api that avoids runtime reflect.Value cost diff --git a/vendor/github.com/modern-go/reflect2/go_above_17.go b/vendor/github.com/modern-go/reflect2/go_above_17.go new file mode 100644 index 000000000..5c1cea868 --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/go_above_17.go @@ -0,0 +1,8 @@ +//+build go1.7 + +package reflect2 + +import "unsafe" + +//go:linkname resolveTypeOff reflect.resolveTypeOff +func resolveTypeOff(rtype unsafe.Pointer, off int32) unsafe.Pointer diff --git a/vendor/github.com/modern-go/reflect2/go_above_19.go b/vendor/github.com/modern-go/reflect2/go_above_19.go new file mode 100644 index 000000000..c7e3b7801 --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/go_above_19.go @@ -0,0 +1,14 @@ +//+build go1.9 + +package reflect2 + +import ( + "unsafe" +) + +//go:linkname makemap reflect.makemap +func makemap(rtype unsafe.Pointer, cap int) (m unsafe.Pointer) + +func makeMapWithSize(rtype unsafe.Pointer, cap int) unsafe.Pointer { + return makemap(rtype, cap) +} diff --git a/vendor/github.com/modern-go/reflect2/go_below_17.go b/vendor/github.com/modern-go/reflect2/go_below_17.go new file mode 100644 index 000000000..81142317a --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/go_below_17.go @@ -0,0 +1,9 @@ +//+build !go1.7 + +package reflect2 + +import "unsafe" + +func resolveTypeOff(rtype unsafe.Pointer, off int32) unsafe.Pointer { + return nil +} \ No newline at end of file diff --git a/vendor/github.com/modern-go/reflect2/go_below_19.go b/vendor/github.com/modern-go/reflect2/go_below_19.go new file mode 100644 index 000000000..b050ef70c --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/go_below_19.go @@ -0,0 +1,14 @@ +//+build !go1.9 + +package reflect2 + +import ( + "unsafe" +) + +//go:linkname makemap reflect.makemap +func makemap(rtype unsafe.Pointer) (m unsafe.Pointer) + +func makeMapWithSize(rtype unsafe.Pointer, cap int) unsafe.Pointer { + return makemap(rtype) +} diff --git a/vendor/github.com/modern-go/reflect2/reflect2.go b/vendor/github.com/modern-go/reflect2/reflect2.go new file mode 100644 index 000000000..feabb610d --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/reflect2.go @@ -0,0 +1,282 @@ +package reflect2 + +import ( + "reflect" + "unsafe" + "github.com/modern-go/concurrent" +) + +type Type interface { + Kind() reflect.Kind + // New return pointer to data of this type + New() interface{} + // UnsafeNew return the allocated space pointed by unsafe.Pointer + UnsafeNew() unsafe.Pointer + // PackEFace cast a unsafe pointer to object represented pointer + PackEFace(ptr unsafe.Pointer) interface{} + // Indirect dereference object represented pointer to this type + Indirect(obj interface{}) interface{} + // UnsafeIndirect dereference pointer to this type + UnsafeIndirect(ptr unsafe.Pointer) interface{} + // Type1 returns reflect.Type + Type1() reflect.Type + Implements(thatType Type) bool + String() string + RType() uintptr + // interface{} of this type has pointer like behavior + LikePtr() bool + IsNullable() bool + IsNil(obj interface{}) bool + UnsafeIsNil(ptr unsafe.Pointer) bool + Set(obj interface{}, val interface{}) + UnsafeSet(ptr unsafe.Pointer, val unsafe.Pointer) + AssignableTo(anotherType Type) bool +} + +type ListType interface { + Type + Elem() Type + SetIndex(obj interface{}, index int, elem interface{}) + UnsafeSetIndex(obj unsafe.Pointer, index int, elem unsafe.Pointer) + GetIndex(obj interface{}, index int) interface{} + UnsafeGetIndex(obj unsafe.Pointer, index int) unsafe.Pointer +} + +type ArrayType interface { + ListType + Len() int +} + +type SliceType interface { + ListType + MakeSlice(length int, cap int) interface{} + UnsafeMakeSlice(length int, cap int) unsafe.Pointer + Grow(obj interface{}, newLength int) + UnsafeGrow(ptr unsafe.Pointer, newLength int) + Append(obj interface{}, elem interface{}) + UnsafeAppend(obj unsafe.Pointer, elem unsafe.Pointer) + LengthOf(obj interface{}) int + UnsafeLengthOf(ptr unsafe.Pointer) int + SetNil(obj interface{}) + UnsafeSetNil(ptr unsafe.Pointer) + Cap(obj interface{}) int + UnsafeCap(ptr unsafe.Pointer) int +} + +type StructType interface { + Type + NumField() int + Field(i int) StructField + FieldByName(name string) StructField + FieldByIndex(index []int) StructField + FieldByNameFunc(match func(string) bool) StructField +} + +type StructField interface { + Offset() uintptr + Name() string + PkgPath() string + Type() Type + Tag() reflect.StructTag + Index() []int + Anonymous() bool + Set(obj interface{}, value interface{}) + UnsafeSet(obj unsafe.Pointer, value unsafe.Pointer) + Get(obj interface{}) interface{} + UnsafeGet(obj unsafe.Pointer) unsafe.Pointer +} + +type MapType interface { + Type + Key() Type + Elem() Type + MakeMap(cap int) interface{} + UnsafeMakeMap(cap int) unsafe.Pointer + SetIndex(obj interface{}, key interface{}, elem interface{}) + UnsafeSetIndex(obj unsafe.Pointer, key unsafe.Pointer, elem unsafe.Pointer) + TryGetIndex(obj interface{}, key interface{}) (interface{}, bool) + GetIndex(obj interface{}, key interface{}) interface{} + UnsafeGetIndex(obj unsafe.Pointer, key unsafe.Pointer) unsafe.Pointer + Iterate(obj interface{}) MapIterator + UnsafeIterate(obj unsafe.Pointer) MapIterator +} + +type MapIterator interface { + HasNext() bool + Next() (key interface{}, elem interface{}) + UnsafeNext() (key unsafe.Pointer, elem unsafe.Pointer) +} + +type PtrType interface { + Type + Elem() Type +} + +type InterfaceType interface { + NumMethod() int +} + +type Config struct { + UseSafeImplementation bool +} + +type API interface { + TypeOf(obj interface{}) Type + Type2(type1 reflect.Type) Type +} + +var ConfigUnsafe = Config{UseSafeImplementation: false}.Froze() +var ConfigSafe = Config{UseSafeImplementation: true}.Froze() + +type frozenConfig struct { + useSafeImplementation bool + cache *concurrent.Map +} + +func (cfg Config) Froze() *frozenConfig { + return &frozenConfig{ + useSafeImplementation: cfg.UseSafeImplementation, + cache: concurrent.NewMap(), + } +} + +func (cfg *frozenConfig) TypeOf(obj interface{}) Type { + cacheKey := uintptr(unpackEFace(obj).rtype) + typeObj, found := cfg.cache.Load(cacheKey) + if found { + return typeObj.(Type) + } + return cfg.Type2(reflect.TypeOf(obj)) +} + +func (cfg *frozenConfig) Type2(type1 reflect.Type) Type { + cacheKey := uintptr(unpackEFace(type1).data) + typeObj, found := cfg.cache.Load(cacheKey) + if found { + return typeObj.(Type) + } + type2 := cfg.wrapType(type1) + cfg.cache.Store(cacheKey, type2) + return type2 +} + +func (cfg *frozenConfig) wrapType(type1 reflect.Type) Type { + safeType := safeType{Type: type1, cfg: cfg} + switch type1.Kind() { + case reflect.Struct: + if cfg.useSafeImplementation { + return &safeStructType{safeType} + } + return newUnsafeStructType(cfg, type1) + case reflect.Array: + if cfg.useSafeImplementation { + return &safeSliceType{safeType} + } + return newUnsafeArrayType(cfg, type1) + case reflect.Slice: + if cfg.useSafeImplementation { + return &safeSliceType{safeType} + } + return newUnsafeSliceType(cfg, type1) + case reflect.Map: + if cfg.useSafeImplementation { + return &safeMapType{safeType} + } + return newUnsafeMapType(cfg, type1) + case reflect.Ptr, reflect.Chan, reflect.Func: + if cfg.useSafeImplementation { + return &safeMapType{safeType} + } + return newUnsafePtrType(cfg, type1) + case reflect.Interface: + if cfg.useSafeImplementation { + return &safeMapType{safeType} + } + if type1.NumMethod() == 0 { + return newUnsafeEFaceType(cfg, type1) + } + return newUnsafeIFaceType(cfg, type1) + default: + if cfg.useSafeImplementation { + return &safeType + } + return newUnsafeType(cfg, type1) + } +} + +func TypeOf(obj interface{}) Type { + return ConfigUnsafe.TypeOf(obj) +} + +func TypeOfPtr(obj interface{}) PtrType { + return TypeOf(obj).(PtrType) +} + +func Type2(type1 reflect.Type) Type { + return ConfigUnsafe.Type2(type1) +} + +func PtrTo(typ Type) Type { + return Type2(reflect.PtrTo(typ.Type1())) +} + +func PtrOf(obj interface{}) unsafe.Pointer { + return unpackEFace(obj).data +} + +func RTypeOf(obj interface{}) uintptr { + return uintptr(unpackEFace(obj).rtype) +} + +func IsNil(obj interface{}) bool { + if obj == nil { + return true + } + return unpackEFace(obj).data == nil +} + +func IsNullable(kind reflect.Kind) bool { + switch kind { + case reflect.Ptr, reflect.Map, reflect.Chan, reflect.Func, reflect.Slice, reflect.Interface: + return true + } + return false +} + +func likePtrKind(kind reflect.Kind) bool { + switch kind { + case reflect.Ptr, reflect.Map, reflect.Chan, reflect.Func: + return true + } + return false +} + +func likePtrType(typ reflect.Type) bool { + if likePtrKind(typ.Kind()) { + return true + } + if typ.Kind() == reflect.Struct { + if typ.NumField() != 1 { + return false + } + return likePtrType(typ.Field(0).Type) + } + if typ.Kind() == reflect.Array { + if typ.Len() != 1 { + return false + } + return likePtrType(typ.Elem()) + } + return false +} + +// NoEscape hides a pointer from escape analysis. noescape is +// the identity function but escape analysis doesn't think the +// output depends on the input. noescape is inlined and currently +// compiles down to zero instructions. +// USE CAREFULLY! +//go:nosplit +func NoEscape(p unsafe.Pointer) unsafe.Pointer { + x := uintptr(p) + return unsafe.Pointer(x ^ 0) +} \ No newline at end of file diff --git a/vendor/google.golang.org/grpc/.please-update b/vendor/github.com/modern-go/reflect2/reflect2_amd64.s similarity index 100% rename from vendor/google.golang.org/grpc/.please-update rename to vendor/github.com/modern-go/reflect2/reflect2_amd64.s diff --git a/vendor/github.com/modern-go/reflect2/reflect2_kind.go b/vendor/github.com/modern-go/reflect2/reflect2_kind.go new file mode 100644 index 000000000..f13cbe13d --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/reflect2_kind.go @@ -0,0 +1,30 @@ +package reflect2 + +import ( + "reflect" + "unsafe" +) + +// DefaultTypeOfKind return the non aliased default type for the kind +func DefaultTypeOfKind(kind reflect.Kind) Type { + return kindTypes[kind] +} + +var kindTypes = map[reflect.Kind]Type{ + reflect.Bool: TypeOf(true), + reflect.Uint8: TypeOf(uint8(0)), + reflect.Int8: TypeOf(int8(0)), + reflect.Uint16: TypeOf(uint16(0)), + reflect.Int16: TypeOf(int16(0)), + reflect.Uint32: TypeOf(uint32(0)), + reflect.Int32: TypeOf(int32(0)), + reflect.Uint64: TypeOf(uint64(0)), + reflect.Int64: TypeOf(int64(0)), + reflect.Uint: TypeOf(uint(0)), + reflect.Int: TypeOf(int(0)), + reflect.Float32: TypeOf(float32(0)), + reflect.Float64: TypeOf(float64(0)), + reflect.Uintptr: TypeOf(uintptr(0)), + reflect.String: TypeOf(""), + reflect.UnsafePointer: TypeOf(unsafe.Pointer(nil)), +} \ No newline at end of file diff --git a/vendor/github.com/modern-go/reflect2/relfect2_386.s b/vendor/github.com/modern-go/reflect2/relfect2_386.s new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/modern-go/reflect2/relfect2_amd64p32.s b/vendor/github.com/modern-go/reflect2/relfect2_amd64p32.s new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/modern-go/reflect2/relfect2_arm.s b/vendor/github.com/modern-go/reflect2/relfect2_arm.s new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/modern-go/reflect2/relfect2_arm64.s b/vendor/github.com/modern-go/reflect2/relfect2_arm64.s new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/modern-go/reflect2/relfect2_mips64x.s b/vendor/github.com/modern-go/reflect2/relfect2_mips64x.s new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/modern-go/reflect2/relfect2_mipsx.s b/vendor/github.com/modern-go/reflect2/relfect2_mipsx.s new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/modern-go/reflect2/relfect2_ppc64x.s b/vendor/github.com/modern-go/reflect2/relfect2_ppc64x.s new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/modern-go/reflect2/relfect2_s390x.s b/vendor/github.com/modern-go/reflect2/relfect2_s390x.s new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/modern-go/reflect2/safe_field.go b/vendor/github.com/modern-go/reflect2/safe_field.go new file mode 100644 index 000000000..f68de456a --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/safe_field.go @@ -0,0 +1,58 @@ +package reflect2 + +import ( + "reflect" + "unsafe" +) + +type safeField struct { + reflect.StructField +} + +func (field *safeField) Offset() uintptr { + return field.StructField.Offset +} + +func (field *safeField) Name() string { + return field.StructField.Name +} + +func (field *safeField) PkgPath() string { + return field.StructField.PkgPath +} + +func (field *safeField) Type() Type { + panic("not implemented") +} + +func (field *safeField) Tag() reflect.StructTag { + return field.StructField.Tag +} + +func (field *safeField) Index() []int { + return field.StructField.Index +} + +func (field *safeField) Anonymous() bool { + return field.StructField.Anonymous +} + +func (field *safeField) Set(obj interface{}, value interface{}) { + val := reflect.ValueOf(obj).Elem() + val.FieldByIndex(field.Index()).Set(reflect.ValueOf(value).Elem()) +} + +func (field *safeField) UnsafeSet(obj unsafe.Pointer, value unsafe.Pointer) { + panic("unsafe operation is not supported") +} + +func (field *safeField) Get(obj interface{}) interface{} { + val := reflect.ValueOf(obj).Elem().FieldByIndex(field.Index()) + ptr := reflect.New(val.Type()) + ptr.Elem().Set(val) + return ptr.Interface() +} + +func (field *safeField) UnsafeGet(obj unsafe.Pointer) unsafe.Pointer { + panic("does not support unsafe operation") +} \ No newline at end of file diff --git a/vendor/github.com/modern-go/reflect2/safe_map.go b/vendor/github.com/modern-go/reflect2/safe_map.go new file mode 100644 index 000000000..6a1ba23d5 --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/safe_map.go @@ -0,0 +1,101 @@ +package reflect2 + +import ( + "reflect" + "unsafe" +) + +type safeMapType struct { + safeType +} + +func (type2 *safeMapType) Key() Type { + return type2.safeType.cfg.Type2(type2.Type.Key()) +} + +func (type2 *safeMapType) MakeMap(cap int) interface{} { + ptr := reflect.New(type2.Type) + ptr.Elem().Set(reflect.MakeMap(type2.Type)) + return ptr.Interface() +} + +func (type2 *safeMapType) UnsafeMakeMap(cap int) unsafe.Pointer { + panic("does not support unsafe operation") +} + +func (type2 *safeMapType) SetIndex(obj interface{}, key interface{}, elem interface{}) { + keyVal := reflect.ValueOf(key) + elemVal := reflect.ValueOf(elem) + val := reflect.ValueOf(obj) + val.Elem().SetMapIndex(keyVal.Elem(), elemVal.Elem()) +} + +func (type2 *safeMapType) UnsafeSetIndex(obj unsafe.Pointer, key unsafe.Pointer, elem unsafe.Pointer) { + panic("does not support unsafe operation") +} + +func (type2 *safeMapType) TryGetIndex(obj interface{}, key interface{}) (interface{}, bool) { + keyVal := reflect.ValueOf(key) + if key == nil { + keyVal = reflect.New(type2.Type.Key()).Elem() + } + val := reflect.ValueOf(obj).MapIndex(keyVal) + if !val.IsValid() { + return nil, false + } + return val.Interface(), true +} + +func (type2 *safeMapType) GetIndex(obj interface{}, key interface{}) interface{} { + val := reflect.ValueOf(obj).Elem() + keyVal := reflect.ValueOf(key).Elem() + elemVal := val.MapIndex(keyVal) + if !elemVal.IsValid() { + ptr := reflect.New(reflect.PtrTo(val.Type().Elem())) + return ptr.Elem().Interface() + } + ptr := reflect.New(elemVal.Type()) + ptr.Elem().Set(elemVal) + return ptr.Interface() +} + +func (type2 *safeMapType) UnsafeGetIndex(obj unsafe.Pointer, key unsafe.Pointer) unsafe.Pointer { + panic("does not support unsafe operation") +} + +func (type2 *safeMapType) Iterate(obj interface{}) MapIterator { + m := reflect.ValueOf(obj).Elem() + return &safeMapIterator{ + m: m, + keys: m.MapKeys(), + } +} + +func (type2 *safeMapType) UnsafeIterate(obj unsafe.Pointer) MapIterator { + panic("does not support unsafe operation") +} + +type safeMapIterator struct { + i int + m reflect.Value + keys []reflect.Value +} + +func (iter *safeMapIterator) HasNext() bool { + return iter.i != len(iter.keys) +} + +func (iter *safeMapIterator) Next() (interface{}, interface{}) { + key := iter.keys[iter.i] + elem := iter.m.MapIndex(key) + iter.i += 1 + keyPtr := reflect.New(key.Type()) + keyPtr.Elem().Set(key) + elemPtr := reflect.New(elem.Type()) + elemPtr.Elem().Set(elem) + return keyPtr.Interface(), elemPtr.Interface() +} + +func (iter *safeMapIterator) UnsafeNext() (unsafe.Pointer, unsafe.Pointer) { + panic("does not support unsafe operation") +} \ No newline at end of file diff --git a/vendor/github.com/modern-go/reflect2/safe_slice.go b/vendor/github.com/modern-go/reflect2/safe_slice.go new file mode 100644 index 000000000..7e348c1ac --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/safe_slice.go @@ -0,0 +1,92 @@ +package reflect2 + +import ( + "reflect" + "unsafe" +) + +type safeSliceType struct { + safeType +} + +func (type2 *safeSliceType) SetIndex(obj interface{}, index int, value interface{}) { + val := reflect.ValueOf(obj).Elem() + elem := reflect.ValueOf(value).Elem() + val.Index(index).Set(elem) +} + +func (type2 *safeSliceType) UnsafeSetIndex(obj unsafe.Pointer, index int, value unsafe.Pointer) { + panic("does not support unsafe operation") +} + +func (type2 *safeSliceType) GetIndex(obj interface{}, index int) interface{} { + val := reflect.ValueOf(obj).Elem() + elem := val.Index(index) + ptr := reflect.New(elem.Type()) + ptr.Elem().Set(elem) + return ptr.Interface() +} + +func (type2 *safeSliceType) UnsafeGetIndex(obj unsafe.Pointer, index int) unsafe.Pointer { + panic("does not support unsafe operation") +} + +func (type2 *safeSliceType) MakeSlice(length int, cap int) interface{} { + val := reflect.MakeSlice(type2.Type, length, cap) + ptr := reflect.New(val.Type()) + ptr.Elem().Set(val) + return ptr.Interface() +} + +func (type2 *safeSliceType) UnsafeMakeSlice(length int, cap int) unsafe.Pointer { + panic("does not support unsafe operation") +} + +func (type2 *safeSliceType) Grow(obj interface{}, newLength int) { + oldCap := type2.Cap(obj) + oldSlice := reflect.ValueOf(obj).Elem() + delta := newLength - oldCap + deltaVals := make([]reflect.Value, delta) + newSlice := reflect.Append(oldSlice, deltaVals...) + oldSlice.Set(newSlice) +} + +func (type2 *safeSliceType) UnsafeGrow(ptr unsafe.Pointer, newLength int) { + panic("does not support unsafe operation") +} + +func (type2 *safeSliceType) Append(obj interface{}, elem interface{}) { + val := reflect.ValueOf(obj).Elem() + elemVal := reflect.ValueOf(elem).Elem() + newVal := reflect.Append(val, elemVal) + val.Set(newVal) +} + +func (type2 *safeSliceType) UnsafeAppend(obj unsafe.Pointer, elem unsafe.Pointer) { + panic("does not support unsafe operation") +} + +func (type2 *safeSliceType) SetNil(obj interface{}) { + val := reflect.ValueOf(obj).Elem() + val.Set(reflect.Zero(val.Type())) +} + +func (type2 *safeSliceType) UnsafeSetNil(ptr unsafe.Pointer) { + panic("does not support unsafe operation") +} + +func (type2 *safeSliceType) LengthOf(obj interface{}) int { + return reflect.ValueOf(obj).Elem().Len() +} + +func (type2 *safeSliceType) UnsafeLengthOf(ptr unsafe.Pointer) int { + panic("does not support unsafe operation") +} + +func (type2 *safeSliceType) Cap(obj interface{}) int { + return reflect.ValueOf(obj).Elem().Cap() +} + +func (type2 *safeSliceType) UnsafeCap(ptr unsafe.Pointer) int { + panic("does not support unsafe operation") +} \ No newline at end of file diff --git a/vendor/github.com/modern-go/reflect2/safe_struct.go b/vendor/github.com/modern-go/reflect2/safe_struct.go new file mode 100644 index 000000000..d8eb45348 --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/safe_struct.go @@ -0,0 +1,13 @@ +package reflect2 + +type safeStructType struct { + safeType +} + +func (type2 *safeStructType) FieldByName(name string) StructField { + field, found := type2.Type.FieldByName(name) + if !found { + panic("field " + name + " not found") + } + return &safeField{StructField: field} +} \ No newline at end of file diff --git a/vendor/github.com/modern-go/reflect2/safe_type.go b/vendor/github.com/modern-go/reflect2/safe_type.go new file mode 100644 index 000000000..3cd6331ae --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/safe_type.go @@ -0,0 +1,78 @@ +package reflect2 + +import ( + "reflect" + "unsafe" +) + +type safeType struct { + reflect.Type + cfg *frozenConfig +} + +func (type2 *safeType) New() interface{} { + return reflect.New(type2.Type).Interface() +} + +func (type2 *safeType) UnsafeNew() unsafe.Pointer { + panic("does not support unsafe operation") +} + +func (type2 *safeType) Elem() Type { + return type2.cfg.Type2(type2.Type.Elem()) +} + +func (type2 *safeType) Type1() reflect.Type { + return type2.Type +} + +func (type2 *safeType) PackEFace(ptr unsafe.Pointer) interface{} { + panic("does not support unsafe operation") +} + +func (type2 *safeType) Implements(thatType Type) bool { + return type2.Type.Implements(thatType.Type1()) +} + +func (type2 *safeType) RType() uintptr { + panic("does not support unsafe operation") +} + +func (type2 *safeType) Indirect(obj interface{}) interface{} { + return reflect.Indirect(reflect.ValueOf(obj)).Interface() +} + +func (type2 *safeType) UnsafeIndirect(ptr unsafe.Pointer) interface{} { + panic("does not support unsafe operation") +} + +func (type2 *safeType) LikePtr() bool { + panic("does not support unsafe operation") +} + +func (type2 *safeType) IsNullable() bool { + return IsNullable(type2.Kind()) +} + +func (type2 *safeType) IsNil(obj interface{}) bool { + if obj == nil { + return true + } + return reflect.ValueOf(obj).Elem().IsNil() +} + +func (type2 *safeType) UnsafeIsNil(ptr unsafe.Pointer) bool { + panic("does not support unsafe operation") +} + +func (type2 *safeType) Set(obj interface{}, val interface{}) { + reflect.ValueOf(obj).Elem().Set(reflect.ValueOf(val).Elem()) +} + +func (type2 *safeType) UnsafeSet(ptr unsafe.Pointer, val unsafe.Pointer) { + panic("does not support unsafe operation") +} + +func (type2 *safeType) AssignableTo(anotherType Type) bool { + return type2.Type1().AssignableTo(anotherType.Type1()) +} \ No newline at end of file diff --git a/vendor/github.com/modern-go/reflect2/test15/map_test.go b/vendor/github.com/modern-go/reflect2/test15/map_test.go new file mode 100644 index 000000000..11b3964df --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/test15/map_test.go @@ -0,0 +1,18 @@ +package test + +import ( + "testing" + "github.com/modern-go/reflect2" +) + +func Test_map(t *testing.T) { + var pInt = func(val int) *int { + return &val + } + valType := reflect2.TypeOf(map[int]int{}).(reflect2.MapType) + m := map[int]int{} + valType.SetIndex(&m, pInt(1), pInt(1)) + if m[1] != 1 { + t.Fail() + } +} \ No newline at end of file diff --git a/vendor/github.com/modern-go/reflect2/tests/array_test.go b/vendor/github.com/modern-go/reflect2/tests/array_test.go new file mode 100644 index 000000000..8c91098df --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/tests/array_test.go @@ -0,0 +1,38 @@ +package tests + +import ( + "testing" + "github.com/modern-go/reflect2" +) + +func Test_array(t *testing.T) { + var pInt = func(val int) *int { + return &val + } + t.Run("New", testOp(func(api reflect2.API) interface{} { + valType := api.TypeOf([2]int{}) + obj := valType.New() + (*(obj.(*[2]int)))[0] = 100 + (*(obj.(*[2]int)))[1] = 200 + return obj + })) + t.Run("Indirect", testOp(func(api reflect2.API) interface{} { + valType := api.TypeOf([2]int{}) + return valType.Indirect(&[2]int{}) + })) + t.Run("SetIndex", testOp(func(api reflect2.API) interface{} { + obj := [2]int{} + valType := api.TypeOf(obj).(reflect2.ArrayType) + valType.SetIndex(&obj, 0, pInt(100)) + valType.SetIndex(&obj, 1, pInt(200)) + return obj + })) + t.Run("GetIndex", testOp(func(api reflect2.API) interface{} { + obj := [2]int{1, 2} + valType := api.TypeOf(obj).(reflect2.ArrayType) + return []interface{} { + valType.GetIndex(&obj, 0), + valType.GetIndex(&obj, 1), + } + })) +} diff --git a/vendor/github.com/modern-go/reflect2/tests/int_test.go b/vendor/github.com/modern-go/reflect2/tests/int_test.go new file mode 100644 index 000000000..7fd60e48b --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/tests/int_test.go @@ -0,0 +1,41 @@ +package tests + +import ( + "testing" + "github.com/modern-go/reflect2" + "github.com/modern-go/test" + "unsafe" + "github.com/modern-go/test/must" + "context" +) + +func Test_int(t *testing.T) { + t.Run("New", testOp(func(api reflect2.API) interface{} { + valType := api.TypeOf(1) + obj := valType.New() + *obj.(*int) = 100 + return obj + })) + t.Run("PackEFace", test.Case(func(ctx context.Context) { + valType := reflect2.TypeOf(1) + hundred := 100 + must.Equal(&hundred, valType.PackEFace(unsafe.Pointer(&hundred))) + })) + t.Run("Indirect", test.Case(func(ctx context.Context) { + valType := reflect2.TypeOf(1) + hundred := 100 + must.Equal(100, valType.Indirect(&hundred)) + })) + t.Run("Indirect", test.Case(func(ctx context.Context) { + valType := reflect2.TypeOf(1) + hundred := 100 + must.Equal(100, valType.UnsafeIndirect(unsafe.Pointer(&hundred))) + })) + t.Run("Set", testOp(func(api reflect2.API) interface{} { + valType := api.TypeOf(1) + i := 1 + j := 10 + valType.Set(&i, &j) + return i + })) +} diff --git a/vendor/github.com/modern-go/reflect2/tests/map_elem_array_test.go b/vendor/github.com/modern-go/reflect2/tests/map_elem_array_test.go new file mode 100644 index 000000000..607f6244e --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/tests/map_elem_array_test.go @@ -0,0 +1,44 @@ +package tests + +import ( + "testing" + "github.com/modern-go/reflect2" +) + +func Test_map_elem_array(t *testing.T) { + t.Run("SetIndex", testOp(func(api reflect2.API) interface{} { + obj := map[int][2]*int{} + valType := api.TypeOf(obj).(reflect2.MapType) + valType.SetIndex(obj, 2, [2]*int{(*int)(reflect2.PtrOf(1)), (*int)(reflect2.PtrOf(2))}) + valType.SetIndex(obj, 3, [2]*int{(*int)(reflect2.PtrOf(3)), (*int)(reflect2.PtrOf(4))}) + return obj + })) + t.Run("SetIndex zero length array", testOp(func(api reflect2.API) interface{} { + obj := map[int][0]*int{} + valType := api.TypeOf(obj).(reflect2.MapType) + valType.SetIndex(obj, 2, [0]*int{}) + valType.SetIndex(obj, 3, [0]*int{}) + return obj + })) + t.Run("SetIndex single ptr array", testOp(func(api reflect2.API) interface{} { + obj := map[int][1]*int{} + valType := api.TypeOf(obj).(reflect2.MapType) + valType.SetIndex(obj, 2, [1]*int{(*int)(reflect2.PtrOf(1))}) + valType.SetIndex(obj, 3, [1]*int{}) + return obj + })) + t.Run("SetIndex single chan array", testOp(func(api reflect2.API) interface{} { + obj := map[int][1]chan int{} + valType := api.TypeOf(obj).(reflect2.MapType) + valType.SetIndex(obj, 2, [1]chan int{}) + valType.SetIndex(obj, 3, [1]chan int{}) + return obj + })) + t.Run("SetIndex single func array", testOp(func(api reflect2.API) interface{} { + obj := map[int][1]func(){} + valType := api.TypeOf(obj).(reflect2.MapType) + valType.SetIndex(obj, 2, [1]func(){}) + valType.SetIndex(obj, 3, [1]func(){}) + return obj + })) +} diff --git a/vendor/github.com/modern-go/reflect2/tests/map_elem_bytes_test.go b/vendor/github.com/modern-go/reflect2/tests/map_elem_bytes_test.go new file mode 100644 index 000000000..d6d894e8f --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/tests/map_elem_bytes_test.go @@ -0,0 +1,34 @@ +package tests + +import ( + "testing" + "github.com/modern-go/reflect2" + "github.com/modern-go/test" + "github.com/modern-go/test/must" + "context" +) + +func Test_map_elem_bytes(t *testing.T) { + t.Run("SetIndex", testOp(func(api reflect2.API) interface{} { + obj := map[int][]byte{} + valType := api.TypeOf(obj).(reflect2.MapType) + valType.SetIndex(obj, 2, []byte("hello")) + valType.SetIndex(obj, 3, nil) + return obj + })) + t.Run("UnsafeSetIndex", test.Case(func(ctx context.Context) { + obj := map[int][]byte{} + valType := reflect2.TypeOf(obj).(reflect2.MapType) + hello := []byte("hello") + valType.UnsafeSetIndex(reflect2.PtrOf(obj), reflect2.PtrOf(2), reflect2.PtrOf(hello)) + valType.UnsafeSetIndex(reflect2.PtrOf(obj), reflect2.PtrOf(3), nil) + must.Equal([]byte("hello"), obj[2]) + must.Nil(obj[3]) + })) + t.Run("UnsafeGetIndex", test.Case(func(ctx context.Context) { + obj := map[int][]byte{2: []byte("hello")} + valType := reflect2.TypeOf(obj).(reflect2.MapType) + elem := valType.UnsafeGetIndex(reflect2.PtrOf(obj), reflect2.PtrOf(2)) + must.Equal([]byte("hello"), valType.Elem().PackEFace(elem)) + })) +} diff --git a/vendor/github.com/modern-go/reflect2/tests/map_elem_eface_test.go b/vendor/github.com/modern-go/reflect2/tests/map_elem_eface_test.go new file mode 100644 index 000000000..d6cd51ea3 --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/tests/map_elem_eface_test.go @@ -0,0 +1,51 @@ +package tests + +import ( + "testing" + "github.com/modern-go/reflect2" + "github.com/modern-go/test/must" + + "github.com/modern-go/test" + "context" +) + +func Test_map_elem_eface(t *testing.T) { + t.Run("SetIndex", testOp(func(api reflect2.API) interface{} { + obj := map[int]interface{}{} + valType := api.TypeOf(obj).(reflect2.MapType) + valType.SetIndex(obj, 2, 4) + valType.SetIndex(obj, 3, nil) + return obj + })) + t.Run("GetIndex", testOp(func(api reflect2.API) interface{} { + obj := map[int]interface{}{3: 9, 2: nil} + valType := api.TypeOf(obj).(reflect2.MapType) + return []interface{}{ + valType.GetIndex(obj, 3), + valType.GetIndex(obj, 2), + valType.GetIndex(obj, 0), + } + })) + t.Run("TryGetIndex", test.Case(func(ctx context.Context) { + obj := map[int]interface{}{3: 9, 2: nil} + valType := reflect2.TypeOf(obj).(reflect2.MapType) + elem, found := valType.TryGetIndex(obj, 3) + must.Equal(9, elem) + must.Pass(found) + elem, found = valType.TryGetIndex(obj, 2) + must.Nil(elem) + must.Pass(found) + elem, found = valType.TryGetIndex(obj, 0) + must.Nil(elem) + must.Pass(!found) + })) + t.Run("Iterate", testOp(func(api reflect2.API) interface{} { + obj := map[int]interface{}{2: 4} + valType := api.TypeOf(obj).(reflect2.MapType) + iter := valType.Iterate(obj) + must.Pass(iter.HasNext(), "api", api) + key1, elem1 := iter.Next() + must.Pass(!iter.HasNext(), "api", api) + return []interface{}{key1, elem1} + })) +} \ No newline at end of file diff --git a/vendor/github.com/modern-go/reflect2/tests/map_elem_map_test.go b/vendor/github.com/modern-go/reflect2/tests/map_elem_map_test.go new file mode 100644 index 000000000..3cc4dfeb6 --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/tests/map_elem_map_test.go @@ -0,0 +1,23 @@ +package tests + +import ( + "testing" + "github.com/modern-go/reflect2" +) + +func Test_map_elem_map(t *testing.T) { + var pInt = func(val int) *int { + return &val + } + var pMap = func(val map[int]int) *map[int]int { + return &val + } + t.Run("SetIndex", testOp(func(api reflect2.API) interface{} { + obj := map[int]map[int]int{} + valType := api.TypeOf(obj).(reflect2.MapType) + valType.SetIndex(&obj, pInt(2), pMap(map[int]int{4:4})) + valType.SetIndex(&obj, pInt(3), pMap(map[int]int{9:9})) + valType.SetIndex(&obj, pInt(3), pMap(nil)) + return obj + })) +} \ No newline at end of file diff --git a/vendor/github.com/modern-go/reflect2/tests/map_elem_struct_test.go b/vendor/github.com/modern-go/reflect2/tests/map_elem_struct_test.go new file mode 100644 index 000000000..ec2dd2d75 --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/tests/map_elem_struct_test.go @@ -0,0 +1,57 @@ +package tests + +import ( + "testing" + "github.com/modern-go/reflect2" + "time" +) + +func Test_map_elem_struct(t *testing.T) { + t.Run("SetIndex", testOp(func(api reflect2.API) interface{} { + obj := map[int]time.Time{} + valType := api.TypeOf(obj).(reflect2.MapType) + valType.SetIndex(obj, 2, time.Time{}) + valType.SetIndex(obj, 3, time.Time{}) + return obj + })) + t.Run("SetIndex single ptr struct", testOp(func(api reflect2.API) interface{} { + type TestObject struct { + Field1 *int + } + obj := map[int]TestObject{} + valType := api.TypeOf(obj).(reflect2.MapType) + valType.SetIndex(obj, 2, TestObject{}) + valType.SetIndex(obj, 3, TestObject{}) + return obj + })) + t.Run("SetIndex single map struct", testOp(func(api reflect2.API) interface{} { + type TestObject struct { + Field1 map[int]int + } + obj := map[int]TestObject{} + valType := api.TypeOf(obj).(reflect2.MapType) + valType.SetIndex(obj, 2, TestObject{}) + valType.SetIndex(obj, 3, TestObject{}) + return obj + })) + t.Run("SetIndex single chan struct", testOp(func(api reflect2.API) interface{} { + type TestObject struct { + Field1 chan int + } + obj := map[int]TestObject{} + valType := api.TypeOf(obj).(reflect2.MapType) + valType.SetIndex(obj, 2, TestObject{}) + valType.SetIndex(obj, 3, TestObject{}) + return obj + })) + t.Run("SetIndex single func struct", testOp(func(api reflect2.API) interface{} { + type TestObject struct { + Field1 func() + } + obj := map[int]TestObject{} + valType := api.TypeOf(obj).(reflect2.MapType) + valType.SetIndex(obj, 2, TestObject{}) + valType.SetIndex(obj, 3, TestObject{}) + return obj + })) +} diff --git a/vendor/github.com/modern-go/reflect2/tests/map_key_eface_test.go b/vendor/github.com/modern-go/reflect2/tests/map_key_eface_test.go new file mode 100644 index 000000000..df57e8fd2 --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/tests/map_key_eface_test.go @@ -0,0 +1,43 @@ +package tests + +import ( + "testing" + "github.com/modern-go/reflect2" + "github.com/modern-go/test/must" +) + +func Test_map_key_eface(t *testing.T) { + var pEFace = func(val interface{}) interface{} { + return &val + } + var pInt = func(val int) *int { + return &val + } + t.Run("SetIndex", testOp(func(api reflect2.API) interface{} { + obj := map[interface{}]int{} + valType := api.TypeOf(obj).(reflect2.MapType) + valType.SetIndex(&obj, pEFace(2), pInt(4)) + valType.SetIndex(&obj, pEFace(3), pInt(9)) + valType.SetIndex(&obj, pEFace(nil), pInt(9)) + return obj + })) + t.Run("GetIndex", testOp(func(api reflect2.API) interface{} { + obj := map[interface{}]int{3: 9, 2: 4} + valType := api.TypeOf(obj).(reflect2.MapType) + return []interface{}{ + valType.GetIndex(&obj, pEFace(3)), + valType.GetIndex(&obj, pEFace(0)), + valType.GetIndex(&obj, pEFace(nil)), + valType.GetIndex(&obj, pEFace("")), + } + })) + t.Run("Iterate", testOp(func(api reflect2.API) interface{} { + obj := map[interface{}]int{2: 4} + valType := api.TypeOf(obj).(reflect2.MapType) + iter := valType.Iterate(obj) + must.Pass(iter.HasNext(), "api", api) + key1, elem1 := iter.Next() + must.Pass(!iter.HasNext(), "api", api) + return []interface{}{key1, elem1} + })) +} diff --git a/vendor/github.com/modern-go/reflect2/tests/map_key_iface_test.go b/vendor/github.com/modern-go/reflect2/tests/map_key_iface_test.go new file mode 100644 index 000000000..b8774af4f --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/tests/map_key_iface_test.go @@ -0,0 +1,47 @@ +package tests + +import ( + "testing" + "github.com/modern-go/reflect2" + "github.com/modern-go/test/must" +) + +type intError int + +func (err intError) Error() string { + return "" +} + +func Test_map_iface_key(t *testing.T) { + t.Run("SetIndex", testOp(func(api reflect2.API) interface{} { + obj := map[error]int{} + valType := api.TypeOf(obj).(reflect2.MapType) + valType.SetIndex(obj, intError(2), 4) + valType.SetIndex(obj, intError(2), 9) + valType.SetIndex(obj, nil, 9) + must.Panic(func() { + valType.SetIndex(obj, "", 9) + }) + return obj + })) + t.Run("GetIndex", testOp(func(api reflect2.API) interface{} { + obj := map[error]int{intError(3): 9, intError(2): 4} + valType := api.TypeOf(obj).(reflect2.MapType) + must.Panic(func() { + valType.GetIndex(obj, "") + }) + return []interface{}{ + valType.GetIndex(obj, intError(3)), + valType.GetIndex(obj, nil), + } + })) + t.Run("Iterate", testOp(func(api reflect2.API) interface{} { + obj := map[error]int{intError(2): 4} + valType := api.TypeOf(obj).(reflect2.MapType) + iter := valType.Iterate(obj) + must.Pass(iter.HasNext(), "api", api) + key1, elem1 := iter.Next() + must.Pass(!iter.HasNext(), "api", api) + return []interface{}{key1, elem1} + })) +} diff --git a/vendor/github.com/modern-go/reflect2/tests/map_key_ptr_test.go b/vendor/github.com/modern-go/reflect2/tests/map_key_ptr_test.go new file mode 100644 index 000000000..7c905f7d7 --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/tests/map_key_ptr_test.go @@ -0,0 +1,51 @@ +package tests + +import ( + "testing" + "github.com/modern-go/reflect2" + "github.com/modern-go/test/must" + "github.com/modern-go/test" + + "unsafe" + "context" +) + +func Test_map_key_ptr(t *testing.T) { + var pInt = func(val int) *int { + return &val + } + t.Run("SetIndex", testOp(func(api reflect2.API) interface{} { + obj := map[*int]int{} + valType := api.TypeOf(obj).(reflect2.MapType) + key := pInt(2) + valType.SetIndex(obj, &key, 4) + valType.SetIndex(obj, &key, 9) + //valType.SetIndex(obj, nil, 9) + return obj[pInt(2)] + })) + t.Run("UnsafeSetIndex", test.Case(func(ctx context.Context) { + obj := map[*int]int{} + valType := reflect2.TypeOf(obj).(reflect2.MapType) + v := pInt(2) + valType.UnsafeSetIndex(reflect2.PtrOf(obj), unsafe.Pointer(v), reflect2.PtrOf(4)) + must.Equal(4, obj[v]) + })) + t.Run("GetIndex", testOp(func(api reflect2.API) interface{} { + obj := map[*int]int{pInt(3): 9, pInt(2): 4} + valType := api.TypeOf(obj).(reflect2.MapType) + return []interface{}{ + valType.GetIndex(obj, pInt(3)), + valType.GetIndex(obj, pInt(2)), + valType.GetIndex(obj, nil), + } + })) + t.Run("Iterate", testOp(func(api reflect2.API) interface{} { + obj := map[*int]int{pInt(2): 4} + valType := api.TypeOf(obj).(reflect2.MapType) + iter := valType.Iterate(&obj) + must.Pass(iter.HasNext(), "api", api) + key1, elem1 := iter.Next() + must.Pass(!iter.HasNext(), "api", api) + return []interface{}{key1, elem1} + })) +} diff --git a/vendor/github.com/modern-go/reflect2/tests/map_test.go b/vendor/github.com/modern-go/reflect2/tests/map_test.go new file mode 100644 index 000000000..131baa481 --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/tests/map_test.go @@ -0,0 +1,121 @@ +package tests + +import ( + "testing" + "github.com/modern-go/reflect2" + "github.com/modern-go/test/must" + + "github.com/modern-go/test" + "unsafe" + "reflect" + "context" +) + +func Test_map(t *testing.T) { + var pInt = func(val int) *int { + return &val + } + t.Run("New", testOp(func(api reflect2.API) interface{} { + valType := api.TypeOf(map[int]int{}) + m := valType.New().(*map[int]int) + return m + })) + t.Run("IsNil", testOp(func(api reflect2.API) interface{} { + valType := api.TypeOf(map[int]int{}) + var nilMap map[int]int + m := map[int]int{} + return []interface{}{ + valType.IsNil(&nilMap), + valType.IsNil(&m), + } + })) + t.Run("MakeMap", testOp(func(api reflect2.API) interface{} { + valType := api.TypeOf(map[int]int{}).(reflect2.MapType) + m := *(valType.MakeMap(0).(*map[int]int)) + m[2] = 4 + m[3] = 9 + return m + })) + t.Run("UnsafeMakeMap", test.Case(func(ctx context.Context) { + valType := reflect2.TypeOf(map[int]int{}).(reflect2.MapType) + m := *(*map[int]int)(valType.UnsafeMakeMap(0)) + m[2] = 4 + m[3] = 9 + })) + t.Run("PackEFace", test.Case(func(ctx context.Context) { + valType := reflect2.TypeOf(map[int]int{}).(reflect2.MapType) + m := valType.UnsafeMakeMap(0) + must.Equal(&map[int]int{}, valType.PackEFace(unsafe.Pointer(m))) + })) + t.Run("Indirect", testOp(func(api reflect2.API) interface{} { + valType := reflect2.TypeOf(map[int]int{}) + return valType.Indirect(&map[int]int{}) + })) + t.Run("SetIndex", testOp(func(api reflect2.API) interface{} { + obj := map[int]int{} + valType := api.TypeOf(obj).(reflect2.MapType) + valType.SetIndex(&obj, pInt(2), pInt(4)) + valType.SetIndex(&obj, pInt(3), pInt(9)) + must.Equal(4, obj[2]) + return obj + })) + t.Run("UnsafeSetIndex", test.Case(func(ctx context.Context) { + obj := map[int]int{} + valType := reflect2.TypeOf(obj).(reflect2.MapType) + valType.UnsafeSetIndex(unsafe.Pointer(&obj), reflect2.PtrOf(2), reflect2.PtrOf(4)) + must.Equal(map[int]int{2: 4}, obj) + })) + t.Run("GetIndex", testOp(func(api reflect2.API) interface{} { + obj := map[int]int{3: 9, 2: 4} + valType := api.TypeOf(obj).(reflect2.MapType) + return []interface{}{ + *valType.GetIndex(&obj, pInt(3)).(*int), + valType.GetIndex(&obj, pInt(0)).(*int), + } + })) + t.Run("UnsafeGetIndex", test.Case(func(ctx context.Context) { + obj := map[int]int{3: 9, 2: 4} + valType := reflect2.TypeOf(obj).(reflect2.MapType) + elem := valType.UnsafeGetIndex(unsafe.Pointer(&obj), reflect2.PtrOf(3)) + must.Equal(9, *(*int)(elem)) + })) + t.Run("Iterate", testOp(func(api reflect2.API) interface{} { + obj := map[int]int{2: 4} + valType := api.TypeOf(obj).(reflect2.MapType) + iter := valType.Iterate(&obj) + must.Pass(iter.HasNext(), "api", api) + key1, elem1 := iter.Next() + must.Pass(!iter.HasNext(), "api", api) + return []interface{}{key1, elem1} + })) + t.Run("UnsafeIterate", test.Case(func(ctx context.Context) { + obj := map[int]int{2: 4} + valType := reflect2.TypeOf(obj).(reflect2.MapType) + iter := valType.UnsafeIterate(unsafe.Pointer(&obj)) + must.Pass(iter.HasNext()) + key, elem := iter.UnsafeNext() + must.Equal(2, *(*int)(key)) + must.Equal(4, *(*int)(elem)) + })) +} + +func Benchmark_map_unsafe(b *testing.B) { + obj := map[int]int{} + valType := reflect2.TypeOf(obj).(*reflect2.UnsafeMapType) + m := unsafe.Pointer(&obj) + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + valType.UnsafeSetIndex(m, reflect2.PtrOf(2), reflect2.PtrOf(4)) + } +} + +func Benchmark_map_safe(b *testing.B) { + obj := map[int]int{} + val := reflect.ValueOf(obj) + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + val.SetMapIndex(reflect.ValueOf(2), reflect.ValueOf(4)) + } +} diff --git a/vendor/github.com/modern-go/reflect2/tests/op_test.go b/vendor/github.com/modern-go/reflect2/tests/op_test.go new file mode 100644 index 000000000..fa3bd451a --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/tests/op_test.go @@ -0,0 +1,18 @@ +package tests + +import ( + "github.com/modern-go/reflect2" + "testing" + + "github.com/modern-go/test/must" + "github.com/modern-go/test" + "context" +) + +func testOp(f func(api reflect2.API) interface{}) func(t *testing.T) { + return test.Case(func(ctx context.Context) { + unsafeResult := f(reflect2.ConfigUnsafe) + safeResult := f(reflect2.ConfigSafe) + must.Equal(safeResult, unsafeResult) + }) +} diff --git a/vendor/github.com/modern-go/reflect2/tests/slice_array_test.go b/vendor/github.com/modern-go/reflect2/tests/slice_array_test.go new file mode 100644 index 000000000..89dbbe70b --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/tests/slice_array_test.go @@ -0,0 +1,37 @@ +package tests + +import ( + "testing" + "github.com/modern-go/reflect2" +) + +func Test_slice_array(t *testing.T) { + t.Run("SetIndex", testOp(func(api reflect2.API) interface{} { + obj := [][1]int{{}, {}} + valType := api.TypeOf(obj).(reflect2.SliceType) + valType.SetIndex(obj, 0, [1]int{1}) + valType.SetIndex(obj, 1, [1]int{2}) + return obj + })) + t.Run("SetIndex single ptr struct", testOp(func(api reflect2.API) interface{} { + obj := [][1]*int{{}, {}} + valType := api.TypeOf(obj).(reflect2.SliceType) + valType.SetIndex(obj, 0, [1]*int{}) + valType.SetIndex(obj, 1, [1]*int{}) + return obj + })) + t.Run("SetIndex single chan struct", testOp(func(api reflect2.API) interface{} { + obj := [][1]chan int{{}, {}} + valType := api.TypeOf(obj).(reflect2.SliceType) + valType.SetIndex(obj, 0, [1]chan int{}) + valType.SetIndex(obj, 1, [1]chan int{}) + return obj + })) + t.Run("SetIndex single func struct", testOp(func(api reflect2.API) interface{} { + obj := [][1]func(){{}, {}} + valType := api.TypeOf(obj).(reflect2.SliceType) + valType.SetIndex(obj, 0, [1]func(){}) + valType.SetIndex(obj, 1, [1]func(){}) + return obj + })) +} diff --git a/vendor/github.com/modern-go/reflect2/tests/slice_bytes_test.go b/vendor/github.com/modern-go/reflect2/tests/slice_bytes_test.go new file mode 100644 index 000000000..ef1aa68b4 --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/tests/slice_bytes_test.go @@ -0,0 +1,16 @@ +package tests + +import ( + "testing" + "github.com/modern-go/reflect2" +) + +func Test_slice_bytes(t *testing.T) { + t.Run("SetIndex", testOp(func(api reflect2.API) interface{} { + obj := [][]byte{[]byte("hello"), []byte("world")} + valType := api.TypeOf(obj).(reflect2.SliceType) + valType.SetIndex(&obj, 0, []byte("hi")) + valType.SetIndex(&obj, 1, []byte("there")) + return obj + })) +} \ No newline at end of file diff --git a/vendor/github.com/modern-go/reflect2/tests/slice_eface_test.go b/vendor/github.com/modern-go/reflect2/tests/slice_eface_test.go new file mode 100644 index 000000000..950ad33f6 --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/tests/slice_eface_test.go @@ -0,0 +1,78 @@ +package tests + +import ( + "testing" + "github.com/modern-go/reflect2" + "github.com/modern-go/test" + + "github.com/modern-go/test/must" + "unsafe" + "github.com/modern-go/test/should" + "fmt" + "context" +) + +func Test_slice_eface(t *testing.T) { + t.Run("MakeSlice", testOp(func(api reflect2.API) interface{} { + valType := api.TypeOf([]interface{}{}).(reflect2.SliceType) + obj := valType.MakeSlice(5, 10) + obj.([]interface{})[0] = 100 + obj.([]interface{})[4] = 20 + return obj + })) + t.Run("SetIndex", testOp(func(api reflect2.API) interface{} { + obj := []interface{}{1, nil} + valType := api.TypeOf(obj).(reflect2.SliceType) + elem0 := interface{}(100) + valType.SetIndex(obj, 0, &elem0) + elem1 := interface{}(20) + valType.SetIndex(obj, 1, &elem1) + return obj + })) + t.Run("UnsafeSetIndex", test.Case(func(ctx context.Context) { + obj := []interface{}{1, 2} + valType := reflect2.TypeOf(obj).(reflect2.SliceType) + var elem0 interface{} = 100 + valType.UnsafeSetIndex(reflect2.PtrOf(obj), 0, unsafe.Pointer(&elem0)) + var elem1 interface{} = 10 + valType.UnsafeSetIndex(reflect2.PtrOf(obj), 1, unsafe.Pointer(&elem1)) + must.Equal([]interface{}{100, 10}, obj) + })) + t.Run("GetIndex", testOp(func(api reflect2.API) interface{} { + obj := []interface{}{1, nil} + valType := api.TypeOf(obj).(reflect2.SliceType) + fmt.Println(api, *valType.GetIndex(obj, 0).(*interface{})) + return []interface{}{ + valType.GetIndex(obj, 0), + valType.GetIndex(obj, 1), + } + })) + t.Run("UnsafeGetIndex", test.Case(func(ctx context.Context) { + obj := []interface{}{1, nil} + valType := reflect2.TypeOf(obj).(reflect2.SliceType) + elem0 := valType.UnsafeGetIndex(reflect2.PtrOf(obj), 0) + must.Equal(1, *(*interface{})(elem0)) + })) + t.Run("Append", testOp(func(api reflect2.API) interface{} { + obj := make([]interface{}, 2, 3) + obj[0] = 1 + obj[1] = 2 + valType := api.TypeOf(obj).(reflect2.SliceType) + valType.Append(&obj, 3) + // will trigger grow + valType.Append(&obj, 4) + return obj + })) + t.Run("UnsafeAppend", test.Case(func(ctx context.Context) { + obj := make([]interface{}, 2, 3) + obj[0] = 1 + obj[1] = 2 + valType := reflect2.TypeOf(obj).(reflect2.SliceType) + ptr := reflect2.PtrOf(obj) + var elem2 interface{} = 3 + valType.UnsafeAppend(ptr, unsafe.Pointer(&elem2)) + var elem3 interface{} = 4 + valType.UnsafeAppend(ptr, unsafe.Pointer(&elem3)) + should.Equal([]interface{}{1, 2, 3, 4}, valType.PackEFace(ptr)) + })) +} diff --git a/vendor/github.com/modern-go/reflect2/tests/slice_iface_test.go b/vendor/github.com/modern-go/reflect2/tests/slice_iface_test.go new file mode 100644 index 000000000..0a94d796a --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/tests/slice_iface_test.go @@ -0,0 +1,81 @@ +package tests + +import ( + "testing" + "github.com/modern-go/reflect2" + "errors" + "github.com/modern-go/test" + + "unsafe" + "github.com/modern-go/test/must" + "context" +) + +func Test_slice_iface(t *testing.T) { + var pError = func(msg string) *error { + err := errors.New(msg) + return &err + } + t.Run("MakeSlice", testOp(func(api reflect2.API) interface{} { + valType := api.TypeOf([]error{}).(reflect2.SliceType) + obj := *(valType.MakeSlice(5, 10).(*[]error)) + obj[0] = errors.New("hello") + obj[4] = errors.New("world") + return obj + })) + t.Run("SetIndex", testOp(func(api reflect2.API) interface{} { + obj := []error{errors.New("hello"), nil} + valType := api.TypeOf(obj).(reflect2.SliceType) + valType.SetIndex(&obj, 0, pError("hi")) + valType.SetIndex(&obj, 1, pError("world")) + return obj + })) + t.Run("UnsafeSetIndex", test.Case(func(ctx context.Context) { + obj := []error{errors.New("hello"), nil} + valType := reflect2.TypeOf(obj).(reflect2.SliceType) + elem0 := errors.New("hi") + valType.UnsafeSetIndex(reflect2.PtrOf(obj), 0, unsafe.Pointer(&elem0)) + elem1 := errors.New("world") + valType.UnsafeSetIndex(reflect2.PtrOf(obj), 1, unsafe.Pointer(&elem1)) + must.Equal([]error{elem0, elem1}, obj) + })) + t.Run("GetIndex", testOp(func(api reflect2.API) interface{} { + obj := []error{errors.New("hello"), nil} + valType := api.TypeOf(obj).(reflect2.SliceType) + return []interface{}{ + valType.GetIndex(&obj, 0), + valType.GetIndex(&obj, 1), + } + })) + t.Run("UnsafeGetIndex", test.Case(func(ctx context.Context) { + obj := []error{errors.New("hello"), nil} + valType := reflect2.TypeOf(obj).(reflect2.SliceType) + elem0 := valType.UnsafeGetIndex(reflect2.PtrOf(obj), 0) + must.Equal(errors.New("hello"), *(*error)(elem0)) + })) + t.Run("Append", testOp(func(api reflect2.API) interface{} { + obj := make([]error, 2, 3) + obj[0] = errors.New("1") + obj[1] = errors.New("2") + valType := api.TypeOf(obj).(reflect2.SliceType) + ptr := &obj + valType.Append(ptr, pError("3")) + // will trigger grow + valType.Append(ptr, pError("4")) + return ptr + })) + t.Run("UnsafeAppend", test.Case(func(ctx context.Context) { + obj := make([]error, 2, 3) + obj[0] = errors.New("1") + obj[1] = errors.New("2") + valType := reflect2.TypeOf(obj).(reflect2.SliceType) + ptr := reflect2.PtrOf(obj) + elem2 := errors.New("3") + valType.UnsafeAppend(ptr, unsafe.Pointer(&elem2)) + elem3 := errors.New("4") + valType.UnsafeAppend(ptr, unsafe.Pointer(&elem3)) + must.Equal(&[]error{ + obj[0], obj[1], elem2, elem3, + }, valType.PackEFace(ptr)) + })) +} diff --git a/vendor/github.com/modern-go/reflect2/tests/slice_map_test.go b/vendor/github.com/modern-go/reflect2/tests/slice_map_test.go new file mode 100644 index 000000000..f01a2129e --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/tests/slice_map_test.go @@ -0,0 +1,43 @@ +package tests + +import ( + "testing" + "github.com/modern-go/reflect2" +) + +func Test_slice_map(t *testing.T) { + t.Run("MakeSlice", testOp(func(api reflect2.API) interface{} { + valType := api.TypeOf([]map[int]int{}).(reflect2.SliceType) + obj := valType.MakeSlice(5, 10) + obj.([]map[int]int)[0] = map[int]int{1:1} + obj.([]map[int]int)[4] = map[int]int{2:2} + return obj + })) + t.Run("SetIndex", testOp(func(api reflect2.API) interface{} { + obj := []map[int]int{{1: 1}, nil} + valType := api.TypeOf(obj).(reflect2.SliceType) + valType.SetIndex(obj, 0, &map[int]int{10:10}) + valType.SetIndex(obj, 1, &map[int]int{2:2}) + return obj + })) + t.Run("GetIndex", testOp(func(api reflect2.API) interface{} { + obj := []map[int]int{{1:1}, nil} + valType := api.TypeOf(obj).(reflect2.SliceType) + return []interface{}{ + valType.GetIndex(&obj, 0), + valType.GetIndex(&obj, 1), + valType.GetIndex(obj, 0), + valType.GetIndex(obj, 1), + } + })) + t.Run("Append", testOp(func(api reflect2.API) interface{} { + obj := make([]map[int]int, 2, 3) + obj[0] = map[int]int{1:1} + obj[1] = map[int]int{2:2} + valType := api.TypeOf(obj).(reflect2.SliceType) + valType.Append(obj, map[int]int{3:3}) + // will trigger grow + valType.Append(obj, map[int]int{4:4}) + return obj + })) +} \ No newline at end of file diff --git a/vendor/github.com/modern-go/reflect2/tests/slice_ptr_test.go b/vendor/github.com/modern-go/reflect2/tests/slice_ptr_test.go new file mode 100644 index 000000000..a381be447 --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/tests/slice_ptr_test.go @@ -0,0 +1,58 @@ +package tests + +import ( + "testing" + "github.com/modern-go/reflect2" + "github.com/modern-go/test" + + "unsafe" + "github.com/modern-go/test/must" + "context" +) + +func Test_slice_ptr(t *testing.T) { + var pInt = func(val int) *int { + return &val + } + t.Run("MakeSlice", testOp(func(api reflect2.API) interface{} { + valType := api.TypeOf([]*int{}).(reflect2.SliceType) + obj := valType.MakeSlice(5, 10) + obj.([]*int)[0] = pInt(1) + obj.([]*int)[4] = pInt(5) + return obj + })) + t.Run("SetIndex", testOp(func(api reflect2.API) interface{} { + obj := []*int{pInt(1), nil} + valType := api.TypeOf(obj).(reflect2.SliceType) + valType.SetIndex(obj, 0, pInt(2)) + valType.SetIndex(obj, 1, pInt(3)) + return obj + })) + t.Run("UnsafeSetIndex", test.Case(func(ctx context.Context) { + obj := []*int{pInt(1), nil} + valType := reflect2.TypeOf(obj).(reflect2.SliceType) + valType.UnsafeSetIndex(reflect2.PtrOf(obj), 0, unsafe.Pointer(pInt(2))) + valType.UnsafeSetIndex(reflect2.PtrOf(obj), 1, unsafe.Pointer(pInt(1))) + must.Equal([]*int{pInt(2), pInt(1)}, obj) + })) + t.Run("GetIndex", testOp(func(api reflect2.API) interface{} { + obj := []*int{pInt(1), nil} + valType := api.TypeOf(obj).(reflect2.SliceType) + return []interface{}{ + valType.GetIndex(&obj, 0), + valType.GetIndex(&obj, 1), + valType.GetIndex(obj, 0), + valType.GetIndex(obj, 1), + } + })) + t.Run("Append", testOp(func(api reflect2.API) interface{} { + obj := make([]*int, 2, 3) + obj[0] = pInt(1) + obj[1] = pInt(2) + valType := api.TypeOf(obj).(reflect2.SliceType) + valType.Append(obj, pInt(3)) + // will trigger grow + valType.Append(obj, pInt(4)) + return obj + })) +} diff --git a/vendor/github.com/modern-go/reflect2/tests/slice_string_test.go b/vendor/github.com/modern-go/reflect2/tests/slice_string_test.go new file mode 100644 index 000000000..24cc7812d --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/tests/slice_string_test.go @@ -0,0 +1,16 @@ +package tests + +import ( + "testing" + "github.com/modern-go/reflect2" +) + +func Test_slice_string(t *testing.T) { + t.Run("SetIndex", testOp(func(api reflect2.API) interface{} { + obj := []string{"hello", "world"} + valType := api.TypeOf(obj).(reflect2.SliceType) + valType.SetIndex(&obj, 0, "hi") + valType.SetIndex(&obj, 1, "there") + return obj + })) +} \ No newline at end of file diff --git a/vendor/github.com/modern-go/reflect2/tests/slice_struct_test.go b/vendor/github.com/modern-go/reflect2/tests/slice_struct_test.go new file mode 100644 index 000000000..594c2862e --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/tests/slice_struct_test.go @@ -0,0 +1,53 @@ +package tests + +import ( + "testing" + "github.com/modern-go/reflect2" +) + +func Test_slice_struct(t *testing.T) { + var pInt = func(val int) *int { + return &val + } + t.Run("SetIndex", testOp(func(api reflect2.API) interface{} { + type TestObject struct { + Field1 float64 + Field2 float64 + } + obj := []TestObject{{}, {}} + valType := api.TypeOf(obj).(reflect2.SliceType) + valType.SetIndex(obj, 0, &TestObject{1, 3}) + valType.SetIndex(obj, 1, &TestObject{2, 4}) + return obj + })) + t.Run("SetIndex single ptr struct", testOp(func(api reflect2.API) interface{} { + type TestObject struct { + Field1 *int + } + obj := []TestObject{{}, {}} + valType := api.TypeOf(obj).(reflect2.SliceType) + valType.SetIndex(obj, 0, &TestObject{pInt(1)}) + valType.SetIndex(obj, 1, &TestObject{pInt(2)}) + return obj + })) + t.Run("SetIndex single chan struct", testOp(func(api reflect2.API) interface{} { + type TestObject struct { + Field1 chan int + } + obj := []TestObject{{}, {}} + valType := api.TypeOf(obj).(reflect2.SliceType) + valType.SetIndex(obj, 0, TestObject{}) + valType.SetIndex(obj, 1, TestObject{}) + return obj + })) + t.Run("SetIndex single func struct", testOp(func(api reflect2.API) interface{} { + type TestObject struct { + Field1 func() + } + obj := []TestObject{{}, {}} + valType := api.TypeOf(obj).(reflect2.SliceType) + valType.SetIndex(obj, 0, TestObject{}) + valType.SetIndex(obj, 1, TestObject{}) + return obj + })) +} \ No newline at end of file diff --git a/vendor/github.com/modern-go/reflect2/tests/slice_test.go b/vendor/github.com/modern-go/reflect2/tests/slice_test.go new file mode 100644 index 000000000..2b5f98d68 --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/tests/slice_test.go @@ -0,0 +1,115 @@ +package tests + +import ( + "testing" + "github.com/modern-go/reflect2" + "github.com/modern-go/test" + + "github.com/modern-go/test/must" + "context" +) + +func Test_slice(t *testing.T) { + var pInt = func(val int) *int { + return &val + } + t.Run("New", testOp(func(api reflect2.API) interface{} { + valType := api.TypeOf([]int{}) + obj := *valType.New().(*[]int) + obj = append(obj, 1) + return obj + })) + t.Run("IsNil", testOp(func(api reflect2.API) interface{} { + valType := api.TypeOf([]int{}) + var nilSlice []int + s := []int{} + return []interface{}{ + valType.IsNil(&nilSlice), + valType.IsNil(&s), + valType.IsNil(nil), + } + })) + t.Run("SetNil", testOp(func(api reflect2.API) interface{} { + valType := api.TypeOf([]int{}).(reflect2.SliceType) + s := []int{1} + valType.SetNil(&s) + return s + })) + t.Run("Set", testOp(func(api reflect2.API) interface{} { + valType := api.TypeOf([]int{}).(reflect2.SliceType) + s1 := []int{1} + s2 := []int{2} + valType.Set(&s1, &s2) + return s1 + })) + t.Run("MakeSlice", testOp(func(api reflect2.API) interface{} { + valType := api.TypeOf([]int{}).(reflect2.SliceType) + obj := *(valType.MakeSlice(5, 10).(*[]int)) + obj[0] = 100 + obj[4] = 20 + return obj + })) + t.Run("UnsafeMakeSlice", test.Case(func(ctx context.Context) { + valType := reflect2.TypeOf([]int{}).(reflect2.SliceType) + obj := valType.UnsafeMakeSlice(5, 10) + must.Equal(&[]int{0, 0, 0, 0, 0}, valType.PackEFace(obj)) + })) + t.Run("SetIndex", testOp(func(api reflect2.API) interface{} { + obj := []int{1, 2} + valType := api.TypeOf(obj).(reflect2.SliceType) + valType.SetIndex(&obj, 0, pInt(100)) + valType.SetIndex(&obj, 1, pInt(20)) + return obj + })) + t.Run("UnsafeSetIndex", test.Case(func(ctx context.Context) { + obj := []int{1, 2} + valType := reflect2.TypeOf(obj).(reflect2.SliceType) + valType.UnsafeSetIndex(reflect2.PtrOf(obj), 0, reflect2.PtrOf(100)) + valType.UnsafeSetIndex(reflect2.PtrOf(obj), 1, reflect2.PtrOf(10)) + must.Equal([]int{100, 10}, obj) + })) + t.Run("GetIndex", testOp(func(api reflect2.API) interface{} { + obj := []int{1, 2} + valType := api.TypeOf(obj).(reflect2.SliceType) + return []interface{}{ + valType.GetIndex(&obj, 1).(*int), + } + })) + t.Run("UnsafeGetIndex", test.Case(func(ctx context.Context) { + obj := []int{1, 2} + valType := reflect2.TypeOf(obj).(reflect2.SliceType) + elem0 := valType.UnsafeGetIndex(reflect2.PtrOf(obj), 0) + must.Equal(1, *(*int)(elem0)) + elem1 := valType.UnsafeGetIndex(reflect2.PtrOf(obj), 1) + must.Equal(2, *(*int)(elem1)) + })) + t.Run("Append", testOp(func(api reflect2.API) interface{} { + obj := make([]int, 2, 3) + obj[0] = 1 + obj[1] = 2 + valType := api.TypeOf(obj).(reflect2.SliceType) + ptr := &obj + valType.Append(ptr, pInt(3)) + // will trigger grow + valType.Append(ptr, pInt(4)) + return ptr + })) + t.Run("UnsafeAppend", test.Case(func(ctx context.Context) { + obj := make([]int, 2, 3) + obj[0] = 1 + obj[1] = 2 + valType := reflect2.TypeOf(obj).(reflect2.SliceType) + ptr := reflect2.PtrOf(obj) + valType.UnsafeAppend(ptr, reflect2.PtrOf(3)) + valType.UnsafeAppend(ptr, reflect2.PtrOf(4)) + must.Equal(&[]int{1, 2, 3, 4}, valType.PackEFace(ptr)) + })) + t.Run("Grow", testOp(func(api reflect2.API) interface{} { + obj := make([]int, 2, 3) + obj[0] = 1 + obj[1] = 2 + valType := reflect2.TypeOf(obj).(reflect2.SliceType) + valType.Grow(&obj, 4) + return obj + })) +} diff --git a/vendor/github.com/modern-go/reflect2/tests/struct_eface_test.go b/vendor/github.com/modern-go/reflect2/tests/struct_eface_test.go new file mode 100644 index 000000000..ce1e99763 --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/tests/struct_eface_test.go @@ -0,0 +1,28 @@ +package tests + +import ( + "testing" + "github.com/modern-go/reflect2" +) + +func Test_struct_eface(t *testing.T) { + type TestObject struct { + Field1 interface{} + } + var pEFace = func(val interface{}) interface{} { + return &val + } + t.Run("SetIndex", testOp(func(api reflect2.API) interface{} { + valType := api.TypeOf(TestObject{}).(reflect2.StructType) + field1 := valType.FieldByName("Field1") + obj := TestObject{} + field1.Set(&obj, pEFace(100)) + return obj + })) + t.Run("GetIndex", testOp(func(api reflect2.API) interface{} { + obj := TestObject{Field1: 100} + valType := api.TypeOf(obj).(reflect2.StructType) + field1 := valType.FieldByName("Field1") + return field1.Get(&obj) + })) +} \ No newline at end of file diff --git a/vendor/github.com/modern-go/reflect2/tests/struct_ptr_test.go b/vendor/github.com/modern-go/reflect2/tests/struct_ptr_test.go new file mode 100644 index 000000000..889d3afdc --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/tests/struct_ptr_test.go @@ -0,0 +1,25 @@ +package tests + +import ( + "testing" + + "github.com/modern-go/reflect2" + "github.com/modern-go/test/must" + "github.com/modern-go/test" + "context" +) + +func Test_struct_ptr(t *testing.T) { + type TestObject struct { + Field1 *int + } + t.Run("PackEFace", test.Case(func(ctx context.Context) { + valType := reflect2.TypeOf(TestObject{}) + ptr := valType.UnsafeNew() + must.Equal(&TestObject{}, valType.PackEFace(ptr)) + })) + t.Run("Indirect", test.Case(func(ctx context.Context) { + valType := reflect2.TypeOf(TestObject{}) + must.Equal(TestObject{}, valType.Indirect(&TestObject{})) + })) +} \ No newline at end of file diff --git a/vendor/github.com/modern-go/reflect2/tests/struct_test.go b/vendor/github.com/modern-go/reflect2/tests/struct_test.go new file mode 100644 index 000000000..4f69aad5f --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/tests/struct_test.go @@ -0,0 +1,64 @@ +package tests + +import ( + "testing" + "github.com/modern-go/reflect2" + "github.com/modern-go/test" + + "unsafe" + "github.com/modern-go/test/must" + "context" +) + +func Test_struct(t *testing.T) { + type TestObject struct { + Field1 int + Field2 int + } + var pInt = func(val int) *int { + return &val + } + t.Run("New", testOp(func(api reflect2.API) interface{} { + valType := api.TypeOf(TestObject{}) + obj := valType.New() + obj.(*TestObject).Field1 = 20 + obj.(*TestObject).Field2 = 100 + return obj + })) + t.Run("PackEFace", test.Case(func(ctx context.Context) { + valType := reflect2.TypeOf(TestObject{}) + ptr := valType.UnsafeNew() + must.Equal(&TestObject{}, valType.PackEFace(ptr)) + })) + t.Run("Indirect", test.Case(func(ctx context.Context) { + valType := reflect2.TypeOf(TestObject{}) + must.Equal(TestObject{}, valType.Indirect(&TestObject{})) + })) + t.Run("SetIndex", testOp(func(api reflect2.API) interface{} { + valType := api.TypeOf(TestObject{}).(reflect2.StructType) + field1 := valType.FieldByName("Field1") + obj := TestObject{} + field1.Set(&obj, pInt(100)) + return obj + })) + t.Run("UnsafeSetIndex", test.Case(func(ctx context.Context) { + valType := reflect2.TypeOf(TestObject{}).(reflect2.StructType) + field1 := valType.FieldByName("Field1") + obj := TestObject{} + field1.UnsafeSet(unsafe.Pointer(&obj), reflect2.PtrOf(100)) + must.Equal(100, obj.Field1) + })) + t.Run("GetIndex", testOp(func(api reflect2.API) interface{} { + obj := TestObject{Field1: 100} + valType := api.TypeOf(obj).(reflect2.StructType) + field1 := valType.FieldByName("Field1") + return field1.Get(&obj) + })) + t.Run("UnsafeGetIndex", test.Case(func(ctx context.Context) { + obj := TestObject{Field1: 100} + valType := reflect2.TypeOf(obj).(reflect2.StructType) + field1 := valType.FieldByName("Field1") + value := field1.UnsafeGet(unsafe.Pointer(&obj)) + must.Equal(100, *(*int)(value)) + })) +} diff --git a/vendor/github.com/modern-go/reflect2/type_map.go b/vendor/github.com/modern-go/reflect2/type_map.go new file mode 100644 index 000000000..122141f81 --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/type_map.go @@ -0,0 +1,72 @@ +package reflect2 + +import ( + "unsafe" + "reflect" + "runtime" + "strings" +) + +// typelinks1 for 1.5 ~ 1.6 +//go:linkname typelinks1 reflect.typelinks +func typelinks1() [][]unsafe.Pointer + +// typelinks2 for 1.7 ~ +//go:linkname typelinks2 reflect.typelinks +func typelinks2() (sections []unsafe.Pointer, offset [][]int32) + +var types = map[string]reflect.Type{} + +func init() { + ver := runtime.Version() + if ver == "go1.5" || strings.HasPrefix(ver, "go1.5.") { + loadGo15Types() + } else if ver == "go1.6" || strings.HasPrefix(ver, "go1.6.") { + loadGo15Types() + } else { + loadGo17Types() + } +} + +func loadGo15Types() { + var obj interface{} = reflect.TypeOf(0) + typePtrss := typelinks1() + for _, typePtrs := range typePtrss { + for _, typePtr := range typePtrs { + (*emptyInterface)(unsafe.Pointer(&obj)).word = typePtr + typ := obj.(reflect.Type) + if typ.Kind() == reflect.Ptr && typ.Elem().Kind() == reflect.Struct { + types[typ.Elem().String()] = typ.Elem() + } + if typ.Kind() == reflect.Slice && typ.Elem().Kind() == reflect.Ptr && + typ.Elem().Elem().Kind() == reflect.Struct { + types[typ.Elem().Elem().String()] = typ.Elem().Elem() + } + } + } +} + +func loadGo17Types() { + var obj interface{} = reflect.TypeOf(0) + sections, offset := typelinks2() + for i, offs := range offset { + rodata := sections[i] + for _, off := range offs { + (*emptyInterface)(unsafe.Pointer(&obj)).word = resolveTypeOff(unsafe.Pointer(rodata), off) + typ := obj.(reflect.Type) + if typ.Kind() == reflect.Ptr && typ.Elem().Kind() == reflect.Struct { + types[typ.Elem().String()] = typ.Elem() + } + } + } +} + +type emptyInterface struct { + typ unsafe.Pointer + word unsafe.Pointer +} + +// TypeByName return the type by its name, just like Class.forName in java +func TypeByName(typeName string) Type { + return Type2(types[typeName]) +} diff --git a/vendor/github.com/modern-go/reflect2/unsafe_array.go b/vendor/github.com/modern-go/reflect2/unsafe_array.go new file mode 100644 index 000000000..924b0262b --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/unsafe_array.go @@ -0,0 +1,65 @@ +package reflect2 + +import ( + "unsafe" + "reflect" +) + +type UnsafeArrayType struct { + unsafeType + elemRType unsafe.Pointer + pElemRType unsafe.Pointer + elemSize uintptr + likePtr bool +} + +func newUnsafeArrayType(cfg *frozenConfig, type1 reflect.Type) *UnsafeArrayType { + return &UnsafeArrayType{ + unsafeType: *newUnsafeType(cfg, type1), + elemRType: unpackEFace(type1.Elem()).data, + pElemRType: unpackEFace(reflect.PtrTo(type1.Elem())).data, + elemSize: type1.Elem().Size(), + likePtr: likePtrType(type1), + } +} + +func (type2 *UnsafeArrayType) LikePtr() bool { + return type2.likePtr +} + +func (type2 *UnsafeArrayType) Indirect(obj interface{}) interface{} { + objEFace := unpackEFace(obj) + assertType("Type.Indirect argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIndirect(objEFace.data) +} + +func (type2 *UnsafeArrayType) UnsafeIndirect(ptr unsafe.Pointer) interface{} { + if type2.likePtr { + return packEFace(type2.rtype, *(*unsafe.Pointer)(ptr)) + } + return packEFace(type2.rtype, ptr) +} + +func (type2 *UnsafeArrayType) SetIndex(obj interface{}, index int, elem interface{}) { + objEFace := unpackEFace(obj) + assertType("ArrayType.SetIndex argument 1", type2.ptrRType, objEFace.rtype) + elemEFace := unpackEFace(elem) + assertType("ArrayType.SetIndex argument 3", type2.pElemRType, elemEFace.rtype) + type2.UnsafeSetIndex(objEFace.data, index, elemEFace.data) +} + +func (type2 *UnsafeArrayType) UnsafeSetIndex(obj unsafe.Pointer, index int, elem unsafe.Pointer) { + elemPtr := arrayAt(obj, index, type2.elemSize, "i < s.Len") + typedmemmove(type2.elemRType, elemPtr, elem) +} + +func (type2 *UnsafeArrayType) GetIndex(obj interface{}, index int) interface{} { + objEFace := unpackEFace(obj) + assertType("ArrayType.GetIndex argument 1", type2.ptrRType, objEFace.rtype) + elemPtr := type2.UnsafeGetIndex(objEFace.data, index) + return packEFace(type2.pElemRType, elemPtr) +} + +func (type2 *UnsafeArrayType) UnsafeGetIndex(obj unsafe.Pointer, index int) unsafe.Pointer { + return arrayAt(obj, index, type2.elemSize, "i < s.Len") +} diff --git a/vendor/github.com/modern-go/reflect2/unsafe_eface.go b/vendor/github.com/modern-go/reflect2/unsafe_eface.go new file mode 100644 index 000000000..446f4206c --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/unsafe_eface.go @@ -0,0 +1,59 @@ +package reflect2 + +import ( + "unsafe" + "reflect" +) + +type eface struct { + rtype unsafe.Pointer + data unsafe.Pointer +} + +func unpackEFace(obj interface{}) *eface { + return (*eface)(unsafe.Pointer(&obj)) +} + +func packEFace(rtype unsafe.Pointer, data unsafe.Pointer) interface{} { + var i interface{} + e := (*eface)(unsafe.Pointer(&i)) + e.rtype = rtype + e.data = data + return i +} + +type UnsafeEFaceType struct { + unsafeType +} + +func newUnsafeEFaceType(cfg *frozenConfig, type1 reflect.Type) *UnsafeEFaceType { + return &UnsafeEFaceType{ + unsafeType: *newUnsafeType(cfg, type1), + } +} + +func (type2 *UnsafeEFaceType) IsNil(obj interface{}) bool { + if obj == nil { + return true + } + objEFace := unpackEFace(obj) + assertType("Type.IsNil argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIsNil(objEFace.data) +} + +func (type2 *UnsafeEFaceType) UnsafeIsNil(ptr unsafe.Pointer) bool { + if ptr == nil { + return true + } + return unpackEFace(*(*interface{})(ptr)).data == nil +} + +func (type2 *UnsafeEFaceType) Indirect(obj interface{}) interface{} { + objEFace := unpackEFace(obj) + assertType("Type.Indirect argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIndirect(objEFace.data) +} + +func (type2 *UnsafeEFaceType) UnsafeIndirect(ptr unsafe.Pointer) interface{} { + return *(*interface{})(ptr) +} \ No newline at end of file diff --git a/vendor/github.com/modern-go/reflect2/unsafe_field.go b/vendor/github.com/modern-go/reflect2/unsafe_field.go new file mode 100644 index 000000000..5eb53130a --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/unsafe_field.go @@ -0,0 +1,74 @@ +package reflect2 + +import ( + "reflect" + "unsafe" +) + +type UnsafeStructField struct { + reflect.StructField + structType *UnsafeStructType + rtype unsafe.Pointer + ptrRType unsafe.Pointer +} + +func newUnsafeStructField(structType *UnsafeStructType, structField reflect.StructField) *UnsafeStructField { + return &UnsafeStructField{ + StructField: structField, + rtype: unpackEFace(structField.Type).data, + ptrRType: unpackEFace(reflect.PtrTo(structField.Type)).data, + structType: structType, + } +} + +func (field *UnsafeStructField) Offset() uintptr { + return field.StructField.Offset +} + +func (field *UnsafeStructField) Name() string { + return field.StructField.Name +} + +func (field *UnsafeStructField) PkgPath() string { + return field.StructField.PkgPath +} + +func (field *UnsafeStructField) Type() Type { + return field.structType.cfg.Type2(field.StructField.Type) +} + +func (field *UnsafeStructField) Tag() reflect.StructTag { + return field.StructField.Tag +} + +func (field *UnsafeStructField) Index() []int { + return field.StructField.Index +} + +func (field *UnsafeStructField) Anonymous() bool { + return field.StructField.Anonymous +} + +func (field *UnsafeStructField) Set(obj interface{}, value interface{}) { + objEFace := unpackEFace(obj) + assertType("StructField.SetIndex argument 1", field.structType.ptrRType, objEFace.rtype) + valueEFace := unpackEFace(value) + assertType("StructField.SetIndex argument 2", field.ptrRType, valueEFace.rtype) + field.UnsafeSet(objEFace.data, valueEFace.data) +} + +func (field *UnsafeStructField) UnsafeSet(obj unsafe.Pointer, value unsafe.Pointer) { + fieldPtr := add(obj, field.StructField.Offset, "same as non-reflect &v.field") + typedmemmove(field.rtype, fieldPtr, value) +} + +func (field *UnsafeStructField) Get(obj interface{}) interface{} { + objEFace := unpackEFace(obj) + assertType("StructField.GetIndex argument 1", field.structType.ptrRType, objEFace.rtype) + value := field.UnsafeGet(objEFace.data) + return packEFace(field.ptrRType, value) +} + +func (field *UnsafeStructField) UnsafeGet(obj unsafe.Pointer) unsafe.Pointer { + return add(obj, field.StructField.Offset, "same as non-reflect &v.field") +} diff --git a/vendor/github.com/modern-go/reflect2/unsafe_iface.go b/vendor/github.com/modern-go/reflect2/unsafe_iface.go new file mode 100644 index 000000000..8f451ca36 --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/unsafe_iface.go @@ -0,0 +1,64 @@ +package reflect2 + +import ( + "unsafe" + "reflect" +) + +type iface struct { + itab *itab + data unsafe.Pointer +} + +type itab struct { + ignore unsafe.Pointer + rtype unsafe.Pointer +} + +func IFaceToEFace(ptr unsafe.Pointer) interface{} { + iface := (*iface)(ptr) + if iface.itab == nil { + return nil + } + return packEFace(iface.itab.rtype, iface.data) +} + +type UnsafeIFaceType struct { + unsafeType +} + +func newUnsafeIFaceType(cfg *frozenConfig, type1 reflect.Type) *UnsafeIFaceType { + return &UnsafeIFaceType{ + unsafeType: *newUnsafeType(cfg, type1), + } +} + +func (type2 *UnsafeIFaceType) Indirect(obj interface{}) interface{} { + objEFace := unpackEFace(obj) + assertType("Type.Indirect argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIndirect(objEFace.data) +} + +func (type2 *UnsafeIFaceType) UnsafeIndirect(ptr unsafe.Pointer) interface{} { + return IFaceToEFace(ptr) +} + +func (type2 *UnsafeIFaceType) IsNil(obj interface{}) bool { + if obj == nil { + return true + } + objEFace := unpackEFace(obj) + assertType("Type.IsNil argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIsNil(objEFace.data) +} + +func (type2 *UnsafeIFaceType) UnsafeIsNil(ptr unsafe.Pointer) bool { + if ptr == nil { + return true + } + iface := (*iface)(ptr) + if iface.itab == nil { + return true + } + return false +} \ No newline at end of file diff --git a/vendor/github.com/modern-go/reflect2/unsafe_link.go b/vendor/github.com/modern-go/reflect2/unsafe_link.go new file mode 100644 index 000000000..a25a5f4d0 --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/unsafe_link.go @@ -0,0 +1,70 @@ +package reflect2 + +import "unsafe" + +//go:linkname unsafe_New reflect.unsafe_New +func unsafe_New(rtype unsafe.Pointer) unsafe.Pointer + +//go:linkname typedmemmove reflect.typedmemmove +func typedmemmove(rtype unsafe.Pointer, dst, src unsafe.Pointer) + +//go:linkname unsafe_NewArray reflect.unsafe_NewArray +func unsafe_NewArray(rtype unsafe.Pointer, length int) unsafe.Pointer + +// typedslicecopy copies a slice of elemType values from src to dst, +// returning the number of elements copied. +//go:linkname typedslicecopy reflect.typedslicecopy +//go:noescape +func typedslicecopy(elemType unsafe.Pointer, dst, src sliceHeader) int + +//go:linkname mapassign reflect.mapassign +//go:noescape +func mapassign(rtype unsafe.Pointer, m unsafe.Pointer, key, val unsafe.Pointer) + +//go:linkname mapaccess reflect.mapaccess +//go:noescape +func mapaccess(rtype unsafe.Pointer, m unsafe.Pointer, key unsafe.Pointer) (val unsafe.Pointer) + +// m escapes into the return value, but the caller of mapiterinit +// doesn't let the return value escape. +//go:noescape +//go:linkname mapiterinit reflect.mapiterinit +func mapiterinit(rtype unsafe.Pointer, m unsafe.Pointer) *hiter + +//go:noescape +//go:linkname mapiternext reflect.mapiternext +func mapiternext(it *hiter) + +//go:linkname ifaceE2I reflect.ifaceE2I +func ifaceE2I(rtype unsafe.Pointer, src interface{}, dst unsafe.Pointer) + +// A hash iteration structure. +// If you modify hiter, also change cmd/internal/gc/reflect.go to indicate +// the layout of this structure. +type hiter struct { + key unsafe.Pointer // Must be in first position. Write nil to indicate iteration end (see cmd/internal/gc/range.go). + value unsafe.Pointer // Must be in second position (see cmd/internal/gc/range.go). + // rest fields are ignored +} + +// add returns p+x. +// +// The whySafe string is ignored, so that the function still inlines +// as efficiently as p+x, but all call sites should use the string to +// record why the addition is safe, which is to say why the addition +// does not cause x to advance to the very end of p's allocation +// and therefore point incorrectly at the next block in memory. +func add(p unsafe.Pointer, x uintptr, whySafe string) unsafe.Pointer { + return unsafe.Pointer(uintptr(p) + x) +} + +// arrayAt returns the i-th element of p, +// an array whose elements are eltSize bytes wide. +// The array pointed at by p must have at least i+1 elements: +// it is invalid (but impossible to check here) to pass i >= len, +// because then the result will point outside the array. +// whySafe must explain why i < len. (Passing "i < len" is fine; +// the benefit is to surface this assumption at the call site.) +func arrayAt(p unsafe.Pointer, i int, eltSize uintptr, whySafe string) unsafe.Pointer { + return add(p, uintptr(i)*eltSize, "i < len") +} \ No newline at end of file diff --git a/vendor/github.com/modern-go/reflect2/unsafe_map.go b/vendor/github.com/modern-go/reflect2/unsafe_map.go new file mode 100644 index 000000000..f2e76e6bb --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/unsafe_map.go @@ -0,0 +1,138 @@ +package reflect2 + +import ( + "reflect" + "unsafe" +) + +type UnsafeMapType struct { + unsafeType + pKeyRType unsafe.Pointer + pElemRType unsafe.Pointer +} + +func newUnsafeMapType(cfg *frozenConfig, type1 reflect.Type) MapType { + return &UnsafeMapType{ + unsafeType: *newUnsafeType(cfg, type1), + pKeyRType: unpackEFace(reflect.PtrTo(type1.Key())).data, + pElemRType: unpackEFace(reflect.PtrTo(type1.Elem())).data, + } +} + +func (type2 *UnsafeMapType) IsNil(obj interface{}) bool { + if obj == nil { + return true + } + objEFace := unpackEFace(obj) + assertType("Type.IsNil argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIsNil(objEFace.data) +} + +func (type2 *UnsafeMapType) UnsafeIsNil(ptr unsafe.Pointer) bool { + if ptr == nil { + return true + } + return *(*unsafe.Pointer)(ptr) == nil +} + +func (type2 *UnsafeMapType) LikePtr() bool { + return true +} + +func (type2 *UnsafeMapType) Indirect(obj interface{}) interface{} { + objEFace := unpackEFace(obj) + assertType("MapType.Indirect argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIndirect(objEFace.data) +} + +func (type2 *UnsafeMapType) UnsafeIndirect(ptr unsafe.Pointer) interface{} { + return packEFace(type2.rtype, *(*unsafe.Pointer)(ptr)) +} + +func (type2 *UnsafeMapType) Key() Type { + return type2.cfg.Type2(type2.Type.Key()) +} + +func (type2 *UnsafeMapType) MakeMap(cap int) interface{} { + return packEFace(type2.ptrRType, type2.UnsafeMakeMap(cap)) +} + +func (type2 *UnsafeMapType) UnsafeMakeMap(cap int) unsafe.Pointer { + m := makeMapWithSize(type2.rtype, cap) + return unsafe.Pointer(&m) +} + +func (type2 *UnsafeMapType) SetIndex(obj interface{}, key interface{}, elem interface{}) { + objEFace := unpackEFace(obj) + assertType("MapType.SetIndex argument 1", type2.ptrRType, objEFace.rtype) + keyEFace := unpackEFace(key) + assertType("MapType.SetIndex argument 2", type2.pKeyRType, keyEFace.rtype) + elemEFace := unpackEFace(elem) + assertType("MapType.SetIndex argument 3", type2.pElemRType, elemEFace.rtype) + type2.UnsafeSetIndex(objEFace.data, keyEFace.data, elemEFace.data) +} + +func (type2 *UnsafeMapType) UnsafeSetIndex(obj unsafe.Pointer, key unsafe.Pointer, elem unsafe.Pointer) { + mapassign(type2.rtype, *(*unsafe.Pointer)(obj), key, elem) +} + +func (type2 *UnsafeMapType) TryGetIndex(obj interface{}, key interface{}) (interface{}, bool) { + objEFace := unpackEFace(obj) + assertType("MapType.TryGetIndex argument 1", type2.ptrRType, objEFace.rtype) + keyEFace := unpackEFace(key) + assertType("MapType.TryGetIndex argument 2", type2.pKeyRType, keyEFace.rtype) + elemPtr := type2.UnsafeGetIndex(objEFace.data, keyEFace.data) + if elemPtr == nil { + return nil, false + } + return packEFace(type2.pElemRType, elemPtr), true +} + +func (type2 *UnsafeMapType) GetIndex(obj interface{}, key interface{}) interface{} { + objEFace := unpackEFace(obj) + assertType("MapType.GetIndex argument 1", type2.ptrRType, objEFace.rtype) + keyEFace := unpackEFace(key) + assertType("MapType.GetIndex argument 2", type2.pKeyRType, keyEFace.rtype) + elemPtr := type2.UnsafeGetIndex(objEFace.data, keyEFace.data) + return packEFace(type2.pElemRType, elemPtr) +} + +func (type2 *UnsafeMapType) UnsafeGetIndex(obj unsafe.Pointer, key unsafe.Pointer) unsafe.Pointer { + return mapaccess(type2.rtype, *(*unsafe.Pointer)(obj), key) +} + +func (type2 *UnsafeMapType) Iterate(obj interface{}) MapIterator { + objEFace := unpackEFace(obj) + assertType("MapType.Iterate argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIterate(objEFace.data) +} + +func (type2 *UnsafeMapType) UnsafeIterate(obj unsafe.Pointer) MapIterator { + return &UnsafeMapIterator{ + hiter: mapiterinit(type2.rtype, *(*unsafe.Pointer)(obj)), + pKeyRType: type2.pKeyRType, + pElemRType: type2.pElemRType, + } +} + +type UnsafeMapIterator struct { + *hiter + pKeyRType unsafe.Pointer + pElemRType unsafe.Pointer +} + +func (iter *UnsafeMapIterator) HasNext() bool { + return iter.key != nil +} + +func (iter *UnsafeMapIterator) Next() (interface{}, interface{}) { + key, elem := iter.UnsafeNext() + return packEFace(iter.pKeyRType, key), packEFace(iter.pElemRType, elem) +} + +func (iter *UnsafeMapIterator) UnsafeNext() (unsafe.Pointer, unsafe.Pointer) { + key := iter.key + elem := iter.value + mapiternext(iter.hiter) + return key, elem +} diff --git a/vendor/github.com/modern-go/reflect2/unsafe_ptr.go b/vendor/github.com/modern-go/reflect2/unsafe_ptr.go new file mode 100644 index 000000000..843724d8c --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/unsafe_ptr.go @@ -0,0 +1,46 @@ +package reflect2 + +import ( + "unsafe" + "reflect" +) + +type UnsafePtrType struct { + unsafeType +} + +func newUnsafePtrType(cfg *frozenConfig, type1 reflect.Type) *UnsafePtrType { + return &UnsafePtrType{ + unsafeType: *newUnsafeType(cfg, type1), + } +} + +func (type2 *UnsafePtrType) IsNil(obj interface{}) bool { + if obj == nil { + return true + } + objEFace := unpackEFace(obj) + assertType("Type.IsNil argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIsNil(objEFace.data) +} + +func (type2 *UnsafePtrType) UnsafeIsNil(ptr unsafe.Pointer) bool { + if ptr == nil { + return true + } + return *(*unsafe.Pointer)(ptr) == nil +} + +func (type2 *UnsafePtrType) LikePtr() bool { + return true +} + +func (type2 *UnsafePtrType) Indirect(obj interface{}) interface{} { + objEFace := unpackEFace(obj) + assertType("Type.Indirect argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIndirect(objEFace.data) +} + +func (type2 *UnsafePtrType) UnsafeIndirect(ptr unsafe.Pointer) interface{} { + return packEFace(type2.rtype, *(*unsafe.Pointer)(ptr)) +} diff --git a/vendor/github.com/modern-go/reflect2/unsafe_slice.go b/vendor/github.com/modern-go/reflect2/unsafe_slice.go new file mode 100644 index 000000000..5ce85afbb --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/unsafe_slice.go @@ -0,0 +1,177 @@ +package reflect2 + +import ( + "unsafe" + "reflect" +) + +// sliceHeader is a safe version of SliceHeader used within this package. +type sliceHeader struct { + Data unsafe.Pointer + Len int + Cap int +} + +type UnsafeSliceType struct { + unsafeType + elemRType unsafe.Pointer + pElemRType unsafe.Pointer + elemSize uintptr +} + +func newUnsafeSliceType(cfg *frozenConfig, type1 reflect.Type) SliceType { + elemType := type1.Elem() + return &UnsafeSliceType{ + unsafeType: *newUnsafeType(cfg, type1), + pElemRType: unpackEFace(reflect.PtrTo(elemType)).data, + elemRType: unpackEFace(elemType).data, + elemSize: elemType.Size(), + } +} + +func (type2 *UnsafeSliceType) Set(obj interface{}, val interface{}) { + objEFace := unpackEFace(obj) + assertType("Type.Set argument 1", type2.ptrRType, objEFace.rtype) + valEFace := unpackEFace(val) + assertType("Type.Set argument 2", type2.ptrRType, valEFace.rtype) + type2.UnsafeSet(objEFace.data, valEFace.data) +} + +func (type2 *UnsafeSliceType) UnsafeSet(ptr unsafe.Pointer, val unsafe.Pointer) { + *(*sliceHeader)(ptr) = *(*sliceHeader)(val) +} + +func (type2 *UnsafeSliceType) IsNil(obj interface{}) bool { + if obj == nil { + return true + } + objEFace := unpackEFace(obj) + assertType("Type.IsNil argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIsNil(objEFace.data) +} + +func (type2 *UnsafeSliceType) UnsafeIsNil(ptr unsafe.Pointer) bool { + if ptr == nil { + return true + } + return (*sliceHeader)(ptr).Data == nil +} + +func (type2 *UnsafeSliceType) SetNil(obj interface{}) { + objEFace := unpackEFace(obj) + assertType("SliceType.SetNil argument 1", type2.ptrRType, objEFace.rtype) + type2.UnsafeSetNil(objEFace.data) +} + +func (type2 *UnsafeSliceType) UnsafeSetNil(ptr unsafe.Pointer) { + header := (*sliceHeader)(ptr) + header.Len = 0 + header.Cap = 0 + header.Data = nil +} + +func (type2 *UnsafeSliceType) MakeSlice(length int, cap int) interface{} { + return packEFace(type2.ptrRType, type2.UnsafeMakeSlice(length, cap)) +} + +func (type2 *UnsafeSliceType) UnsafeMakeSlice(length int, cap int) unsafe.Pointer { + header := &sliceHeader{unsafe_NewArray(type2.elemRType, cap), length, cap} + return unsafe.Pointer(header) +} + +func (type2 *UnsafeSliceType) LengthOf(obj interface{}) int { + objEFace := unpackEFace(obj) + assertType("SliceType.Len argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeLengthOf(objEFace.data) +} + +func (type2 *UnsafeSliceType) UnsafeLengthOf(obj unsafe.Pointer) int { + header := (*sliceHeader)(obj) + return header.Len +} + +func (type2 *UnsafeSliceType) SetIndex(obj interface{}, index int, elem interface{}) { + objEFace := unpackEFace(obj) + assertType("SliceType.SetIndex argument 1", type2.ptrRType, objEFace.rtype) + elemEFace := unpackEFace(elem) + assertType("SliceType.SetIndex argument 3", type2.pElemRType, elemEFace.rtype) + type2.UnsafeSetIndex(objEFace.data, index, elemEFace.data) +} + +func (type2 *UnsafeSliceType) UnsafeSetIndex(obj unsafe.Pointer, index int, elem unsafe.Pointer) { + header := (*sliceHeader)(obj) + elemPtr := arrayAt(header.Data, index, type2.elemSize, "i < s.Len") + typedmemmove(type2.elemRType, elemPtr, elem) +} + +func (type2 *UnsafeSliceType) GetIndex(obj interface{}, index int) interface{} { + objEFace := unpackEFace(obj) + assertType("SliceType.GetIndex argument 1", type2.ptrRType, objEFace.rtype) + elemPtr := type2.UnsafeGetIndex(objEFace.data, index) + return packEFace(type2.pElemRType, elemPtr) +} + +func (type2 *UnsafeSliceType) UnsafeGetIndex(obj unsafe.Pointer, index int) unsafe.Pointer { + header := (*sliceHeader)(obj) + return arrayAt(header.Data, index, type2.elemSize, "i < s.Len") +} + +func (type2 *UnsafeSliceType) Append(obj interface{}, elem interface{}) { + objEFace := unpackEFace(obj) + assertType("SliceType.Append argument 1", type2.ptrRType, objEFace.rtype) + elemEFace := unpackEFace(elem) + assertType("SliceType.Append argument 2", type2.pElemRType, elemEFace.rtype) + type2.UnsafeAppend(objEFace.data, elemEFace.data) +} + +func (type2 *UnsafeSliceType) UnsafeAppend(obj unsafe.Pointer, elem unsafe.Pointer) { + header := (*sliceHeader)(obj) + oldLen := header.Len + type2.UnsafeGrow(obj, oldLen+1) + type2.UnsafeSetIndex(obj, oldLen, elem) +} + +func (type2 *UnsafeSliceType) Cap(obj interface{}) int { + objEFace := unpackEFace(obj) + assertType("SliceType.Cap argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeCap(objEFace.data) +} + +func (type2 *UnsafeSliceType) UnsafeCap(ptr unsafe.Pointer) int { + return (*sliceHeader)(ptr).Cap +} + +func (type2 *UnsafeSliceType) Grow(obj interface{}, newLength int) { + objEFace := unpackEFace(obj) + assertType("SliceType.Grow argument 1", type2.ptrRType, objEFace.rtype) + type2.UnsafeGrow(objEFace.data, newLength) +} + +func (type2 *UnsafeSliceType) UnsafeGrow(obj unsafe.Pointer, newLength int) { + header := (*sliceHeader)(obj) + if newLength <= header.Cap { + header.Len = newLength + return + } + newCap := calcNewCap(header.Cap, newLength) + newHeader := (*sliceHeader)(type2.UnsafeMakeSlice(header.Len, newCap)) + typedslicecopy(type2.elemRType, *newHeader, *header) + header.Data = newHeader.Data + header.Cap = newHeader.Cap + header.Len = newLength +} + +func calcNewCap(cap int, expectedCap int) int { + if cap == 0 { + cap = expectedCap + } else { + for cap < expectedCap { + if cap < 1024 { + cap += cap + } else { + cap += cap / 4 + } + } + } + return cap +} diff --git a/vendor/github.com/modern-go/reflect2/unsafe_struct.go b/vendor/github.com/modern-go/reflect2/unsafe_struct.go new file mode 100644 index 000000000..f91ef1792 --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/unsafe_struct.go @@ -0,0 +1,59 @@ +package reflect2 + +import ( + "reflect" + "unsafe" +) + +type UnsafeStructType struct { + unsafeType + likePtr bool +} + +func newUnsafeStructType(cfg *frozenConfig, type1 reflect.Type) *UnsafeStructType { + return &UnsafeStructType{ + unsafeType: *newUnsafeType(cfg, type1), + likePtr: likePtrType(type1), + } +} + +func (type2 *UnsafeStructType) LikePtr() bool { + return type2.likePtr +} + +func (type2 *UnsafeStructType) Indirect(obj interface{}) interface{} { + objEFace := unpackEFace(obj) + assertType("Type.Indirect argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIndirect(objEFace.data) +} + +func (type2 *UnsafeStructType) UnsafeIndirect(ptr unsafe.Pointer) interface{} { + if type2.likePtr { + return packEFace(type2.rtype, *(*unsafe.Pointer)(ptr)) + } + return packEFace(type2.rtype, ptr) +} + +func (type2 *UnsafeStructType) FieldByName(name string) StructField { + structField, found := type2.Type.FieldByName(name) + if !found { + return nil + } + return newUnsafeStructField(type2, structField) +} + +func (type2 *UnsafeStructType) Field(i int) StructField { + return newUnsafeStructField(type2, type2.Type.Field(i)) +} + +func (type2 *UnsafeStructType) FieldByIndex(index []int) StructField { + return newUnsafeStructField(type2, type2.Type.FieldByIndex(index)) +} + +func (type2 *UnsafeStructType) FieldByNameFunc(match func(string) bool) StructField { + structField, found := type2.Type.FieldByNameFunc(match) + if !found { + panic("field match condition not found in " + type2.Type.String()) + } + return newUnsafeStructField(type2, structField) +} \ No newline at end of file diff --git a/vendor/github.com/modern-go/reflect2/unsafe_type.go b/vendor/github.com/modern-go/reflect2/unsafe_type.go new file mode 100644 index 000000000..e7ad4a655 --- /dev/null +++ b/vendor/github.com/modern-go/reflect2/unsafe_type.go @@ -0,0 +1,85 @@ +package reflect2 + +import ( + "unsafe" + "reflect" +) + +type unsafeType struct { + safeType + rtype unsafe.Pointer + ptrRType unsafe.Pointer +} + +func newUnsafeType(cfg *frozenConfig, type1 reflect.Type) *unsafeType { + return &unsafeType{ + safeType: safeType{ + Type: type1, + cfg: cfg, + }, + rtype: unpackEFace(type1).data, + ptrRType: unpackEFace(reflect.PtrTo(type1)).data, + } +} + +func (type2 *unsafeType) Set(obj interface{}, val interface{}) { + objEFace := unpackEFace(obj) + assertType("Type.Set argument 1", type2.ptrRType, objEFace.rtype) + valEFace := unpackEFace(val) + assertType("Type.Set argument 2", type2.ptrRType, valEFace.rtype) + type2.UnsafeSet(objEFace.data, valEFace.data) +} + +func (type2 *unsafeType) UnsafeSet(ptr unsafe.Pointer, val unsafe.Pointer) { + typedmemmove(type2.rtype, ptr, val) +} + +func (type2 *unsafeType) IsNil(obj interface{}) bool { + objEFace := unpackEFace(obj) + assertType("Type.IsNil argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIsNil(objEFace.data) +} + +func (type2 *unsafeType) UnsafeIsNil(ptr unsafe.Pointer) bool { + return ptr == nil +} + +func (type2 *unsafeType) UnsafeNew() unsafe.Pointer { + return unsafe_New(type2.rtype) +} + +func (type2 *unsafeType) New() interface{} { + return packEFace(type2.ptrRType, type2.UnsafeNew()) +} + +func (type2 *unsafeType) PackEFace(ptr unsafe.Pointer) interface{} { + return packEFace(type2.ptrRType, ptr) +} + +func (type2 *unsafeType) RType() uintptr { + return uintptr(type2.rtype) +} + +func (type2 *unsafeType) Indirect(obj interface{}) interface{} { + objEFace := unpackEFace(obj) + assertType("Type.Indirect argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIndirect(objEFace.data) +} + +func (type2 *unsafeType) UnsafeIndirect(obj unsafe.Pointer) interface{} { + return packEFace(type2.rtype, obj) +} + +func (type2 *unsafeType) LikePtr() bool { + return false +} + +func assertType(where string, expectRType unsafe.Pointer, actualRType unsafe.Pointer) { + if expectRType != actualRType { + expectType := reflect.TypeOf(0) + (*iface)(unsafe.Pointer(&expectType)).data = expectRType + actualType := reflect.TypeOf(0) + (*iface)(unsafe.Pointer(&actualType)).data = actualRType + panic(where + ": expect " + expectType.String() + ", actual " + actualType.String()) + } +} diff --git a/vendor/golang.org/x/crypto/acme/acme.go b/vendor/golang.org/x/crypto/acme/acme.go index fa9c4b39e..1f4fb69ed 100644 --- a/vendor/golang.org/x/crypto/acme/acme.go +++ b/vendor/golang.org/x/crypto/acme/acme.go @@ -400,7 +400,7 @@ func (c *Client) RevokeAuthorization(ctx context.Context, url string) error { // WaitAuthorization polls an authorization at the given URL // until it is in one of the final states, StatusValid or StatusInvalid, -// or the context is done. +// the ACME CA responded with a 4xx error code, or the context is done. // // It returns a non-nil Authorization only if its Status is StatusValid. // In all other cases WaitAuthorization returns an error. @@ -412,6 +412,13 @@ func (c *Client) WaitAuthorization(ctx context.Context, url string) (*Authorizat if err != nil { return nil, err } + if res.StatusCode >= 400 && res.StatusCode <= 499 { + // Non-retriable error. For instance, Let's Encrypt may return 404 Not Found + // when requesting an expired authorization. + defer res.Body.Close() + return nil, responseError(res) + } + retry := res.Header.Get("Retry-After") if res.StatusCode != http.StatusOK && res.StatusCode != http.StatusAccepted { res.Body.Close() diff --git a/vendor/golang.org/x/crypto/acme/acme_test.go b/vendor/golang.org/x/crypto/acme/acme_test.go index 89f2efaa5..63cb79b98 100644 --- a/vendor/golang.org/x/crypto/acme/acme_test.go +++ b/vendor/golang.org/x/crypto/acme/acme_test.go @@ -549,6 +549,34 @@ func TestWaitAuthorizationInvalid(t *testing.T) { } } +func TestWaitAuthorizationClientError(t *testing.T) { + const code = http.StatusBadRequest + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(code) + })) + defer ts.Close() + + ch := make(chan error, 1) + go func() { + var client Client + _, err := client.WaitAuthorization(context.Background(), ts.URL) + ch <- err + }() + + select { + case <-time.After(3 * time.Second): + t.Fatal("WaitAuthz took too long to return") + case err := <-ch: + res, ok := err.(*Error) + if !ok { + t.Fatalf("err is %v (%T); want a non-nil *Error", err, err) + } + if res.StatusCode != code { + t.Errorf("res.StatusCode = %d; want %d", res.StatusCode, code) + } + } +} + func TestWaitAuthorizationCancel(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Retry-After", "60") diff --git a/vendor/golang.org/x/crypto/acme/autocert/autocert.go b/vendor/golang.org/x/crypto/acme/autocert/autocert.go index 453e72291..263b29133 100644 --- a/vendor/golang.org/x/crypto/acme/autocert/autocert.go +++ b/vendor/golang.org/x/crypto/acme/autocert/autocert.go @@ -27,7 +27,6 @@ import ( "net" "net/http" "path" - "strconv" "strings" "sync" "time" @@ -942,16 +941,6 @@ func validCert(domain string, der [][]byte, key crypto.Signer) (leaf *x509.Certi return leaf, nil } -func retryAfter(v string) time.Duration { - if i, err := strconv.Atoi(v); err == nil { - return time.Duration(i) * time.Second - } - if t, err := http.ParseTime(v); err == nil { - return t.Sub(timeNow()) - } - return time.Second -} - type lockedMathRand struct { sync.Mutex rnd *mathrand.Rand diff --git a/vendor/golang.org/x/crypto/openpgp/keys.go b/vendor/golang.org/x/crypto/openpgp/keys.go index 744e293fe..fd582a89c 100644 --- a/vendor/golang.org/x/crypto/openpgp/keys.go +++ b/vendor/golang.org/x/crypto/openpgp/keys.go @@ -486,7 +486,7 @@ func NewEntity(name, comment, email string, config *packet.Config) (*Entity, err } isPrimaryId := true e.Identities[uid.Id] = &Identity{ - Name: uid.Name, + Name: uid.Id, UserId: uid, SelfSignature: &packet.Signature{ CreationTime: currentTime, @@ -507,6 +507,11 @@ func NewEntity(name, comment, email string, config *packet.Config) (*Entity, err e.Identities[uid.Id].SelfSignature.PreferredHash = []uint8{hashToHashId(config.DefaultHash)} } + // Likewise for DefaultCipher. + if config != nil && config.DefaultCipher != 0 { + e.Identities[uid.Id].SelfSignature.PreferredSymmetric = []uint8{uint8(config.DefaultCipher)} + } + e.Subkeys = make([]Subkey, 1) e.Subkeys[0] = Subkey{ PublicKey: packet.NewRSAPublicKey(currentTime, &encryptingPriv.PublicKey), diff --git a/vendor/golang.org/x/crypto/openpgp/keys_test.go b/vendor/golang.org/x/crypto/openpgp/keys_test.go index 76ba13ed1..3a1550638 100644 --- a/vendor/golang.org/x/crypto/openpgp/keys_test.go +++ b/vendor/golang.org/x/crypto/openpgp/keys_test.go @@ -320,6 +320,56 @@ func TestNewEntityWithoutPreferredHash(t *testing.T) { } } +func TestNewEntityCorrectName(t *testing.T) { + entity, err := NewEntity("Golang Gopher", "Test Key", "no-reply@golang.com", nil) + if err != nil { + t.Fatal(err) + } + if len(entity.Identities) != 1 { + t.Fatalf("len(entity.Identities) = %d, want 1", len(entity.Identities)) + } + var got string + for _, i := range entity.Identities { + got = i.Name + } + want := "Golang Gopher (Test Key) " + if got != want { + t.Fatalf("Identity.Name = %q, want %q", got, want) + } +} + +func TestNewEntityWithPreferredSymmetric(t *testing.T) { + c := &packet.Config{ + DefaultCipher: packet.CipherAES256, + } + entity, err := NewEntity("Golang Gopher", "Test Key", "no-reply@golang.com", c) + if err != nil { + t.Fatal(err) + } + + for _, identity := range entity.Identities { + if len(identity.SelfSignature.PreferredSymmetric) == 0 { + t.Fatal("didn't find a preferred cipher in self signature") + } + if identity.SelfSignature.PreferredSymmetric[0] != uint8(c.DefaultCipher) { + t.Fatalf("Expected preferred cipher to be %d, got %d", uint8(c.DefaultCipher), identity.SelfSignature.PreferredSymmetric[0]) + } + } +} + +func TestNewEntityWithoutPreferredSymmetric(t *testing.T) { + entity, err := NewEntity("Golang Gopher", "Test Key", "no-reply@golang.com", nil) + if err != nil { + t.Fatal(err) + } + + for _, identity := range entity.Identities { + if len(identity.SelfSignature.PreferredSymmetric) != 0 { + t.Fatalf("Expected preferred cipher to be empty but got length %d", len(identity.SelfSignature.PreferredSymmetric)) + } + } +} + const expiringKeyHex = "988d0451d1ec5d010400ba3385721f2dc3f4ab096b2ee867ab77213f0a27a8538441c35d2fa225b08798a1439a66a5150e6bdc3f40f5d28d588c712394c632b6299f77db8c0d48d37903fb72ebd794d61be6aa774688839e5fdecfe06b2684cc115d240c98c66cb1ef22ae84e3aa0c2b0c28665c1e7d4d044e7f270706193f5223c8d44e0d70b7b8da830011010001b40f4578706972792074657374206b657988be041301020028050251d1ec5d021b03050900278d00060b090807030206150802090a0b0416020301021e01021780000a091072589ad75e237d8c033503fd10506d72837834eb7f994117740723adc39227104b0d326a1161871c0b415d25b4aedef946ca77ea4c05af9c22b32cf98be86ab890111fced1ee3f75e87b7cc3c00dc63bbc85dfab91c0dc2ad9de2c4d13a34659333a85c6acc1a669c5e1d6cecb0cf1e56c10e72d855ae177ddc9e766f9b2dda57ccbb75f57156438bbdb4e42b88d0451d1ec5d0104009c64906559866c5cb61578f5846a94fcee142a489c9b41e67b12bb54cfe86eb9bc8566460f9a720cb00d6526fbccfd4f552071a8e3f7744b1882d01036d811ee5a3fb91a1c568055758f43ba5d2c6a9676b012f3a1a89e47bbf624f1ad571b208f3cc6224eb378f1645dd3d47584463f9eadeacfd1ce6f813064fbfdcc4b5a53001101000188a504180102000f021b0c050251d1f06b050900093e89000a091072589ad75e237d8c20e00400ab8310a41461425b37889c4da28129b5fae6084fafbc0a47dd1adc74a264c6e9c9cc125f40462ee1433072a58384daef88c961c390ed06426a81b464a53194c4e291ddd7e2e2ba3efced01537d713bd111f48437bde2363446200995e8e0d4e528dda377fd1e8f8ede9c8e2198b393bd86852ce7457a7e3daf74d510461a5b77b88d0451d1ece8010400b3a519f83ab0010307e83bca895170acce8964a044190a2b368892f7a244758d9fc193482648acb1fb9780d28cc22d171931f38bb40279389fc9bf2110876d4f3db4fcfb13f22f7083877fe56592b3b65251312c36f83ffcb6d313c6a17f197dd471f0712aad15a8537b435a92471ba2e5b0c72a6c72536c3b567c558d7b6051001101000188a504180102000f021b0c050251d1f07b050900279091000a091072589ad75e237d8ce69e03fe286026afacf7c97ee20673864d4459a2240b5655219950643c7dba0ac384b1d4359c67805b21d98211f7b09c2a0ccf6410c8c04d4ff4a51293725d8d6570d9d8bb0e10c07d22357caeb49626df99c180be02d77d1fe8ed25e7a54481237646083a9f89a11566cd20b9e995b1487c5f9e02aeb434f3a1897cd416dd0a87861838da3e9e" const subkeyUsageHex = "988d04533a52bc010400d26af43085558f65b9e7dbc90cb9238015259aed5e954637adcfa2181548b2d0b60c65f1f42ec5081cbf1bc0a8aa4900acfb77070837c58f26012fbce297d70afe96e759ad63531f0037538e70dbf8e384569b9720d99d8eb39d8d0a2947233ed242436cb6ac7dfe74123354b3d0119b5c235d3dd9c9d6c004f8ffaf67ad8583001101000188b7041f010200210502533b8552170c8001ce094aa433f7040bb2ddf0be3893cb843d0fe70c020700000a0910a42704b92866382aa98404009d63d916a27543da4221c60087c33f1c44bec9998c5438018ed370cca4962876c748e94b73eb39c58eb698063f3fd6346d58dd2a11c0247934c4a9d71f24754f7468f96fb24c3e791dd2392b62f626148ad724189498cbf993db2df7c0cdc2d677c35da0f16cb16c9ce7c33b4de65a4a91b1d21a130ae9cc26067718910ef8e2b417556d627261203c756d627261407379642e65642e61753e88b80413010200220502533a52bc021b03060b090807030206150802090a0b0416020301021e01021780000a0910a42704b92866382a47840400c0c2bd04f5fca586de408b395b3c280a278259c93eaaa8b79a53b97003f8ed502a8a00446dd9947fb462677e4fcac0dac2f0701847d15130aadb6cd9e0705ea0cf5f92f129136c7be21a718d46c8e641eb7f044f2adae573e11ae423a0a9ca51324f03a8a2f34b91fa40c3cc764bee4dccadedb54c768ba0469b683ea53f1c29b88d04533a52bc01040099c92a5d6f8b744224da27bc2369127c35269b58bec179de6bbc038f749344222f85a31933224f26b70243c4e4b2d242f0c4777eaef7b5502f9dad6d8bf3aaeb471210674b74de2d7078af497d55f5cdad97c7bedfbc1b41e8065a97c9c3d344b21fc81d27723af8e374bc595da26ea242dccb6ae497be26eea57e563ed517e90011010001889f0418010200090502533a52bc021b0c000a0910a42704b92866382afa1403ff70284c2de8a043ff51d8d29772602fa98009b7861c540535f874f2c230af8caf5638151a636b21f8255003997ccd29747fdd06777bb24f9593bd7d98a3e887689bf902f999915fcc94625ae487e5d13e6616f89090ebc4fdc7eb5cad8943e4056995bb61c6af37f8043016876a958ec7ebf39c43d20d53b7f546cfa83e8d2604b88d04533b8283010400c0b529316dbdf58b4c54461e7e669dc11c09eb7f73819f178ccd4177b9182b91d138605fcf1e463262fabefa73f94a52b5e15d1904635541c7ea540f07050ce0fb51b73e6f88644cec86e91107c957a114f69554548a85295d2b70bd0b203992f76eb5d493d86d9eabcaa7ef3fc7db7e458438db3fcdb0ca1cc97c638439a9170011010001889f0418010200090502533b8283021b0c000a0910a42704b92866382adc6d0400cfff6258485a21675adb7a811c3e19ebca18851533f75a7ba317950b9997fda8d1a4c8c76505c08c04b6c2cc31dc704d33da36a21273f2b388a1a706f7c3378b66d887197a525936ed9a69acb57fe7f718133da85ec742001c5d1864e9c6c8ea1b94f1c3759cebfd93b18606066c063a63be86085b7e37bdbc65f9a915bf084bb901a204533b85cd110400aed3d2c52af2b38b5b67904b0ef73d6dd7aef86adb770e2b153cd22489654dcc91730892087bb9856ae2d9f7ed1eb48f214243fe86bfe87b349ebd7c30e630e49c07b21fdabf78b7a95c8b7f969e97e3d33f2e074c63552ba64a2ded7badc05ce0ea2be6d53485f6900c7860c7aa76560376ce963d7271b9b54638a4028b573f00a0d8854bfcdb04986141568046202192263b9b67350400aaa1049dbc7943141ef590a70dcb028d730371d92ea4863de715f7f0f16d168bd3dc266c2450457d46dcbbf0b071547e5fbee7700a820c3750b236335d8d5848adb3c0da010e998908dfd93d961480084f3aea20b247034f8988eccb5546efaa35a92d0451df3aaf1aee5aa36a4c4d462c760ecd9cebcabfbe1412b1f21450f203fd126687cd486496e971a87fd9e1a8a765fe654baa219a6871ab97768596ab05c26c1aeea8f1a2c72395a58dbc12ef9640d2b95784e974a4d2d5a9b17c25fedacfe551bda52602de8f6d2e48443f5dd1a2a2a8e6a5e70ecdb88cd6e766ad9745c7ee91d78cc55c3d06536b49c3fee6c3d0b6ff0fb2bf13a314f57c953b8f4d93bf88e70418010200090502533b85cd021b0200520910a42704b92866382a47200419110200060502533b85cd000a091042ce2c64bc0ba99214b2009e26b26852c8b13b10c35768e40e78fbbb48bd084100a0c79d9ea0844fa5853dd3c85ff3ecae6f2c9dd6c557aa04008bbbc964cd65b9b8299d4ebf31f41cc7264b8cf33a00e82c5af022331fac79efc9563a822497ba012953cefe2629f1242fcdcb911dbb2315985bab060bfd58261ace3c654bdbbe2e8ed27a46e836490145c86dc7bae15c011f7e1ffc33730109b9338cd9f483e7cef3d2f396aab5bd80efb6646d7e778270ee99d934d187dd98" const revokedKeyHex = "988d045331ce82010400c4fdf7b40a5477f206e6ee278eaef888ca73bf9128a9eef9f2f1ddb8b7b71a4c07cfa241f028a04edb405e4d916c61d6beabc333813dc7b484d2b3c52ee233c6a79b1eea4e9cc51596ba9cd5ac5aeb9df62d86ea051055b79d03f8a4fa9f38386f5bd17529138f3325d46801514ea9047977e0829ed728e68636802796801be10011010001889f04200102000905025331d0e3021d03000a0910a401d9f09a34f7c042aa040086631196405b7e6af71026b88e98012eab44aa9849f6ef3fa930c7c9f23deaedba9db1538830f8652fb7648ec3fcade8dbcbf9eaf428e83c6cbcc272201bfe2fbb90d41963397a7c0637a1a9d9448ce695d9790db2dc95433ad7be19eb3de72dacf1d6db82c3644c13eae2a3d072b99bb341debba012c5ce4006a7d34a1f4b94b444526567205265766f6b657220283c52656727732022424d204261726973746122204b657920262530305c303e5c29203c72656740626d626172697374612e636f2e61753e88b704130102002205025331ce82021b03060b090807030206150802090a0b0416020301021e01021780000a0910a401d9f09a34f7c0019c03f75edfbeb6a73e7225ad3cc52724e2872e04260d7daf0d693c170d8c4b243b8767bc7785763533febc62ec2600c30603c433c095453ede59ff2fcabeb84ce32e0ed9d5cf15ffcbc816202b64370d4d77c1e9077d74e94a16fb4fa2e5bec23a56d7a73cf275f91691ae1801a976fcde09e981a2f6327ac27ea1fecf3185df0d56889c04100102000605025331cfb5000a0910fe9645554e8266b64b4303fc084075396674fb6f778d302ac07cef6bc0b5d07b66b2004c44aef711cbac79617ef06d836b4957522d8772dd94bf41a2f4ac8b1ee6d70c57503f837445a74765a076d07b829b8111fc2a918423ddb817ead7ca2a613ef0bfb9c6b3562aec6c3cf3c75ef3031d81d95f6563e4cdcc9960bcb386c5d757b104fcca5fe11fc709df884604101102000605025331cfe7000a09107b15a67f0b3ddc0317f6009e360beea58f29c1d963a22b962b80788c3fa6c84e009d148cfde6b351469b8eae91187eff07ad9d08fcaab88d045331ce820104009f25e20a42b904f3fa555530fe5c46737cf7bd076c35a2a0d22b11f7e0b61a69320b768f4a80fe13980ce380d1cfc4a0cd8fbe2d2e2ef85416668b77208baa65bf973fe8e500e78cc310d7c8705cdb34328bf80e24f0385fce5845c33bc7943cf6b11b02348a23da0bf6428e57c05135f2dc6bd7c1ce325d666d5a5fd2fd5e410011010001889f04180102000905025331ce82021b0c000a0910a401d9f09a34f7c0418003fe34feafcbeaef348a800a0d908a7a6809cc7304017d820f70f0474d5e23cb17e38b67dc6dca282c6ca00961f4ec9edf2738d0f087b1d81e4871ef08e1798010863afb4eac4c44a376cb343be929c5be66a78cfd4456ae9ec6a99d97f4e1c3ff3583351db2147a65c0acef5c003fb544ab3a2e2dc4d43646f58b811a6c3a369d1f" diff --git a/vendor/golang.org/x/crypto/ssh/client_auth_test.go b/vendor/golang.org/x/crypto/ssh/client_auth_test.go index 145b57a2b..5fbb20d85 100644 --- a/vendor/golang.org/x/crypto/ssh/client_auth_test.go +++ b/vendor/golang.org/x/crypto/ssh/client_auth_test.go @@ -614,8 +614,8 @@ func TestClientAuthErrorList(t *testing.T) { for i, e := range authErrs.Errors { switch i { case 0: - if e.Error() != "no auth passed yet" { - t.Fatalf("errors: got %v, want no auth passed yet", e.Error()) + if e != ErrNoAuth { + t.Fatalf("errors: got error %v, want ErrNoAuth", e) } case 1: if e != publicKeyErr { diff --git a/vendor/golang.org/x/crypto/ssh/keys.go b/vendor/golang.org/x/crypto/ssh/keys.go index dadf41ab7..73697deda 100644 --- a/vendor/golang.org/x/crypto/ssh/keys.go +++ b/vendor/golang.org/x/crypto/ssh/keys.go @@ -276,7 +276,8 @@ type PublicKey interface { Type() string // Marshal returns the serialized key data in SSH wire format, - // with the name prefix. + // with the name prefix. To unmarshal the returned data, use + // the ParsePublicKey function. Marshal() []byte // Verify that sig is a signature on the given data using this diff --git a/vendor/golang.org/x/crypto/ssh/server.go b/vendor/golang.org/x/crypto/ssh/server.go index b83d47388..d0f482531 100644 --- a/vendor/golang.org/x/crypto/ssh/server.go +++ b/vendor/golang.org/x/crypto/ssh/server.go @@ -166,6 +166,9 @@ type ServerConn struct { // unsuccessful, it closes the connection and returns an error. The // Request and NewChannel channels must be serviced, or the connection // will hang. +// +// The returned error may be of type *ServerAuthError for +// authentication errors. func NewServerConn(c net.Conn, config *ServerConfig) (*ServerConn, <-chan NewChannel, <-chan *Request, error) { fullConf := *config fullConf.SetDefaults() @@ -292,12 +295,13 @@ func checkSourceAddress(addr net.Addr, sourceAddrs string) error { return fmt.Errorf("ssh: remote address %v is not allowed because of source-address restriction", addr) } -// ServerAuthError implements the error interface. It appends any authentication -// errors that may occur, and is returned if all of the authentication methods -// provided by the user failed to authenticate. +// ServerAuthError represents server authentication errors and is +// sometimes returned by NewServerConn. It appends any authentication +// errors that may occur, and is returned if all of the authentication +// methods provided by the user failed to authenticate. type ServerAuthError struct { // Errors contains authentication errors returned by the authentication - // callback methods. + // callback methods. The first entry is typically ErrNoAuth. Errors []error } @@ -309,6 +313,13 @@ func (l ServerAuthError) Error() string { return "[" + strings.Join(errs, ", ") + "]" } +// ErrNoAuth is the error value returned if no +// authentication method has been passed yet. This happens as a normal +// part of the authentication loop, since the client first tries +// 'none' authentication to discover available methods. +// It is returned in ServerAuthError.Errors from NewServerConn. +var ErrNoAuth = errors.New("ssh: no auth passed yet") + func (s *connection) serverAuthenticate(config *ServerConfig) (*Permissions, error) { sessionID := s.transport.getSessionID() var cache pubKeyCache @@ -363,7 +374,7 @@ userAuthLoop: } perms = nil - authErr := errors.New("no auth passed yet") + authErr := ErrNoAuth switch userAuthReq.Method { case "none": diff --git a/vendor/golang.org/x/net/bpf/instructions.go b/vendor/golang.org/x/net/bpf/instructions.go index 3b4fd0891..f9dc0e8ee 100644 --- a/vendor/golang.org/x/net/bpf/instructions.go +++ b/vendor/golang.org/x/net/bpf/instructions.go @@ -198,7 +198,7 @@ func (a LoadConstant) Assemble() (RawInstruction, error) { return assembleLoad(a.Dst, 4, opAddrModeImmediate, a.Val) } -// String returns the the instruction in assembler notation. +// String returns the instruction in assembler notation. func (a LoadConstant) String() string { switch a.Dst { case RegA: @@ -224,7 +224,7 @@ func (a LoadScratch) Assemble() (RawInstruction, error) { return assembleLoad(a.Dst, 4, opAddrModeScratch, uint32(a.N)) } -// String returns the the instruction in assembler notation. +// String returns the instruction in assembler notation. func (a LoadScratch) String() string { switch a.Dst { case RegA: @@ -248,7 +248,7 @@ func (a LoadAbsolute) Assemble() (RawInstruction, error) { return assembleLoad(RegA, a.Size, opAddrModeAbsolute, a.Off) } -// String returns the the instruction in assembler notation. +// String returns the instruction in assembler notation. func (a LoadAbsolute) String() string { switch a.Size { case 1: // byte @@ -277,7 +277,7 @@ func (a LoadIndirect) Assemble() (RawInstruction, error) { return assembleLoad(RegA, a.Size, opAddrModeIndirect, a.Off) } -// String returns the the instruction in assembler notation. +// String returns the instruction in assembler notation. func (a LoadIndirect) String() string { switch a.Size { case 1: // byte @@ -306,7 +306,7 @@ func (a LoadMemShift) Assemble() (RawInstruction, error) { return assembleLoad(RegX, 1, opAddrModeMemShift, a.Off) } -// String returns the the instruction in assembler notation. +// String returns the instruction in assembler notation. func (a LoadMemShift) String() string { return fmt.Sprintf("ldx 4*([%d]&0xf)", a.Off) } @@ -325,7 +325,7 @@ func (a LoadExtension) Assemble() (RawInstruction, error) { return assembleLoad(RegA, 4, opAddrModeAbsolute, uint32(extOffset+a.Num)) } -// String returns the the instruction in assembler notation. +// String returns the instruction in assembler notation. func (a LoadExtension) String() string { switch a.Num { case ExtLen: @@ -392,7 +392,7 @@ func (a StoreScratch) Assemble() (RawInstruction, error) { }, nil } -// String returns the the instruction in assembler notation. +// String returns the instruction in assembler notation. func (a StoreScratch) String() string { switch a.Src { case RegA: @@ -418,7 +418,7 @@ func (a ALUOpConstant) Assemble() (RawInstruction, error) { }, nil } -// String returns the the instruction in assembler notation. +// String returns the instruction in assembler notation. func (a ALUOpConstant) String() string { switch a.Op { case ALUOpAdd: @@ -458,7 +458,7 @@ func (a ALUOpX) Assemble() (RawInstruction, error) { }, nil } -// String returns the the instruction in assembler notation. +// String returns the instruction in assembler notation. func (a ALUOpX) String() string { switch a.Op { case ALUOpAdd: @@ -496,7 +496,7 @@ func (a NegateA) Assemble() (RawInstruction, error) { }, nil } -// String returns the the instruction in assembler notation. +// String returns the instruction in assembler notation. func (a NegateA) String() string { return fmt.Sprintf("neg") } @@ -514,7 +514,7 @@ func (a Jump) Assemble() (RawInstruction, error) { }, nil } -// String returns the the instruction in assembler notation. +// String returns the instruction in assembler notation. func (a Jump) String() string { return fmt.Sprintf("ja %d", a.Skip) } @@ -566,7 +566,7 @@ func (a JumpIf) Assemble() (RawInstruction, error) { }, nil } -// String returns the the instruction in assembler notation. +// String returns the instruction in assembler notation. func (a JumpIf) String() string { switch a.Cond { // K == A @@ -621,7 +621,7 @@ func (a RetA) Assemble() (RawInstruction, error) { }, nil } -// String returns the the instruction in assembler notation. +// String returns the instruction in assembler notation. func (a RetA) String() string { return fmt.Sprintf("ret a") } @@ -639,7 +639,7 @@ func (a RetConstant) Assemble() (RawInstruction, error) { }, nil } -// String returns the the instruction in assembler notation. +// String returns the instruction in assembler notation. func (a RetConstant) String() string { return fmt.Sprintf("ret #%d", a.Val) } @@ -654,7 +654,7 @@ func (a TXA) Assemble() (RawInstruction, error) { }, nil } -// String returns the the instruction in assembler notation. +// String returns the instruction in assembler notation. func (a TXA) String() string { return fmt.Sprintf("txa") } @@ -669,7 +669,7 @@ func (a TAX) Assemble() (RawInstruction, error) { }, nil } -// String returns the the instruction in assembler notation. +// String returns the instruction in assembler notation. func (a TAX) String() string { return fmt.Sprintf("tax") } diff --git a/vendor/golang.org/x/net/dns/dnsmessage/message.go b/vendor/golang.org/x/net/dns/dnsmessage/message.go index e98fda66e..624f9b69f 100644 --- a/vendor/golang.org/x/net/dns/dnsmessage/message.go +++ b/vendor/golang.org/x/net/dns/dnsmessage/message.go @@ -273,25 +273,25 @@ type Resource struct { // A ResourceBody is a DNS resource record minus the header. type ResourceBody interface { // pack packs a Resource except for its header. - pack(msg []byte, compression map[string]int) ([]byte, error) + pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) // realType returns the actual type of the Resource. This is used to // fill in the header Type field. realType() Type } -func (r *Resource) pack(msg []byte, compression map[string]int) ([]byte, error) { +func (r *Resource) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { if r.Body == nil { return msg, errNilResouceBody } oldMsg := msg r.Header.Type = r.Body.realType() - msg, length, err := r.Header.pack(msg, compression) + msg, length, err := r.Header.pack(msg, compression, compressionOff) if err != nil { return msg, &nestedError{"ResourceHeader", err} } preLen := len(msg) - msg, err = r.Body.pack(msg, compression) + msg, err = r.Body.pack(msg, compression, compressionOff) if err != nil { return msg, &nestedError{"content", err} } @@ -852,6 +852,7 @@ func (m *Message) AppendPack(b []byte) ([]byte, error) { h.authorities = uint16(len(m.Authorities)) h.additionals = uint16(len(m.Additionals)) + compressionOff := len(b) msg := h.pack(b) // RFC 1035 allows (but does not require) compression for packing. RFC @@ -866,25 +867,25 @@ func (m *Message) AppendPack(b []byte) ([]byte, error) { for i := range m.Questions { var err error - if msg, err = m.Questions[i].pack(msg, compression); err != nil { + if msg, err = m.Questions[i].pack(msg, compression, compressionOff); err != nil { return nil, &nestedError{"packing Question", err} } } for i := range m.Answers { var err error - if msg, err = m.Answers[i].pack(msg, compression); err != nil { + if msg, err = m.Answers[i].pack(msg, compression, compressionOff); err != nil { return nil, &nestedError{"packing Answer", err} } } for i := range m.Authorities { var err error - if msg, err = m.Authorities[i].pack(msg, compression); err != nil { + if msg, err = m.Authorities[i].pack(msg, compression, compressionOff); err != nil { return nil, &nestedError{"packing Authority", err} } } for i := range m.Additionals { var err error - if msg, err = m.Additionals[i].pack(msg, compression); err != nil { + if msg, err = m.Additionals[i].pack(msg, compression, compressionOff); err != nil { return nil, &nestedError{"packing Additional", err} } } @@ -893,36 +894,69 @@ func (m *Message) AppendPack(b []byte) ([]byte, error) { } // A Builder allows incrementally packing a DNS message. +// +// Example usage: +// buf := make([]byte, 2, 514) +// b := NewBuilder(buf, Header{...}) +// b.EnableCompression() +// // Optionally start a section and add things to that section. +// // Repeat adding sections as necessary. +// buf, err := b.Finish() +// // If err is nil, buf[2:] will contain the built bytes. type Builder struct { - msg []byte - header header - section section + // msg is the storage for the message being built. + msg []byte + + // section keeps track of the current section being built. + section section + + // header keeps track of what should go in the header when Finish is + // called. + header header + + // start is the starting index of the bytes allocated in msg for header. + start int + + // compression is a mapping from name suffixes to their starting index + // in msg. compression map[string]int } -// Start initializes the builder. +// NewBuilder creates a new builder with compression disabled. // -// buf is optional (nil is fine), but if provided, Start takes ownership of buf. -func (b *Builder) Start(buf []byte, h Header) { - b.StartWithoutCompression(buf, h) - b.compression = map[string]int{} +// Note: Most users will want to immediately enable compression with the +// EnableCompression method. See that method's comment for why you may or may +// not want to enable compression. +// +// The DNS message is appended to the provided initial buffer buf (which may be +// nil) as it is built. The final message is returned by the (*Builder).Finish +// method, which may return the same underlying array if there was sufficient +// capacity in the slice. +func NewBuilder(buf []byte, h Header) Builder { + if buf == nil { + buf = make([]byte, 0, packStartingCap) + } + b := Builder{msg: buf, start: len(buf)} + b.header.id, b.header.bits = h.pack() + var hb [headerLen]byte + b.msg = append(b.msg, hb[:]...) + b.section = sectionHeader + return b } -// StartWithoutCompression initializes the builder with compression disabled. +// EnableCompression enables compression in the Builder. // -// This avoids compression related allocations, but can result in larger message -// sizes. Be careful with this mode as it can cause messages to exceed the UDP -// size limit. +// Leaving compression disabled avoids compression related allocations, but can +// result in larger message sizes. Be careful with this mode as it can cause +// messages to exceed the UDP size limit. // -// buf is optional (nil is fine), but if provided, Start takes ownership of buf. -func (b *Builder) StartWithoutCompression(buf []byte, h Header) { - *b = Builder{msg: buf} - b.header.id, b.header.bits = h.pack() - if cap(b.msg) < headerLen { - b.msg = make([]byte, 0, packStartingCap) - } - b.msg = b.msg[:headerLen] - b.section = sectionHeader +// According to RFC 1035, section 4.1.4, the use of compression is optional, but +// all implementations must accept both compressed and uncompressed DNS +// messages. +// +// Compression should be enabled before any sections are added for best results. +func (b *Builder) EnableCompression() { + b.compression = map[string]int{} } func (b *Builder) startCheck(s section) error { @@ -1003,7 +1037,7 @@ func (b *Builder) Question(q Question) error { if b.section > sectionQuestions { return ErrSectionDone } - msg, err := q.pack(b.msg, b.compression) + msg, err := q.pack(b.msg, b.compression, b.start) if err != nil { return err } @@ -1030,12 +1064,12 @@ func (b *Builder) CNAMEResource(h ResourceHeader, r CNAMEResource) error { return err } h.Type = r.realType() - msg, length, err := h.pack(b.msg, b.compression) + msg, length, err := h.pack(b.msg, b.compression, b.start) if err != nil { return &nestedError{"ResourceHeader", err} } preLen := len(msg) - if msg, err = r.pack(msg, b.compression); err != nil { + if msg, err = r.pack(msg, b.compression, b.start); err != nil { return &nestedError{"CNAMEResource body", err} } if err := h.fixLen(msg, length, preLen); err != nil { @@ -1054,12 +1088,12 @@ func (b *Builder) MXResource(h ResourceHeader, r MXResource) error { return err } h.Type = r.realType() - msg, length, err := h.pack(b.msg, b.compression) + msg, length, err := h.pack(b.msg, b.compression, b.start) if err != nil { return &nestedError{"ResourceHeader", err} } preLen := len(msg) - if msg, err = r.pack(msg, b.compression); err != nil { + if msg, err = r.pack(msg, b.compression, b.start); err != nil { return &nestedError{"MXResource body", err} } if err := h.fixLen(msg, length, preLen); err != nil { @@ -1078,12 +1112,12 @@ func (b *Builder) NSResource(h ResourceHeader, r NSResource) error { return err } h.Type = r.realType() - msg, length, err := h.pack(b.msg, b.compression) + msg, length, err := h.pack(b.msg, b.compression, b.start) if err != nil { return &nestedError{"ResourceHeader", err} } preLen := len(msg) - if msg, err = r.pack(msg, b.compression); err != nil { + if msg, err = r.pack(msg, b.compression, b.start); err != nil { return &nestedError{"NSResource body", err} } if err := h.fixLen(msg, length, preLen); err != nil { @@ -1102,12 +1136,12 @@ func (b *Builder) PTRResource(h ResourceHeader, r PTRResource) error { return err } h.Type = r.realType() - msg, length, err := h.pack(b.msg, b.compression) + msg, length, err := h.pack(b.msg, b.compression, b.start) if err != nil { return &nestedError{"ResourceHeader", err} } preLen := len(msg) - if msg, err = r.pack(msg, b.compression); err != nil { + if msg, err = r.pack(msg, b.compression, b.start); err != nil { return &nestedError{"PTRResource body", err} } if err := h.fixLen(msg, length, preLen); err != nil { @@ -1126,12 +1160,12 @@ func (b *Builder) SOAResource(h ResourceHeader, r SOAResource) error { return err } h.Type = r.realType() - msg, length, err := h.pack(b.msg, b.compression) + msg, length, err := h.pack(b.msg, b.compression, b.start) if err != nil { return &nestedError{"ResourceHeader", err} } preLen := len(msg) - if msg, err = r.pack(msg, b.compression); err != nil { + if msg, err = r.pack(msg, b.compression, b.start); err != nil { return &nestedError{"SOAResource body", err} } if err := h.fixLen(msg, length, preLen); err != nil { @@ -1150,12 +1184,12 @@ func (b *Builder) TXTResource(h ResourceHeader, r TXTResource) error { return err } h.Type = r.realType() - msg, length, err := h.pack(b.msg, b.compression) + msg, length, err := h.pack(b.msg, b.compression, b.start) if err != nil { return &nestedError{"ResourceHeader", err} } preLen := len(msg) - if msg, err = r.pack(msg, b.compression); err != nil { + if msg, err = r.pack(msg, b.compression, b.start); err != nil { return &nestedError{"TXTResource body", err} } if err := h.fixLen(msg, length, preLen); err != nil { @@ -1174,12 +1208,12 @@ func (b *Builder) SRVResource(h ResourceHeader, r SRVResource) error { return err } h.Type = r.realType() - msg, length, err := h.pack(b.msg, b.compression) + msg, length, err := h.pack(b.msg, b.compression, b.start) if err != nil { return &nestedError{"ResourceHeader", err} } preLen := len(msg) - if msg, err = r.pack(msg, b.compression); err != nil { + if msg, err = r.pack(msg, b.compression, b.start); err != nil { return &nestedError{"SRVResource body", err} } if err := h.fixLen(msg, length, preLen); err != nil { @@ -1198,12 +1232,12 @@ func (b *Builder) AResource(h ResourceHeader, r AResource) error { return err } h.Type = r.realType() - msg, length, err := h.pack(b.msg, b.compression) + msg, length, err := h.pack(b.msg, b.compression, b.start) if err != nil { return &nestedError{"ResourceHeader", err} } preLen := len(msg) - if msg, err = r.pack(msg, b.compression); err != nil { + if msg, err = r.pack(msg, b.compression, b.start); err != nil { return &nestedError{"AResource body", err} } if err := h.fixLen(msg, length, preLen); err != nil { @@ -1222,12 +1256,12 @@ func (b *Builder) AAAAResource(h ResourceHeader, r AAAAResource) error { return err } h.Type = r.realType() - msg, length, err := h.pack(b.msg, b.compression) + msg, length, err := h.pack(b.msg, b.compression, b.start) if err != nil { return &nestedError{"ResourceHeader", err} } preLen := len(msg) - if msg, err = r.pack(msg, b.compression); err != nil { + if msg, err = r.pack(msg, b.compression, b.start); err != nil { return &nestedError{"AAAAResource body", err} } if err := h.fixLen(msg, length, preLen); err != nil { @@ -1246,7 +1280,8 @@ func (b *Builder) Finish() ([]byte, error) { return nil, ErrNotStarted } b.section = sectionDone - b.header.pack(b.msg[:0]) + // Space for the header was allocated in NewBuilder. + b.header.pack(b.msg[b.start:b.start]) return b.msg, nil } @@ -1279,9 +1314,9 @@ type ResourceHeader struct { // pack packs all of the fields in a ResourceHeader except for the length. The // length bytes are returned as a slice so they can be filled in after the rest // of the Resource has been packed. -func (h *ResourceHeader) pack(oldMsg []byte, compression map[string]int) (msg []byte, length []byte, err error) { +func (h *ResourceHeader) pack(oldMsg []byte, compression map[string]int, compressionOff int) (msg []byte, length []byte, err error) { msg = oldMsg - if msg, err = h.Name.pack(msg, compression); err != nil { + if msg, err = h.Name.pack(msg, compression, compressionOff); err != nil { return oldMsg, nil, &nestedError{"Name", err} } msg = packType(msg, h.Type) @@ -1506,7 +1541,7 @@ func (n Name) String() string { // // The compression map will be updated with new domain suffixes. If compression // is nil, compression will not be used. -func (n *Name) pack(msg []byte, compression map[string]int) ([]byte, error) { +func (n *Name) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { oldMsg := msg // Add a trailing dot to canonicalize name. @@ -1558,7 +1593,7 @@ func (n *Name) pack(msg []byte, compression map[string]int) ([]byte, error) { // Miss. Add the suffix to the compression table if the // offset can be stored in the available 14 bytes. if len(msg) <= int(^uint16(0)>>2) { - compression[string(n.Data[i:])] = len(msg) + compression[string(n.Data[i:])] = len(msg) - compressionOff } } } @@ -1681,8 +1716,8 @@ type Question struct { Class Class } -func (q *Question) pack(msg []byte, compression map[string]int) ([]byte, error) { - msg, err := q.Name.pack(msg, compression) +func (q *Question) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { + msg, err := q.Name.pack(msg, compression, compressionOff) if err != nil { return msg, &nestedError{"Name", err} } @@ -1761,8 +1796,8 @@ func (r *CNAMEResource) realType() Type { return TypeCNAME } -func (r *CNAMEResource) pack(msg []byte, compression map[string]int) ([]byte, error) { - return r.CNAME.pack(msg, compression) +func (r *CNAMEResource) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { + return r.CNAME.pack(msg, compression, compressionOff) } func unpackCNAMEResource(msg []byte, off int) (CNAMEResource, error) { @@ -1783,10 +1818,10 @@ func (r *MXResource) realType() Type { return TypeMX } -func (r *MXResource) pack(msg []byte, compression map[string]int) ([]byte, error) { +func (r *MXResource) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { oldMsg := msg msg = packUint16(msg, r.Pref) - msg, err := r.MX.pack(msg, compression) + msg, err := r.MX.pack(msg, compression, compressionOff) if err != nil { return oldMsg, &nestedError{"MXResource.MX", err} } @@ -1814,8 +1849,8 @@ func (r *NSResource) realType() Type { return TypeNS } -func (r *NSResource) pack(msg []byte, compression map[string]int) ([]byte, error) { - return r.NS.pack(msg, compression) +func (r *NSResource) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { + return r.NS.pack(msg, compression, compressionOff) } func unpackNSResource(msg []byte, off int) (NSResource, error) { @@ -1835,8 +1870,8 @@ func (r *PTRResource) realType() Type { return TypePTR } -func (r *PTRResource) pack(msg []byte, compression map[string]int) ([]byte, error) { - return r.PTR.pack(msg, compression) +func (r *PTRResource) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { + return r.PTR.pack(msg, compression, compressionOff) } func unpackPTRResource(msg []byte, off int) (PTRResource, error) { @@ -1866,13 +1901,13 @@ func (r *SOAResource) realType() Type { return TypeSOA } -func (r *SOAResource) pack(msg []byte, compression map[string]int) ([]byte, error) { +func (r *SOAResource) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { oldMsg := msg - msg, err := r.NS.pack(msg, compression) + msg, err := r.NS.pack(msg, compression, compressionOff) if err != nil { return oldMsg, &nestedError{"SOAResource.NS", err} } - msg, err = r.MBox.pack(msg, compression) + msg, err = r.MBox.pack(msg, compression, compressionOff) if err != nil { return oldMsg, &nestedError{"SOAResource.MBox", err} } @@ -1925,7 +1960,7 @@ func (r *TXTResource) realType() Type { return TypeTXT } -func (r *TXTResource) pack(msg []byte, compression map[string]int) ([]byte, error) { +func (r *TXTResource) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { return packText(msg, r.Txt), nil } @@ -1959,12 +1994,12 @@ func (r *SRVResource) realType() Type { return TypeSRV } -func (r *SRVResource) pack(msg []byte, compression map[string]int) ([]byte, error) { +func (r *SRVResource) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { oldMsg := msg msg = packUint16(msg, r.Priority) msg = packUint16(msg, r.Weight) msg = packUint16(msg, r.Port) - msg, err := r.Target.pack(msg, nil) + msg, err := r.Target.pack(msg, nil, compressionOff) if err != nil { return oldMsg, &nestedError{"SRVResource.Target", err} } @@ -2000,7 +2035,7 @@ func (r *AResource) realType() Type { return TypeA } -func (r *AResource) pack(msg []byte, compression map[string]int) ([]byte, error) { +func (r *AResource) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { return packBytes(msg, r.A[:]), nil } @@ -2021,7 +2056,7 @@ func (r *AAAAResource) realType() Type { return TypeAAAA } -func (r *AAAAResource) pack(msg []byte, compression map[string]int) ([]byte, error) { +func (r *AAAAResource) pack(msg []byte, compression map[string]int, compressionOff int) ([]byte, error) { return packBytes(msg, r.AAAA[:]), nil } diff --git a/vendor/golang.org/x/net/dns/dnsmessage/message_test.go b/vendor/golang.org/x/net/dns/dnsmessage/message_test.go index 2bb763420..d4eca26f1 100644 --- a/vendor/golang.org/x/net/dns/dnsmessage/message_test.go +++ b/vendor/golang.org/x/net/dns/dnsmessage/message_test.go @@ -62,7 +62,7 @@ func TestQuestionPackUnpack(t *testing.T) { Type: TypeA, Class: ClassINET, } - buf, err := want.pack(make([]byte, 1, 50), map[string]int{}) + buf, err := want.pack(make([]byte, 1, 50), map[string]int{}, 1) if err != nil { t.Fatal("Packing failed:", err) } @@ -129,7 +129,7 @@ func TestNamePackUnpack(t *testing.T) { for _, test := range tests { in := mustNewName(test.in) want := mustNewName(test.want) - buf, err := in.pack(make([]byte, 0, 30), map[string]int{}) + buf, err := in.pack(make([]byte, 0, 30), map[string]int{}, 0) if err != test.err { t.Errorf("Packing of %q: got err = %v, want err = %v", test.in, err, test.err) continue @@ -248,6 +248,40 @@ func TestDNSPackUnpack(t *testing.T) { } } +func TestDNSAppendPackUnpack(t *testing.T) { + wants := []Message{ + { + Questions: []Question{ + { + Name: mustNewName("."), + Type: TypeAAAA, + Class: ClassINET, + }, + }, + Answers: []Resource{}, + Authorities: []Resource{}, + Additionals: []Resource{}, + }, + largeTestMsg(), + } + for i, want := range wants { + b := make([]byte, 2, 514) + b, err := want.AppendPack(b) + if err != nil { + t.Fatalf("%d: packing failed: %v", i, err) + } + b = b[2:] + var got Message + err = got.Unpack(b) + if err != nil { + t.Fatalf("%d: unpacking failed: %v", i, err) + } + if !reflect.DeepEqual(got, want) { + t.Errorf("%d: got = %+v, want = %+v", i, &got, &want) + } + } +} + func TestSkipAll(t *testing.T) { msg := largeTestMsg() buf, err := msg.Pack() @@ -412,7 +446,7 @@ func TestVeryLongTxt(t *testing.T) { }, &TXTResource{loremIpsum}, } - buf, err := want.pack(make([]byte, 0, 8000), map[string]int{}) + buf, err := want.pack(make([]byte, 0, 8000), map[string]int{}, 0) if err != nil { t.Fatal("Packing failed:", err) } @@ -434,6 +468,26 @@ func TestVeryLongTxt(t *testing.T) { } } +func TestStartAppends(t *testing.T) { + buf := make([]byte, 2, 514) + wantBuf := []byte{4, 44} + copy(buf, wantBuf) + + b := NewBuilder(buf, Header{}) + b.EnableCompression() + + buf, err := b.Finish() + if err != nil { + t.Fatal("Building failed:", err) + } + if got, want := len(buf), headerLen+2; got != want { + t.Errorf("Got len(buf} = %d, want = %d", got, want) + } + if string(buf[:2]) != string(wantBuf) { + t.Errorf("Original data not preserved, got = %v, want = %v", buf[:2], wantBuf) + } +} + func TestStartError(t *testing.T) { tests := []struct { name string @@ -514,8 +568,8 @@ func TestBuilder(t *testing.T) { t.Fatal("Packing without builder:", err) } - var b Builder - b.Start(nil, msg.Header) + b := NewBuilder(nil, msg.Header) + b.EnableCompression() if err := b.StartQuestions(); err != nil { t.Fatal("b.StartQuestions():", err) @@ -653,9 +707,7 @@ func TestResourcePack(t *testing.T) { } } -func BenchmarkParsing(b *testing.B) { - b.ReportAllocs() - +func benchmarkParsingSetup() ([]byte, error) { name := mustNewName("foo.bar.example.com.") msg := Message{ Header: Header{Response: true, Authoritative: true}, @@ -700,111 +752,148 @@ func BenchmarkParsing(b *testing.B) { buf, err := msg.Pack() if err != nil { - b.Fatal("msg.Pack():", err) + return nil, fmt.Errorf("msg.Pack(): %v", err) } + return buf, nil +} - for i := 0; i < b.N; i++ { - var p Parser - if _, err := p.Start(buf); err != nil { - b.Fatal("p.Start(buf):", err) +func benchmarkParsing(tb testing.TB, buf []byte) { + var p Parser + if _, err := p.Start(buf); err != nil { + tb.Fatal("p.Start(buf):", err) + } + + for { + _, err := p.Question() + if err == ErrSectionDone { + break + } + if err != nil { + tb.Fatal("p.Question():", err) } + } - for { - _, err := p.Question() - if err == ErrSectionDone { - break - } - if err != nil { - b.Fatal("p.Question():", err) - } + for { + h, err := p.AnswerHeader() + if err == ErrSectionDone { + break + } + if err != nil { + panic(err) } - for { - h, err := p.AnswerHeader() - if err == ErrSectionDone { - break + switch h.Type { + case TypeA: + if _, err := p.AResource(); err != nil { + tb.Fatal("p.AResource():", err) } - if err != nil { - panic(err) + case TypeAAAA: + if _, err := p.AAAAResource(); err != nil { + tb.Fatal("p.AAAAResource():", err) } - - switch h.Type { - case TypeA: - if _, err := p.AResource(); err != nil { - b.Fatal("p.AResource():", err) - } - case TypeAAAA: - if _, err := p.AAAAResource(); err != nil { - b.Fatal("p.AAAAResource():", err) - } - case TypeCNAME: - if _, err := p.CNAMEResource(); err != nil { - b.Fatal("p.CNAMEResource():", err) - } - case TypeNS: - if _, err := p.NSResource(); err != nil { - b.Fatal("p.NSResource():", err) - } - default: - b.Fatalf("unknown type: %T", h) + case TypeCNAME: + if _, err := p.CNAMEResource(); err != nil { + tb.Fatal("p.CNAMEResource():", err) } + case TypeNS: + if _, err := p.NSResource(); err != nil { + tb.Fatal("p.NSResource():", err) + } + default: + tb.Fatalf("unknown type: %T", h) } } } -func BenchmarkBuilding(b *testing.B) { +func BenchmarkParsing(b *testing.B) { + buf, err := benchmarkParsingSetup() + if err != nil { + b.Fatal(err) + } + b.ReportAllocs() + for i := 0; i < b.N; i++ { + benchmarkParsing(b, buf) + } +} + +func TestParsingAllocs(t *testing.T) { + buf, err := benchmarkParsingSetup() + if err != nil { + t.Fatal(err) + } + if allocs := testing.AllocsPerRun(100, func() { benchmarkParsing(t, buf) }); allocs > 0.5 { + t.Errorf("Allocations during parsing: got = %f, want ~0", allocs) + } +} + +func benchmarkBuildingSetup() (Name, []byte) { name := mustNewName("foo.bar.example.com.") buf := make([]byte, 0, packStartingCap) + return name, buf +} - for i := 0; i < b.N; i++ { - var bld Builder - bld.StartWithoutCompression(buf, Header{Response: true, Authoritative: true}) +func benchmarkBuilding(tb testing.TB, name Name, buf []byte) { + bld := NewBuilder(buf, Header{Response: true, Authoritative: true}) - if err := bld.StartQuestions(); err != nil { - b.Fatal("bld.StartQuestions():", err) - } - q := Question{ - Name: name, - Type: TypeA, - Class: ClassINET, - } - if err := bld.Question(q); err != nil { - b.Fatalf("bld.Question(%+v): %v", q, err) - } + if err := bld.StartQuestions(); err != nil { + tb.Fatal("bld.StartQuestions():", err) + } + q := Question{ + Name: name, + Type: TypeA, + Class: ClassINET, + } + if err := bld.Question(q); err != nil { + tb.Fatalf("bld.Question(%+v): %v", q, err) + } - hdr := ResourceHeader{ - Name: name, - Class: ClassINET, - } - if err := bld.StartAnswers(); err != nil { - b.Fatal("bld.StartQuestions():", err) - } + hdr := ResourceHeader{ + Name: name, + Class: ClassINET, + } + if err := bld.StartAnswers(); err != nil { + tb.Fatal("bld.StartQuestions():", err) + } - ar := AResource{[4]byte{}} - if err := bld.AResource(hdr, ar); err != nil { - b.Fatalf("bld.AResource(%+v, %+v): %v", hdr, ar, err) - } + ar := AResource{[4]byte{}} + if err := bld.AResource(hdr, ar); err != nil { + tb.Fatalf("bld.AResource(%+v, %+v): %v", hdr, ar, err) + } - aaar := AAAAResource{[16]byte{}} - if err := bld.AAAAResource(hdr, aaar); err != nil { - b.Fatalf("bld.AAAAResource(%+v, %+v): %v", hdr, aaar, err) - } + aaar := AAAAResource{[16]byte{}} + if err := bld.AAAAResource(hdr, aaar); err != nil { + tb.Fatalf("bld.AAAAResource(%+v, %+v): %v", hdr, aaar, err) + } - cnr := CNAMEResource{name} - if err := bld.CNAMEResource(hdr, cnr); err != nil { - b.Fatalf("bld.CNAMEResource(%+v, %+v): %v", hdr, cnr, err) - } + cnr := CNAMEResource{name} + if err := bld.CNAMEResource(hdr, cnr); err != nil { + tb.Fatalf("bld.CNAMEResource(%+v, %+v): %v", hdr, cnr, err) + } - nsr := NSResource{name} - if err := bld.NSResource(hdr, nsr); err != nil { - b.Fatalf("bld.NSResource(%+v, %+v): %v", hdr, nsr, err) - } + nsr := NSResource{name} + if err := bld.NSResource(hdr, nsr); err != nil { + tb.Fatalf("bld.NSResource(%+v, %+v): %v", hdr, nsr, err) + } - if _, err := bld.Finish(); err != nil { - b.Fatal("bld.Finish():", err) - } + if _, err := bld.Finish(); err != nil { + tb.Fatal("bld.Finish():", err) + } +} + +func BenchmarkBuilding(b *testing.B) { + name, buf := benchmarkBuildingSetup() + b.ReportAllocs() + for i := 0; i < b.N; i++ { + benchmarkBuilding(b, name, buf) + } +} + +func TestBuildingAllocs(t *testing.T) { + name, buf := benchmarkBuildingSetup() + if allocs := testing.AllocsPerRun(100, func() { benchmarkBuilding(t, name, buf) }); allocs > 0.5 { + t.Errorf("Allocations during building: got = %f, want ~0", allocs) } } diff --git a/vendor/golang.org/x/net/html/const.go b/vendor/golang.org/x/net/html/const.go index b37e62124..5eb7c5a8f 100644 --- a/vendor/golang.org/x/net/html/const.go +++ b/vendor/golang.org/x/net/html/const.go @@ -4,7 +4,7 @@ package html -// Section 12.2.3.2 of the HTML5 specification says "The following elements +// Section 12.2.4.2 of the HTML5 specification says "The following elements // have varying levels of special parsing rules". // https://html.spec.whatwg.org/multipage/syntax.html#the-stack-of-open-elements var isSpecialElementMap = map[string]bool{ diff --git a/vendor/golang.org/x/net/html/foreign.go b/vendor/golang.org/x/net/html/foreign.go index d3b384409..01477a963 100644 --- a/vendor/golang.org/x/net/html/foreign.go +++ b/vendor/golang.org/x/net/html/foreign.go @@ -67,7 +67,7 @@ func mathMLTextIntegrationPoint(n *Node) bool { return false } -// Section 12.2.5.5. +// Section 12.2.6.5. var breakout = map[string]bool{ "b": true, "big": true, @@ -115,7 +115,7 @@ var breakout = map[string]bool{ "var": true, } -// Section 12.2.5.5. +// Section 12.2.6.5. var svgTagNameAdjustments = map[string]string{ "altglyph": "altGlyph", "altglyphdef": "altGlyphDef", @@ -155,7 +155,7 @@ var svgTagNameAdjustments = map[string]string{ "textpath": "textPath", } -// Section 12.2.5.1 +// Section 12.2.6.1 var mathMLAttributeAdjustments = map[string]string{ "definitionurl": "definitionURL", } diff --git a/vendor/golang.org/x/net/html/node.go b/vendor/golang.org/x/net/html/node.go index 26b657aec..6f136c4ef 100644 --- a/vendor/golang.org/x/net/html/node.go +++ b/vendor/golang.org/x/net/html/node.go @@ -21,9 +21,10 @@ const ( scopeMarkerNode ) -// Section 12.2.3.3 says "scope markers are inserted when entering applet -// elements, buttons, object elements, marquees, table cells, and table -// captions, and are used to prevent formatting from 'leaking'". +// Section 12.2.4.3 says "The markers are inserted when entering applet, +// object, marquee, template, td, th, and caption elements, and are used +// to prevent formatting from "leaking" into applet, object, marquee, +// template, td, th, and caption elements". var scopeMarker = Node{Type: scopeMarkerNode} // A Node consists of a NodeType and some Data (tag name for element nodes, diff --git a/vendor/golang.org/x/net/html/parse.go b/vendor/golang.org/x/net/html/parse.go index be4b2bf5a..2a5abddc6 100644 --- a/vendor/golang.org/x/net/html/parse.go +++ b/vendor/golang.org/x/net/html/parse.go @@ -25,12 +25,12 @@ type parser struct { hasSelfClosingToken bool // doc is the document root element. doc *Node - // The stack of open elements (section 12.2.3.2) and active formatting - // elements (section 12.2.3.3). + // The stack of open elements (section 12.2.4.2) and active formatting + // elements (section 12.2.4.3). oe, afe nodeStack - // Element pointers (section 12.2.3.4). + // Element pointers (section 12.2.4.4). head, form *Node - // Other parsing state flags (section 12.2.3.5). + // Other parsing state flags (section 12.2.4.5). scripting, framesetOK bool // im is the current insertion mode. im insertionMode @@ -38,7 +38,7 @@ type parser struct { // or inTableText insertion mode. originalIM insertionMode // fosterParenting is whether new elements should be inserted according to - // the foster parenting rules (section 12.2.5.3). + // the foster parenting rules (section 12.2.6.1). fosterParenting bool // quirks is whether the parser is operating in "quirks mode." quirks bool @@ -56,7 +56,7 @@ func (p *parser) top() *Node { return p.doc } -// Stop tags for use in popUntil. These come from section 12.2.3.2. +// Stop tags for use in popUntil. These come from section 12.2.4.2. var ( defaultScopeStopTags = map[string][]a.Atom{ "": {a.Applet, a.Caption, a.Html, a.Table, a.Td, a.Th, a.Marquee, a.Object, a.Template}, @@ -79,7 +79,7 @@ const ( // popUntil pops the stack of open elements at the highest element whose tag // is in matchTags, provided there is no higher element in the scope's stop -// tags (as defined in section 12.2.3.2). It returns whether or not there was +// tags (as defined in section 12.2.4.2). It returns whether or not there was // such an element. If there was not, popUntil leaves the stack unchanged. // // For example, the set of stop tags for table scope is: "html", "table". If @@ -234,7 +234,7 @@ func (p *parser) shouldFosterParent() bool { } // fosterParent adds a child node according to the foster parenting rules. -// Section 12.2.5.3, "foster parenting". +// Section 12.2.6.1, "foster parenting". func (p *parser) fosterParent(n *Node) { var table, parent, prev *Node var i int @@ -304,7 +304,7 @@ func (p *parser) addElement() { }) } -// Section 12.2.3.3. +// Section 12.2.4.3. func (p *parser) addFormattingElement() { tagAtom, attr := p.tok.DataAtom, p.tok.Attr p.addElement() @@ -351,7 +351,7 @@ findIdenticalElements: p.afe = append(p.afe, p.top()) } -// Section 12.2.3.3. +// Section 12.2.4.3. func (p *parser) clearActiveFormattingElements() { for { n := p.afe.pop() @@ -361,7 +361,7 @@ func (p *parser) clearActiveFormattingElements() { } } -// Section 12.2.3.3. +// Section 12.2.4.3. func (p *parser) reconstructActiveFormattingElements() { n := p.afe.top() if n == nil { @@ -390,12 +390,12 @@ func (p *parser) reconstructActiveFormattingElements() { } } -// Section 12.2.4. +// Section 12.2.5. func (p *parser) acknowledgeSelfClosingTag() { p.hasSelfClosingToken = false } -// An insertion mode (section 12.2.3.1) is the state transition function from +// An insertion mode (section 12.2.4.1) is the state transition function from // a particular state in the HTML5 parser's state machine. It updates the // parser's fields depending on parser.tok (where ErrorToken means EOF). // It returns whether the token was consumed. @@ -403,7 +403,7 @@ type insertionMode func(*parser) bool // setOriginalIM sets the insertion mode to return to after completing a text or // inTableText insertion mode. -// Section 12.2.3.1, "using the rules for". +// Section 12.2.4.1, "using the rules for". func (p *parser) setOriginalIM() { if p.originalIM != nil { panic("html: bad parser state: originalIM was set twice") @@ -411,7 +411,7 @@ func (p *parser) setOriginalIM() { p.originalIM = p.im } -// Section 12.2.3.1, "reset the insertion mode". +// Section 12.2.4.1, "reset the insertion mode". func (p *parser) resetInsertionMode() { for i := len(p.oe) - 1; i >= 0; i-- { n := p.oe[i] @@ -452,7 +452,7 @@ func (p *parser) resetInsertionMode() { const whitespace = " \t\r\n\f" -// Section 12.2.5.4.1. +// Section 12.2.6.4.1. func initialIM(p *parser) bool { switch p.tok.Type { case TextToken: @@ -479,7 +479,7 @@ func initialIM(p *parser) bool { return false } -// Section 12.2.5.4.2. +// Section 12.2.6.4.2. func beforeHTMLIM(p *parser) bool { switch p.tok.Type { case DoctypeToken: @@ -517,7 +517,7 @@ func beforeHTMLIM(p *parser) bool { return false } -// Section 12.2.5.4.3. +// Section 12.2.6.4.3. func beforeHeadIM(p *parser) bool { switch p.tok.Type { case TextToken: @@ -560,7 +560,7 @@ func beforeHeadIM(p *parser) bool { return false } -// Section 12.2.5.4.4. +// Section 12.2.6.4.4. func inHeadIM(p *parser) bool { switch p.tok.Type { case TextToken: @@ -622,7 +622,7 @@ func inHeadIM(p *parser) bool { return false } -// Section 12.2.5.4.6. +// Section 12.2.6.4.6. func afterHeadIM(p *parser) bool { switch p.tok.Type { case TextToken: @@ -697,7 +697,7 @@ func copyAttributes(dst *Node, src Token) { } } -// Section 12.2.5.4.7. +// Section 12.2.6.4.7. func inBodyIM(p *parser) bool { switch p.tok.Type { case TextToken: @@ -1160,7 +1160,7 @@ func (p *parser) inBodyEndTagFormatting(tagAtom a.Atom) { } // inBodyEndTagOther performs the "any other end tag" algorithm for inBodyIM. -// "Any other end tag" handling from 12.2.5.5 The rules for parsing tokens in foreign content +// "Any other end tag" handling from 12.2.6.5 The rules for parsing tokens in foreign content // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inforeign func (p *parser) inBodyEndTagOther(tagAtom a.Atom) { for i := len(p.oe) - 1; i >= 0; i-- { @@ -1174,7 +1174,7 @@ func (p *parser) inBodyEndTagOther(tagAtom a.Atom) { } } -// Section 12.2.5.4.8. +// Section 12.2.6.4.8. func textIM(p *parser) bool { switch p.tok.Type { case ErrorToken: @@ -1203,7 +1203,7 @@ func textIM(p *parser) bool { return p.tok.Type == EndTagToken } -// Section 12.2.5.4.9. +// Section 12.2.6.4.9. func inTableIM(p *parser) bool { switch p.tok.Type { case ErrorToken: @@ -1309,7 +1309,7 @@ func inTableIM(p *parser) bool { return inBodyIM(p) } -// Section 12.2.5.4.11. +// Section 12.2.6.4.11. func inCaptionIM(p *parser) bool { switch p.tok.Type { case StartTagToken: @@ -1355,7 +1355,7 @@ func inCaptionIM(p *parser) bool { return inBodyIM(p) } -// Section 12.2.5.4.12. +// Section 12.2.6.4.12. func inColumnGroupIM(p *parser) bool { switch p.tok.Type { case TextToken: @@ -1408,7 +1408,7 @@ func inColumnGroupIM(p *parser) bool { return true } -// Section 12.2.5.4.13. +// Section 12.2.6.4.13. func inTableBodyIM(p *parser) bool { switch p.tok.Type { case StartTagToken: @@ -1460,7 +1460,7 @@ func inTableBodyIM(p *parser) bool { return inTableIM(p) } -// Section 12.2.5.4.14. +// Section 12.2.6.4.14. func inRowIM(p *parser) bool { switch p.tok.Type { case StartTagToken: @@ -1511,7 +1511,7 @@ func inRowIM(p *parser) bool { return inTableIM(p) } -// Section 12.2.5.4.15. +// Section 12.2.6.4.15. func inCellIM(p *parser) bool { switch p.tok.Type { case StartTagToken: @@ -1560,7 +1560,7 @@ func inCellIM(p *parser) bool { return inBodyIM(p) } -// Section 12.2.5.4.16. +// Section 12.2.6.4.16. func inSelectIM(p *parser) bool { switch p.tok.Type { case ErrorToken: @@ -1632,7 +1632,7 @@ func inSelectIM(p *parser) bool { return true } -// Section 12.2.5.4.17. +// Section 12.2.6.4.17. func inSelectInTableIM(p *parser) bool { switch p.tok.Type { case StartTagToken, EndTagToken: @@ -1650,7 +1650,7 @@ func inSelectInTableIM(p *parser) bool { return inSelectIM(p) } -// Section 12.2.5.4.18. +// Section 12.2.6.4.19. func afterBodyIM(p *parser) bool { switch p.tok.Type { case ErrorToken: @@ -1688,7 +1688,7 @@ func afterBodyIM(p *parser) bool { return false } -// Section 12.2.5.4.19. +// Section 12.2.6.4.20. func inFramesetIM(p *parser) bool { switch p.tok.Type { case CommentToken: @@ -1738,7 +1738,7 @@ func inFramesetIM(p *parser) bool { return true } -// Section 12.2.5.4.20. +// Section 12.2.6.4.21. func afterFramesetIM(p *parser) bool { switch p.tok.Type { case CommentToken: @@ -1777,7 +1777,7 @@ func afterFramesetIM(p *parser) bool { return true } -// Section 12.2.5.4.21. +// Section 12.2.6.4.22. func afterAfterBodyIM(p *parser) bool { switch p.tok.Type { case ErrorToken: @@ -1806,7 +1806,7 @@ func afterAfterBodyIM(p *parser) bool { return false } -// Section 12.2.5.4.22. +// Section 12.2.6.4.23. func afterAfterFramesetIM(p *parser) bool { switch p.tok.Type { case CommentToken: @@ -1844,7 +1844,7 @@ func afterAfterFramesetIM(p *parser) bool { const whitespaceOrNUL = whitespace + "\x00" -// Section 12.2.5.5. +// Section 12.2.6.5 func parseForeignContent(p *parser) bool { switch p.tok.Type { case TextToken: @@ -1924,7 +1924,7 @@ func parseForeignContent(p *parser) bool { return true } -// Section 12.2.5. +// Section 12.2.6. func (p *parser) inForeignContent() bool { if len(p.oe) == 0 { return false diff --git a/vendor/golang.org/x/net/http2/hpack/encode.go b/vendor/golang.org/x/net/http2/hpack/encode.go index 54726c2a3..1565cf270 100644 --- a/vendor/golang.org/x/net/http2/hpack/encode.go +++ b/vendor/golang.org/x/net/http2/hpack/encode.go @@ -206,7 +206,7 @@ func appendVarInt(dst []byte, n byte, i uint64) []byte { } // appendHpackString appends s, as encoded in "String Literal" -// representation, to dst and returns the the extended buffer. +// representation, to dst and returns the extended buffer. // // s will be encoded in Huffman codes only when it produces strictly // shorter byte string. diff --git a/vendor/golang.org/x/net/http2/http2.go b/vendor/golang.org/x/net/http2/http2.go index d565f40e0..71db28a87 100644 --- a/vendor/golang.org/x/net/http2/http2.go +++ b/vendor/golang.org/x/net/http2/http2.go @@ -312,7 +312,7 @@ func mustUint31(v int32) uint32 { } // bodyAllowedForStatus reports whether a given response status code -// permits a body. See RFC 2616, section 4.4. +// permits a body. See RFC 7230, section 3.3. func bodyAllowedForStatus(status int) bool { switch { case status >= 100 && status <= 199: diff --git a/vendor/golang.org/x/net/http2/server.go b/vendor/golang.org/x/net/http2/server.go index 460ede03b..39ed755a8 100644 --- a/vendor/golang.org/x/net/http2/server.go +++ b/vendor/golang.org/x/net/http2/server.go @@ -406,7 +406,7 @@ func (s *Server) ServeConn(c net.Conn, opts *ServeConnOpts) { // addresses during development. // // TODO: optionally enforce? Or enforce at the time we receive - // a new request, and verify the the ServerName matches the :authority? + // a new request, and verify the ServerName matches the :authority? // But that precludes proxy situations, perhaps. // // So for now, do nothing here again. @@ -2285,7 +2285,7 @@ func (rws *responseWriterState) hasTrailers() bool { return len(rws.trailers) != func (rws *responseWriterState) declareTrailer(k string) { k = http.CanonicalHeaderKey(k) if !ValidTrailerHeader(k) { - // Forbidden by RFC 2616 14.40. + // Forbidden by RFC 7230, section 4.1.2. rws.conn.logf("ignoring invalid trailer %q", k) return } @@ -2406,7 +2406,7 @@ const TrailerPrefix = "Trailer:" // after the header has already been flushed. Because the Go // ResponseWriter interface has no way to set Trailers (only the // Header), and because we didn't want to expand the ResponseWriter -// interface, and because nobody used trailers, and because RFC 2616 +// interface, and because nobody used trailers, and because RFC 7230 // says you SHOULD (but not must) predeclare any trailers in the // header, the official ResponseWriter rules said trailers in Go must // be predeclared, and then we reuse the same ResponseWriter.Header() @@ -2790,7 +2790,7 @@ func (sc *serverConn) startPush(msg *startPushRequest) { } // foreachHeaderElement splits v according to the "#rule" construction -// in RFC 2616 section 2.1 and calls fn for each non-empty element. +// in RFC 7230 section 7 and calls fn for each non-empty element. func foreachHeaderElement(v string, fn func(string)) { v = textproto.TrimString(v) if v == "" { diff --git a/vendor/golang.org/x/net/http2/server_test.go b/vendor/golang.org/x/net/http2/server_test.go index bd1ba20d0..c5d8459c1 100644 --- a/vendor/golang.org/x/net/http2/server_test.go +++ b/vendor/golang.org/x/net/http2/server_test.go @@ -2877,9 +2877,9 @@ func testServerWritesTrailers(t *testing.T, withFlush bool) { w.Header().Set("Trailer:post-header-trailer2", "hi2") w.Header().Set("Trailer:Range", "invalid") w.Header().Set("Trailer:Foo\x01Bogus", "invalid") - w.Header().Set("Transfer-Encoding", "should not be included; Forbidden by RFC 2616 14.40") - w.Header().Set("Content-Length", "should not be included; Forbidden by RFC 2616 14.40") - w.Header().Set("Trailer", "should not be included; Forbidden by RFC 2616 14.40") + w.Header().Set("Transfer-Encoding", "should not be included; Forbidden by RFC 7230 4.1.2") + w.Header().Set("Content-Length", "should not be included; Forbidden by RFC 7230 4.1.2") + w.Header().Set("Trailer", "should not be included; Forbidden by RFC 7230 4.1.2") return nil }, func(st *serverTester) { getSlash(st) @@ -2971,7 +2971,7 @@ func BenchmarkServerGets(b *testing.B) { defer st.Close() st.greet() - // Give the server quota to reply. (plus it has the the 64KB) + // Give the server quota to reply. (plus it has the 64KB) if err := st.fr.WriteWindowUpdate(0, uint32(b.N*len(msg))); err != nil { b.Fatal(err) } @@ -3009,7 +3009,7 @@ func BenchmarkServerPosts(b *testing.B) { defer st.Close() st.greet() - // Give the server quota to reply. (plus it has the the 64KB) + // Give the server quota to reply. (plus it has the 64KB) if err := st.fr.WriteWindowUpdate(0, uint32(b.N*len(msg))); err != nil { b.Fatal(err) } @@ -3316,7 +3316,7 @@ func BenchmarkServer_GetRequest(b *testing.B) { defer st.Close() st.greet() - // Give the server quota to reply. (plus it has the the 64KB) + // Give the server quota to reply. (plus it has the 64KB) if err := st.fr.WriteWindowUpdate(0, uint32(b.N*len(msg))); err != nil { b.Fatal(err) } @@ -3347,7 +3347,7 @@ func BenchmarkServer_PostRequest(b *testing.B) { }) defer st.Close() st.greet() - // Give the server quota to reply. (plus it has the the 64KB) + // Give the server quota to reply. (plus it has the 64KB) if err := st.fr.WriteWindowUpdate(0, uint32(b.N*len(msg))); err != nil { b.Fatal(err) } diff --git a/vendor/golang.org/x/net/http2/transport_test.go b/vendor/golang.org/x/net/http2/transport_test.go index adee48cd3..fe04bd287 100644 --- a/vendor/golang.org/x/net/http2/transport_test.go +++ b/vendor/golang.org/x/net/http2/transport_test.go @@ -1693,7 +1693,7 @@ func TestTransportChecksResponseHeaderListSize(t *testing.T) { ct.run() } -// Test that the the Transport returns a typed error from Response.Body.Read calls +// Test that the Transport returns a typed error from Response.Body.Read calls // when the server sends an error. (here we use a panic, since that should generate // a stream error, but others like cancel should be similar) func TestTransportBodyReadErrorType(t *testing.T) { diff --git a/vendor/golang.org/x/sys/unix/linux/Dockerfile b/vendor/golang.org/x/sys/unix/linux/Dockerfile index 7fe5fc3c4..c3b29ea36 100644 --- a/vendor/golang.org/x/sys/unix/linux/Dockerfile +++ b/vendor/golang.org/x/sys/unix/linux/Dockerfile @@ -1,7 +1,4 @@ -FROM ubuntu:16.04 - -# Use the most recent ubuntu sources -RUN echo 'deb http://en.archive.ubuntu.com/ubuntu/ artful main universe' >> /etc/apt/sources.list +FROM ubuntu:17.10 # Dependencies to get the git sources and go binaries RUN apt-get update && apt-get install -y \ @@ -12,15 +9,15 @@ RUN apt-get update && apt-get install -y \ # Get the git sources. If not cached, this takes O(5 minutes). WORKDIR /git RUN git config --global advice.detachedHead false -# Linux Kernel: Released 03 Sep 2017 -RUN git clone --branch v4.13 --depth 1 https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux -# GNU C library: Released 02 Aug 2017 (we should try to get a secure way to clone this) -RUN git clone --branch glibc-2.26 --depth 1 git://sourceware.org/git/glibc.git +# Linux Kernel: Released 28 Jan 2018 +RUN git clone --branch v4.15 --depth 1 https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux +# GNU C library: Released 01 Feb 2018 (we should try to get a secure way to clone this) +RUN git clone --branch glibc-2.27 --depth 1 git://sourceware.org/git/glibc.git -# Get Go 1.9.2 -ENV GOLANG_VERSION 1.9.2 +# Get Go 1.10 +ENV GOLANG_VERSION 1.10 ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz -ENV GOLANG_DOWNLOAD_SHA256 de874549d9a8d8d8062be05808509c09a88a248e77ec14eb77453530829ac02b +ENV GOLANG_DOWNLOAD_SHA256 b5a64335f1490277b585832d1f6c7f8c6c11206cba5cd3f771dcb87b98ad1a33 RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \ && echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \ @@ -31,7 +28,7 @@ ENV PATH /usr/local/go/bin:$PATH # Linux and Glibc build dependencies RUN apt-get update && apt-get install -y \ - gawk make python \ + bison gawk make python \ gcc gcc-multilib \ gettext texinfo \ && rm -rf /var/lib/apt/lists/* diff --git a/vendor/golang.org/x/sys/unix/linux/types.go b/vendor/golang.org/x/sys/unix/linux/types.go index f429c8f78..186a98f16 100644 --- a/vendor/golang.org/x/sys/unix/linux/types.go +++ b/vendor/golang.org/x/sys/unix/linux/types.go @@ -397,97 +397,123 @@ const ( // Netlink routing and interface messages const ( - IFA_UNSPEC = C.IFA_UNSPEC - IFA_ADDRESS = C.IFA_ADDRESS - IFA_LOCAL = C.IFA_LOCAL - IFA_LABEL = C.IFA_LABEL - IFA_BROADCAST = C.IFA_BROADCAST - IFA_ANYCAST = C.IFA_ANYCAST - IFA_CACHEINFO = C.IFA_CACHEINFO - IFA_MULTICAST = C.IFA_MULTICAST - IFLA_UNSPEC = C.IFLA_UNSPEC - IFLA_ADDRESS = C.IFLA_ADDRESS - IFLA_BROADCAST = C.IFLA_BROADCAST - IFLA_IFNAME = C.IFLA_IFNAME - IFLA_MTU = C.IFLA_MTU - IFLA_LINK = C.IFLA_LINK - IFLA_QDISC = C.IFLA_QDISC - IFLA_STATS = C.IFLA_STATS - IFLA_COST = C.IFLA_COST - IFLA_PRIORITY = C.IFLA_PRIORITY - IFLA_MASTER = C.IFLA_MASTER - IFLA_WIRELESS = C.IFLA_WIRELESS - IFLA_PROTINFO = C.IFLA_PROTINFO - IFLA_TXQLEN = C.IFLA_TXQLEN - IFLA_MAP = C.IFLA_MAP - IFLA_WEIGHT = C.IFLA_WEIGHT - IFLA_OPERSTATE = C.IFLA_OPERSTATE - IFLA_LINKMODE = C.IFLA_LINKMODE - IFLA_LINKINFO = C.IFLA_LINKINFO - IFLA_NET_NS_PID = C.IFLA_NET_NS_PID - IFLA_IFALIAS = C.IFLA_IFALIAS - IFLA_MAX = C.IFLA_MAX - RT_SCOPE_UNIVERSE = C.RT_SCOPE_UNIVERSE - RT_SCOPE_SITE = C.RT_SCOPE_SITE - RT_SCOPE_LINK = C.RT_SCOPE_LINK - RT_SCOPE_HOST = C.RT_SCOPE_HOST - RT_SCOPE_NOWHERE = C.RT_SCOPE_NOWHERE - RT_TABLE_UNSPEC = C.RT_TABLE_UNSPEC - RT_TABLE_COMPAT = C.RT_TABLE_COMPAT - RT_TABLE_DEFAULT = C.RT_TABLE_DEFAULT - RT_TABLE_MAIN = C.RT_TABLE_MAIN - RT_TABLE_LOCAL = C.RT_TABLE_LOCAL - RT_TABLE_MAX = C.RT_TABLE_MAX - RTA_UNSPEC = C.RTA_UNSPEC - RTA_DST = C.RTA_DST - RTA_SRC = C.RTA_SRC - RTA_IIF = C.RTA_IIF - RTA_OIF = C.RTA_OIF - RTA_GATEWAY = C.RTA_GATEWAY - RTA_PRIORITY = C.RTA_PRIORITY - RTA_PREFSRC = C.RTA_PREFSRC - RTA_METRICS = C.RTA_METRICS - RTA_MULTIPATH = C.RTA_MULTIPATH - RTA_FLOW = C.RTA_FLOW - RTA_CACHEINFO = C.RTA_CACHEINFO - RTA_TABLE = C.RTA_TABLE - RTN_UNSPEC = C.RTN_UNSPEC - RTN_UNICAST = C.RTN_UNICAST - RTN_LOCAL = C.RTN_LOCAL - RTN_BROADCAST = C.RTN_BROADCAST - RTN_ANYCAST = C.RTN_ANYCAST - RTN_MULTICAST = C.RTN_MULTICAST - RTN_BLACKHOLE = C.RTN_BLACKHOLE - RTN_UNREACHABLE = C.RTN_UNREACHABLE - RTN_PROHIBIT = C.RTN_PROHIBIT - RTN_THROW = C.RTN_THROW - RTN_NAT = C.RTN_NAT - RTN_XRESOLVE = C.RTN_XRESOLVE - RTNLGRP_NONE = C.RTNLGRP_NONE - RTNLGRP_LINK = C.RTNLGRP_LINK - RTNLGRP_NOTIFY = C.RTNLGRP_NOTIFY - RTNLGRP_NEIGH = C.RTNLGRP_NEIGH - RTNLGRP_TC = C.RTNLGRP_TC - RTNLGRP_IPV4_IFADDR = C.RTNLGRP_IPV4_IFADDR - RTNLGRP_IPV4_MROUTE = C.RTNLGRP_IPV4_MROUTE - RTNLGRP_IPV4_ROUTE = C.RTNLGRP_IPV4_ROUTE - RTNLGRP_IPV4_RULE = C.RTNLGRP_IPV4_RULE - RTNLGRP_IPV6_IFADDR = C.RTNLGRP_IPV6_IFADDR - RTNLGRP_IPV6_MROUTE = C.RTNLGRP_IPV6_MROUTE - RTNLGRP_IPV6_ROUTE = C.RTNLGRP_IPV6_ROUTE - RTNLGRP_IPV6_IFINFO = C.RTNLGRP_IPV6_IFINFO - RTNLGRP_IPV6_PREFIX = C.RTNLGRP_IPV6_PREFIX - RTNLGRP_IPV6_RULE = C.RTNLGRP_IPV6_RULE - RTNLGRP_ND_USEROPT = C.RTNLGRP_ND_USEROPT - SizeofNlMsghdr = C.sizeof_struct_nlmsghdr - SizeofNlMsgerr = C.sizeof_struct_nlmsgerr - SizeofRtGenmsg = C.sizeof_struct_rtgenmsg - SizeofNlAttr = C.sizeof_struct_nlattr - SizeofRtAttr = C.sizeof_struct_rtattr - SizeofIfInfomsg = C.sizeof_struct_ifinfomsg - SizeofIfAddrmsg = C.sizeof_struct_ifaddrmsg - SizeofRtMsg = C.sizeof_struct_rtmsg - SizeofRtNexthop = C.sizeof_struct_rtnexthop + IFA_UNSPEC = C.IFA_UNSPEC + IFA_ADDRESS = C.IFA_ADDRESS + IFA_LOCAL = C.IFA_LOCAL + IFA_LABEL = C.IFA_LABEL + IFA_BROADCAST = C.IFA_BROADCAST + IFA_ANYCAST = C.IFA_ANYCAST + IFA_CACHEINFO = C.IFA_CACHEINFO + IFA_MULTICAST = C.IFA_MULTICAST + IFLA_UNSPEC = C.IFLA_UNSPEC + IFLA_ADDRESS = C.IFLA_ADDRESS + IFLA_BROADCAST = C.IFLA_BROADCAST + IFLA_IFNAME = C.IFLA_IFNAME + IFLA_MTU = C.IFLA_MTU + IFLA_LINK = C.IFLA_LINK + IFLA_QDISC = C.IFLA_QDISC + IFLA_STATS = C.IFLA_STATS + IFLA_COST = C.IFLA_COST + IFLA_PRIORITY = C.IFLA_PRIORITY + IFLA_MASTER = C.IFLA_MASTER + IFLA_WIRELESS = C.IFLA_WIRELESS + IFLA_PROTINFO = C.IFLA_PROTINFO + IFLA_TXQLEN = C.IFLA_TXQLEN + IFLA_MAP = C.IFLA_MAP + IFLA_WEIGHT = C.IFLA_WEIGHT + IFLA_OPERSTATE = C.IFLA_OPERSTATE + IFLA_LINKMODE = C.IFLA_LINKMODE + IFLA_LINKINFO = C.IFLA_LINKINFO + IFLA_NET_NS_PID = C.IFLA_NET_NS_PID + IFLA_IFALIAS = C.IFLA_IFALIAS + IFLA_NUM_VF = C.IFLA_NUM_VF + IFLA_VFINFO_LIST = C.IFLA_VFINFO_LIST + IFLA_STATS64 = C.IFLA_STATS64 + IFLA_VF_PORTS = C.IFLA_VF_PORTS + IFLA_PORT_SELF = C.IFLA_PORT_SELF + IFLA_AF_SPEC = C.IFLA_AF_SPEC + IFLA_GROUP = C.IFLA_GROUP + IFLA_NET_NS_FD = C.IFLA_NET_NS_FD + IFLA_EXT_MASK = C.IFLA_EXT_MASK + IFLA_PROMISCUITY = C.IFLA_PROMISCUITY + IFLA_NUM_TX_QUEUES = C.IFLA_NUM_TX_QUEUES + IFLA_NUM_RX_QUEUES = C.IFLA_NUM_RX_QUEUES + IFLA_CARRIER = C.IFLA_CARRIER + IFLA_PHYS_PORT_ID = C.IFLA_PHYS_PORT_ID + IFLA_CARRIER_CHANGES = C.IFLA_CARRIER_CHANGES + IFLA_PHYS_SWITCH_ID = C.IFLA_PHYS_SWITCH_ID + IFLA_LINK_NETNSID = C.IFLA_LINK_NETNSID + IFLA_PHYS_PORT_NAME = C.IFLA_PHYS_PORT_NAME + IFLA_PROTO_DOWN = C.IFLA_PROTO_DOWN + IFLA_GSO_MAX_SEGS = C.IFLA_GSO_MAX_SEGS + IFLA_GSO_MAX_SIZE = C.IFLA_GSO_MAX_SIZE + IFLA_PAD = C.IFLA_PAD + IFLA_XDP = C.IFLA_XDP + IFLA_EVENT = C.IFLA_EVENT + IFLA_NEW_NETNSID = C.IFLA_NEW_NETNSID + IFLA_IF_NETNSID = C.IFLA_IF_NETNSID + IFLA_MAX = C.IFLA_MAX + RT_SCOPE_UNIVERSE = C.RT_SCOPE_UNIVERSE + RT_SCOPE_SITE = C.RT_SCOPE_SITE + RT_SCOPE_LINK = C.RT_SCOPE_LINK + RT_SCOPE_HOST = C.RT_SCOPE_HOST + RT_SCOPE_NOWHERE = C.RT_SCOPE_NOWHERE + RT_TABLE_UNSPEC = C.RT_TABLE_UNSPEC + RT_TABLE_COMPAT = C.RT_TABLE_COMPAT + RT_TABLE_DEFAULT = C.RT_TABLE_DEFAULT + RT_TABLE_MAIN = C.RT_TABLE_MAIN + RT_TABLE_LOCAL = C.RT_TABLE_LOCAL + RT_TABLE_MAX = C.RT_TABLE_MAX + RTA_UNSPEC = C.RTA_UNSPEC + RTA_DST = C.RTA_DST + RTA_SRC = C.RTA_SRC + RTA_IIF = C.RTA_IIF + RTA_OIF = C.RTA_OIF + RTA_GATEWAY = C.RTA_GATEWAY + RTA_PRIORITY = C.RTA_PRIORITY + RTA_PREFSRC = C.RTA_PREFSRC + RTA_METRICS = C.RTA_METRICS + RTA_MULTIPATH = C.RTA_MULTIPATH + RTA_FLOW = C.RTA_FLOW + RTA_CACHEINFO = C.RTA_CACHEINFO + RTA_TABLE = C.RTA_TABLE + RTN_UNSPEC = C.RTN_UNSPEC + RTN_UNICAST = C.RTN_UNICAST + RTN_LOCAL = C.RTN_LOCAL + RTN_BROADCAST = C.RTN_BROADCAST + RTN_ANYCAST = C.RTN_ANYCAST + RTN_MULTICAST = C.RTN_MULTICAST + RTN_BLACKHOLE = C.RTN_BLACKHOLE + RTN_UNREACHABLE = C.RTN_UNREACHABLE + RTN_PROHIBIT = C.RTN_PROHIBIT + RTN_THROW = C.RTN_THROW + RTN_NAT = C.RTN_NAT + RTN_XRESOLVE = C.RTN_XRESOLVE + RTNLGRP_NONE = C.RTNLGRP_NONE + RTNLGRP_LINK = C.RTNLGRP_LINK + RTNLGRP_NOTIFY = C.RTNLGRP_NOTIFY + RTNLGRP_NEIGH = C.RTNLGRP_NEIGH + RTNLGRP_TC = C.RTNLGRP_TC + RTNLGRP_IPV4_IFADDR = C.RTNLGRP_IPV4_IFADDR + RTNLGRP_IPV4_MROUTE = C.RTNLGRP_IPV4_MROUTE + RTNLGRP_IPV4_ROUTE = C.RTNLGRP_IPV4_ROUTE + RTNLGRP_IPV4_RULE = C.RTNLGRP_IPV4_RULE + RTNLGRP_IPV6_IFADDR = C.RTNLGRP_IPV6_IFADDR + RTNLGRP_IPV6_MROUTE = C.RTNLGRP_IPV6_MROUTE + RTNLGRP_IPV6_ROUTE = C.RTNLGRP_IPV6_ROUTE + RTNLGRP_IPV6_IFINFO = C.RTNLGRP_IPV6_IFINFO + RTNLGRP_IPV6_PREFIX = C.RTNLGRP_IPV6_PREFIX + RTNLGRP_IPV6_RULE = C.RTNLGRP_IPV6_RULE + RTNLGRP_ND_USEROPT = C.RTNLGRP_ND_USEROPT + SizeofNlMsghdr = C.sizeof_struct_nlmsghdr + SizeofNlMsgerr = C.sizeof_struct_nlmsgerr + SizeofRtGenmsg = C.sizeof_struct_rtgenmsg + SizeofNlAttr = C.sizeof_struct_nlattr + SizeofRtAttr = C.sizeof_struct_rtattr + SizeofIfInfomsg = C.sizeof_struct_ifinfomsg + SizeofIfAddrmsg = C.sizeof_struct_ifaddrmsg + SizeofRtMsg = C.sizeof_struct_rtmsg + SizeofRtNexthop = C.sizeof_struct_rtnexthop ) type NlMsghdr C.struct_nlmsghdr diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index 4dd40c172..3b5e2c07b 100755 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -364,6 +364,7 @@ ccflags="$@" $2 ~ /^IGN/ || $2 ~ /^IX(ON|ANY|OFF)$/ || $2 ~ /^IN(LCR|PCK)$/ || + $2 !~ "X86_CR3_PCID_NOFLUSH" && $2 ~ /(^FLU?SH)|(FLU?SH$)/ || $2 ~ /^C(LOCAL|READ|MSPAR|RTSCTS)$/ || $2 == "BRKINT" || diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go index 9a8e6e411..c464783d8 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go @@ -23,8 +23,11 @@ package unix //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - ts := Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000} - return Pselect(nfd, r, w, e, &ts, nil) + var ts *Timespec + if timeout != nil { + ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000} + } + return Pselect(nfd, r, w, e, ts, nil) } //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go index 46aa4ff9c..15a69cbdd 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go @@ -26,8 +26,11 @@ package unix //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - ts := Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000} - return Pselect(nfd, r, w, e, &ts, nil) + var ts *Timespec + if timeout != nil { + ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000} + } + return Pselect(nfd, r, w, e, ts, nil) } //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index 4fba476e3..fa0637408 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -121,6 +121,7 @@ const ( ARPHRD_PPP = 0x200 ARPHRD_PRONET = 0x4 ARPHRD_RAWHDLC = 0x206 + ARPHRD_RAWIP = 0x207 ARPHRD_ROSE = 0x10e ARPHRD_RSRVD = 0x104 ARPHRD_SIT = 0x308 @@ -390,6 +391,7 @@ const ( ETH_P_DSA = 0x1b ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada + ETH_P_ERSPAN = 0x88be ETH_P_FCOE = 0x8906 ETH_P_FIP = 0x8914 ETH_P_HDLC = 0x19 @@ -398,6 +400,7 @@ const ( ETH_P_IEEE802154 = 0xf6 ETH_P_IEEEPUP = 0xa00 ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IFE = 0xed3e ETH_P_IP = 0x800 ETH_P_IPV6 = 0x86dd ETH_P_IPX = 0x8137 @@ -408,11 +411,13 @@ const ( ETH_P_LOOP = 0x60 ETH_P_LOOPBACK = 0x9000 ETH_P_MACSEC = 0x88e5 + ETH_P_MAP = 0xf9 ETH_P_MOBITEX = 0x15 ETH_P_MPLS_MC = 0x8848 ETH_P_MPLS_UC = 0x8847 ETH_P_MVRP = 0x88f5 ETH_P_NCSI = 0x88f8 + ETH_P_NSH = 0x894f ETH_P_PAE = 0x888e ETH_P_PAUSE = 0x8808 ETH_P_PHONET = 0xf5 @@ -476,6 +481,7 @@ const ( FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 FS_POLICY_FLAGS_VALID = 0x3 + F_ADD_SEALS = 0x409 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -488,6 +494,9 @@ const ( F_GETOWN_EX = 0x10 F_GETPIPE_SZ = 0x408 F_GETSIG = 0xb + F_GET_FILE_RW_HINT = 0x40d + F_GET_RW_HINT = 0x40b + F_GET_SEALS = 0x40a F_LOCK = 0x1 F_NOTIFY = 0x402 F_OFD_GETLK = 0x24 @@ -495,6 +504,10 @@ const ( F_OFD_SETLKW = 0x26 F_OK = 0x0 F_RDLCK = 0x0 + F_SEAL_GROW = 0x4 + F_SEAL_SEAL = 0x1 + F_SEAL_SHRINK = 0x2 + F_SEAL_WRITE = 0x8 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLEASE = 0x400 @@ -506,6 +519,8 @@ const ( F_SETOWN_EX = 0xf F_SETPIPE_SZ = 0x407 F_SETSIG = 0xa + F_SET_FILE_RW_HINT = 0x40e + F_SET_RW_HINT = 0x40c F_SHLCK = 0x8 F_TEST = 0x3 F_TLOCK = 0x2 @@ -561,6 +576,8 @@ const ( IFF_MASTER = 0x400 IFF_MULTICAST = 0x1000 IFF_MULTI_QUEUE = 0x100 + IFF_NAPI = 0x10 + IFF_NAPI_FRAGS = 0x20 IFF_NOARP = 0x80 IFF_NOFILTER = 0x1000 IFF_NOTRAILERS = 0x20 @@ -845,6 +862,7 @@ const ( MADV_FREE = 0x8 MADV_HUGEPAGE = 0xe MADV_HWPOISON = 0x64 + MADV_KEEPONFORK = 0x13 MADV_MERGEABLE = 0xc MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 @@ -853,6 +871,7 @@ const ( MADV_SEQUENTIAL = 0x2 MADV_UNMERGEABLE = 0xd MADV_WILLNEED = 0x3 + MADV_WIPEONFORK = 0x12 MAP_32BIT = 0x40 MAP_ANON = 0x20 MAP_ANONYMOUS = 0x20 @@ -899,6 +918,7 @@ const ( MSG_TRYHARD = 0x4 MSG_WAITALL = 0x100 MSG_WAITFORONE = 0x10000 + MSG_ZEROCOPY = 0x4000000 MS_ACTIVE = 0x40000000 MS_ASYNC = 0x1 MS_BIND = 0x1000 @@ -998,6 +1018,7 @@ const ( NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 NLM_F_MULTI = 0x2 + NLM_F_NONREC = 0x100 NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 @@ -1196,6 +1217,11 @@ const ( PR_SET_TIMING = 0xe PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 + PR_SVE_GET_VL = 0x33 + PR_SVE_SET_VL = 0x32 + PR_SVE_SET_VL_ONEXEC = 0x40000 + PR_SVE_VL_INHERIT = 0x20000 + PR_SVE_VL_LEN_MASK = 0xffff PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 PR_TIMING_STATISTICAL = 0x0 @@ -1282,6 +1308,7 @@ const ( RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 + RTAX_FASTOPEN_NO_COOKIE = 0x11 RTAX_FEATURES = 0xc RTAX_FEATURE_ALLFRAG = 0x8 RTAX_FEATURE_ECN = 0x1 @@ -1292,7 +1319,7 @@ const ( RTAX_INITCWND = 0xb RTAX_INITRWND = 0xe RTAX_LOCK = 0x1 - RTAX_MAX = 0x10 + RTAX_MAX = 0x11 RTAX_MTU = 0x2 RTAX_QUICKACK = 0xf RTAX_REORDERING = 0x9 @@ -1566,6 +1593,7 @@ const ( SOL_SOCKET = 0x1 SOL_TCP = 0x6 SOL_TIPC = 0x10f + SOL_TLS = 0x11a SOL_X25 = 0x106 SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1e @@ -1634,6 +1662,7 @@ const ( SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 SO_VM_SOCKETS_TRUSTED = 0x5 SO_WIFI_STATUS = 0x29 + SO_ZEROCOPY = 0x3c SPLICE_F_GIFT = 0x8 SPLICE_F_MORE = 0x4 SPLICE_F_MOVE = 0x1 @@ -1730,6 +1759,8 @@ const ( TCP_MAXWIN = 0xffff TCP_MAX_WINSHIFT = 0xe TCP_MD5SIG = 0xe + TCP_MD5SIG_EXT = 0x20 + TCP_MD5SIG_FLAG_PREFIX = 0x1 TCP_MD5SIG_MAXKEYLEN = 0x50 TCP_MSS = 0x200 TCP_MSS_DEFAULT = 0x218 @@ -1750,6 +1781,7 @@ const ( TCP_THIN_DUPACK = 0x11 TCP_THIN_LINEAR_TIMEOUTS = 0x10 TCP_TIMESTAMP = 0x18 + TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa TCSAFLUSH = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index 7e2a108d8..eb2a22f65 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -121,6 +121,7 @@ const ( ARPHRD_PPP = 0x200 ARPHRD_PRONET = 0x4 ARPHRD_RAWHDLC = 0x206 + ARPHRD_RAWIP = 0x207 ARPHRD_ROSE = 0x10e ARPHRD_RSRVD = 0x104 ARPHRD_SIT = 0x308 @@ -390,6 +391,7 @@ const ( ETH_P_DSA = 0x1b ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada + ETH_P_ERSPAN = 0x88be ETH_P_FCOE = 0x8906 ETH_P_FIP = 0x8914 ETH_P_HDLC = 0x19 @@ -398,6 +400,7 @@ const ( ETH_P_IEEE802154 = 0xf6 ETH_P_IEEEPUP = 0xa00 ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IFE = 0xed3e ETH_P_IP = 0x800 ETH_P_IPV6 = 0x86dd ETH_P_IPX = 0x8137 @@ -408,11 +411,13 @@ const ( ETH_P_LOOP = 0x60 ETH_P_LOOPBACK = 0x9000 ETH_P_MACSEC = 0x88e5 + ETH_P_MAP = 0xf9 ETH_P_MOBITEX = 0x15 ETH_P_MPLS_MC = 0x8848 ETH_P_MPLS_UC = 0x8847 ETH_P_MVRP = 0x88f5 ETH_P_NCSI = 0x88f8 + ETH_P_NSH = 0x894f ETH_P_PAE = 0x888e ETH_P_PAUSE = 0x8808 ETH_P_PHONET = 0xf5 @@ -476,6 +481,7 @@ const ( FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 FS_POLICY_FLAGS_VALID = 0x3 + F_ADD_SEALS = 0x409 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -488,6 +494,9 @@ const ( F_GETOWN_EX = 0x10 F_GETPIPE_SZ = 0x408 F_GETSIG = 0xb + F_GET_FILE_RW_HINT = 0x40d + F_GET_RW_HINT = 0x40b + F_GET_SEALS = 0x40a F_LOCK = 0x1 F_NOTIFY = 0x402 F_OFD_GETLK = 0x24 @@ -495,6 +504,10 @@ const ( F_OFD_SETLKW = 0x26 F_OK = 0x0 F_RDLCK = 0x0 + F_SEAL_GROW = 0x4 + F_SEAL_SEAL = 0x1 + F_SEAL_SHRINK = 0x2 + F_SEAL_WRITE = 0x8 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLEASE = 0x400 @@ -506,6 +519,8 @@ const ( F_SETOWN_EX = 0xf F_SETPIPE_SZ = 0x407 F_SETSIG = 0xa + F_SET_FILE_RW_HINT = 0x40e + F_SET_RW_HINT = 0x40c F_SHLCK = 0x8 F_TEST = 0x3 F_TLOCK = 0x2 @@ -561,6 +576,8 @@ const ( IFF_MASTER = 0x400 IFF_MULTICAST = 0x1000 IFF_MULTI_QUEUE = 0x100 + IFF_NAPI = 0x10 + IFF_NAPI_FRAGS = 0x20 IFF_NOARP = 0x80 IFF_NOFILTER = 0x1000 IFF_NOTRAILERS = 0x20 @@ -845,6 +862,7 @@ const ( MADV_FREE = 0x8 MADV_HUGEPAGE = 0xe MADV_HWPOISON = 0x64 + MADV_KEEPONFORK = 0x13 MADV_MERGEABLE = 0xc MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 @@ -853,6 +871,7 @@ const ( MADV_SEQUENTIAL = 0x2 MADV_UNMERGEABLE = 0xd MADV_WILLNEED = 0x3 + MADV_WIPEONFORK = 0x12 MAP_32BIT = 0x40 MAP_ANON = 0x20 MAP_ANONYMOUS = 0x20 @@ -899,6 +918,7 @@ const ( MSG_TRYHARD = 0x4 MSG_WAITALL = 0x100 MSG_WAITFORONE = 0x10000 + MSG_ZEROCOPY = 0x4000000 MS_ACTIVE = 0x40000000 MS_ASYNC = 0x1 MS_BIND = 0x1000 @@ -998,6 +1018,7 @@ const ( NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 NLM_F_MULTI = 0x2 + NLM_F_NONREC = 0x100 NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 @@ -1196,6 +1217,11 @@ const ( PR_SET_TIMING = 0xe PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 + PR_SVE_GET_VL = 0x33 + PR_SVE_SET_VL = 0x32 + PR_SVE_SET_VL_ONEXEC = 0x40000 + PR_SVE_VL_INHERIT = 0x20000 + PR_SVE_VL_LEN_MASK = 0xffff PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 PR_TIMING_STATISTICAL = 0x0 @@ -1283,6 +1309,7 @@ const ( RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 + RTAX_FASTOPEN_NO_COOKIE = 0x11 RTAX_FEATURES = 0xc RTAX_FEATURE_ALLFRAG = 0x8 RTAX_FEATURE_ECN = 0x1 @@ -1293,7 +1320,7 @@ const ( RTAX_INITCWND = 0xb RTAX_INITRWND = 0xe RTAX_LOCK = 0x1 - RTAX_MAX = 0x10 + RTAX_MAX = 0x11 RTAX_MTU = 0x2 RTAX_QUICKACK = 0xf RTAX_REORDERING = 0x9 @@ -1567,6 +1594,7 @@ const ( SOL_SOCKET = 0x1 SOL_TCP = 0x6 SOL_TIPC = 0x10f + SOL_TLS = 0x11a SOL_X25 = 0x106 SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1e @@ -1635,6 +1663,7 @@ const ( SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 SO_VM_SOCKETS_TRUSTED = 0x5 SO_WIFI_STATUS = 0x29 + SO_ZEROCOPY = 0x3c SPLICE_F_GIFT = 0x8 SPLICE_F_MORE = 0x4 SPLICE_F_MOVE = 0x1 @@ -1731,6 +1760,8 @@ const ( TCP_MAXWIN = 0xffff TCP_MAX_WINSHIFT = 0xe TCP_MD5SIG = 0xe + TCP_MD5SIG_EXT = 0x20 + TCP_MD5SIG_FLAG_PREFIX = 0x1 TCP_MD5SIG_MAXKEYLEN = 0x50 TCP_MSS = 0x200 TCP_MSS_DEFAULT = 0x218 @@ -1751,6 +1782,7 @@ const ( TCP_THIN_DUPACK = 0x11 TCP_THIN_LINEAR_TIMEOUTS = 0x10 TCP_TIMESTAMP = 0x18 + TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa TCSAFLUSH = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index 250841bdc..37d212ca4 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -121,6 +121,7 @@ const ( ARPHRD_PPP = 0x200 ARPHRD_PRONET = 0x4 ARPHRD_RAWHDLC = 0x206 + ARPHRD_RAWIP = 0x207 ARPHRD_ROSE = 0x10e ARPHRD_RSRVD = 0x104 ARPHRD_SIT = 0x308 @@ -390,6 +391,7 @@ const ( ETH_P_DSA = 0x1b ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada + ETH_P_ERSPAN = 0x88be ETH_P_FCOE = 0x8906 ETH_P_FIP = 0x8914 ETH_P_HDLC = 0x19 @@ -398,6 +400,7 @@ const ( ETH_P_IEEE802154 = 0xf6 ETH_P_IEEEPUP = 0xa00 ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IFE = 0xed3e ETH_P_IP = 0x800 ETH_P_IPV6 = 0x86dd ETH_P_IPX = 0x8137 @@ -408,11 +411,13 @@ const ( ETH_P_LOOP = 0x60 ETH_P_LOOPBACK = 0x9000 ETH_P_MACSEC = 0x88e5 + ETH_P_MAP = 0xf9 ETH_P_MOBITEX = 0x15 ETH_P_MPLS_MC = 0x8848 ETH_P_MPLS_UC = 0x8847 ETH_P_MVRP = 0x88f5 ETH_P_NCSI = 0x88f8 + ETH_P_NSH = 0x894f ETH_P_PAE = 0x888e ETH_P_PAUSE = 0x8808 ETH_P_PHONET = 0xf5 @@ -476,6 +481,7 @@ const ( FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 FS_POLICY_FLAGS_VALID = 0x3 + F_ADD_SEALS = 0x409 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -488,6 +494,9 @@ const ( F_GETOWN_EX = 0x10 F_GETPIPE_SZ = 0x408 F_GETSIG = 0xb + F_GET_FILE_RW_HINT = 0x40d + F_GET_RW_HINT = 0x40b + F_GET_SEALS = 0x40a F_LOCK = 0x1 F_NOTIFY = 0x402 F_OFD_GETLK = 0x24 @@ -495,6 +504,10 @@ const ( F_OFD_SETLKW = 0x26 F_OK = 0x0 F_RDLCK = 0x0 + F_SEAL_GROW = 0x4 + F_SEAL_SEAL = 0x1 + F_SEAL_SHRINK = 0x2 + F_SEAL_WRITE = 0x8 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLEASE = 0x400 @@ -506,6 +519,8 @@ const ( F_SETOWN_EX = 0xf F_SETPIPE_SZ = 0x407 F_SETSIG = 0xa + F_SET_FILE_RW_HINT = 0x40e + F_SET_RW_HINT = 0x40c F_SHLCK = 0x8 F_TEST = 0x3 F_TLOCK = 0x2 @@ -561,6 +576,8 @@ const ( IFF_MASTER = 0x400 IFF_MULTICAST = 0x1000 IFF_MULTI_QUEUE = 0x100 + IFF_NAPI = 0x10 + IFF_NAPI_FRAGS = 0x20 IFF_NOARP = 0x80 IFF_NOFILTER = 0x1000 IFF_NOTRAILERS = 0x20 @@ -845,6 +862,7 @@ const ( MADV_FREE = 0x8 MADV_HUGEPAGE = 0xe MADV_HWPOISON = 0x64 + MADV_KEEPONFORK = 0x13 MADV_MERGEABLE = 0xc MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 @@ -853,6 +871,7 @@ const ( MADV_SEQUENTIAL = 0x2 MADV_UNMERGEABLE = 0xd MADV_WILLNEED = 0x3 + MADV_WIPEONFORK = 0x12 MAP_ANON = 0x20 MAP_ANONYMOUS = 0x20 MAP_DENYWRITE = 0x800 @@ -898,6 +917,7 @@ const ( MSG_TRYHARD = 0x4 MSG_WAITALL = 0x100 MSG_WAITFORONE = 0x10000 + MSG_ZEROCOPY = 0x4000000 MS_ACTIVE = 0x40000000 MS_ASYNC = 0x1 MS_BIND = 0x1000 @@ -997,6 +1017,7 @@ const ( NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 NLM_F_MULTI = 0x2 + NLM_F_NONREC = 0x100 NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 @@ -1195,6 +1216,11 @@ const ( PR_SET_TIMING = 0xe PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 + PR_SVE_GET_VL = 0x33 + PR_SVE_SET_VL = 0x32 + PR_SVE_SET_VL_ONEXEC = 0x40000 + PR_SVE_VL_INHERIT = 0x20000 + PR_SVE_VL_LEN_MASK = 0xffff PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 PR_TIMING_STATISTICAL = 0x0 @@ -1216,6 +1242,9 @@ const ( PTRACE_EVENT_VFORK_DONE = 0x5 PTRACE_GETCRUNCHREGS = 0x19 PTRACE_GETEVENTMSG = 0x4201 + PTRACE_GETFDPIC = 0x1f + PTRACE_GETFDPIC_EXEC = 0x0 + PTRACE_GETFDPIC_INTERP = 0x1 PTRACE_GETFPREGS = 0xe PTRACE_GETHBPREGS = 0x1d PTRACE_GETREGS = 0xc @@ -1287,6 +1316,7 @@ const ( RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 + RTAX_FASTOPEN_NO_COOKIE = 0x11 RTAX_FEATURES = 0xc RTAX_FEATURE_ALLFRAG = 0x8 RTAX_FEATURE_ECN = 0x1 @@ -1297,7 +1327,7 @@ const ( RTAX_INITCWND = 0xb RTAX_INITRWND = 0xe RTAX_LOCK = 0x1 - RTAX_MAX = 0x10 + RTAX_MAX = 0x11 RTAX_MTU = 0x2 RTAX_QUICKACK = 0xf RTAX_REORDERING = 0x9 @@ -1571,6 +1601,7 @@ const ( SOL_SOCKET = 0x1 SOL_TCP = 0x6 SOL_TIPC = 0x10f + SOL_TLS = 0x11a SOL_X25 = 0x106 SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1e @@ -1639,6 +1670,7 @@ const ( SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 SO_VM_SOCKETS_TRUSTED = 0x5 SO_WIFI_STATUS = 0x29 + SO_ZEROCOPY = 0x3c SPLICE_F_GIFT = 0x8 SPLICE_F_MORE = 0x4 SPLICE_F_MOVE = 0x1 @@ -1735,6 +1767,8 @@ const ( TCP_MAXWIN = 0xffff TCP_MAX_WINSHIFT = 0xe TCP_MD5SIG = 0xe + TCP_MD5SIG_EXT = 0x20 + TCP_MD5SIG_FLAG_PREFIX = 0x1 TCP_MD5SIG_MAXKEYLEN = 0x50 TCP_MSS = 0x200 TCP_MSS_DEFAULT = 0x218 @@ -1755,6 +1789,7 @@ const ( TCP_THIN_DUPACK = 0x11 TCP_THIN_LINEAR_TIMEOUTS = 0x10 TCP_TIMESTAMP = 0x18 + TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa TCSAFLUSH = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index f5d785610..51d84a35c 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -121,6 +121,7 @@ const ( ARPHRD_PPP = 0x200 ARPHRD_PRONET = 0x4 ARPHRD_RAWHDLC = 0x206 + ARPHRD_RAWIP = 0x207 ARPHRD_ROSE = 0x10e ARPHRD_RSRVD = 0x104 ARPHRD_SIT = 0x308 @@ -391,6 +392,7 @@ const ( ETH_P_DSA = 0x1b ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada + ETH_P_ERSPAN = 0x88be ETH_P_FCOE = 0x8906 ETH_P_FIP = 0x8914 ETH_P_HDLC = 0x19 @@ -399,6 +401,7 @@ const ( ETH_P_IEEE802154 = 0xf6 ETH_P_IEEEPUP = 0xa00 ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IFE = 0xed3e ETH_P_IP = 0x800 ETH_P_IPV6 = 0x86dd ETH_P_IPX = 0x8137 @@ -409,11 +412,13 @@ const ( ETH_P_LOOP = 0x60 ETH_P_LOOPBACK = 0x9000 ETH_P_MACSEC = 0x88e5 + ETH_P_MAP = 0xf9 ETH_P_MOBITEX = 0x15 ETH_P_MPLS_MC = 0x8848 ETH_P_MPLS_UC = 0x8847 ETH_P_MVRP = 0x88f5 ETH_P_NCSI = 0x88f8 + ETH_P_NSH = 0x894f ETH_P_PAE = 0x888e ETH_P_PAUSE = 0x8808 ETH_P_PHONET = 0xf5 @@ -478,6 +483,7 @@ const ( FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 FS_POLICY_FLAGS_VALID = 0x3 + F_ADD_SEALS = 0x409 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -490,6 +496,9 @@ const ( F_GETOWN_EX = 0x10 F_GETPIPE_SZ = 0x408 F_GETSIG = 0xb + F_GET_FILE_RW_HINT = 0x40d + F_GET_RW_HINT = 0x40b + F_GET_SEALS = 0x40a F_LOCK = 0x1 F_NOTIFY = 0x402 F_OFD_GETLK = 0x24 @@ -497,6 +506,10 @@ const ( F_OFD_SETLKW = 0x26 F_OK = 0x0 F_RDLCK = 0x0 + F_SEAL_GROW = 0x4 + F_SEAL_SEAL = 0x1 + F_SEAL_SHRINK = 0x2 + F_SEAL_WRITE = 0x8 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLEASE = 0x400 @@ -508,6 +521,8 @@ const ( F_SETOWN_EX = 0xf F_SETPIPE_SZ = 0x407 F_SETSIG = 0xa + F_SET_FILE_RW_HINT = 0x40e + F_SET_RW_HINT = 0x40c F_SHLCK = 0x8 F_TEST = 0x3 F_TLOCK = 0x2 @@ -563,6 +578,8 @@ const ( IFF_MASTER = 0x400 IFF_MULTICAST = 0x1000 IFF_MULTI_QUEUE = 0x100 + IFF_NAPI = 0x10 + IFF_NAPI_FRAGS = 0x20 IFF_NOARP = 0x80 IFF_NOFILTER = 0x1000 IFF_NOTRAILERS = 0x20 @@ -847,6 +864,7 @@ const ( MADV_FREE = 0x8 MADV_HUGEPAGE = 0xe MADV_HWPOISON = 0x64 + MADV_KEEPONFORK = 0x13 MADV_MERGEABLE = 0xc MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 @@ -855,6 +873,7 @@ const ( MADV_SEQUENTIAL = 0x2 MADV_UNMERGEABLE = 0xd MADV_WILLNEED = 0x3 + MADV_WIPEONFORK = 0x12 MAP_ANON = 0x20 MAP_ANONYMOUS = 0x20 MAP_DENYWRITE = 0x800 @@ -900,6 +919,7 @@ const ( MSG_TRYHARD = 0x4 MSG_WAITALL = 0x100 MSG_WAITFORONE = 0x10000 + MSG_ZEROCOPY = 0x4000000 MS_ACTIVE = 0x40000000 MS_ASYNC = 0x1 MS_BIND = 0x1000 @@ -999,6 +1019,7 @@ const ( NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 NLM_F_MULTI = 0x2 + NLM_F_NONREC = 0x100 NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 @@ -1197,6 +1218,11 @@ const ( PR_SET_TIMING = 0xe PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 + PR_SVE_GET_VL = 0x33 + PR_SVE_SET_VL = 0x32 + PR_SVE_SET_VL_ONEXEC = 0x40000 + PR_SVE_VL_INHERIT = 0x20000 + PR_SVE_VL_LEN_MASK = 0xffff PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 PR_TIMING_STATISTICAL = 0x0 @@ -1273,6 +1299,7 @@ const ( RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 + RTAX_FASTOPEN_NO_COOKIE = 0x11 RTAX_FEATURES = 0xc RTAX_FEATURE_ALLFRAG = 0x8 RTAX_FEATURE_ECN = 0x1 @@ -1283,7 +1310,7 @@ const ( RTAX_INITCWND = 0xb RTAX_INITRWND = 0xe RTAX_LOCK = 0x1 - RTAX_MAX = 0x10 + RTAX_MAX = 0x11 RTAX_MTU = 0x2 RTAX_QUICKACK = 0xf RTAX_REORDERING = 0x9 @@ -1557,6 +1584,7 @@ const ( SOL_SOCKET = 0x1 SOL_TCP = 0x6 SOL_TIPC = 0x10f + SOL_TLS = 0x11a SOL_X25 = 0x106 SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1e @@ -1625,6 +1653,7 @@ const ( SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 SO_VM_SOCKETS_TRUSTED = 0x5 SO_WIFI_STATUS = 0x29 + SO_ZEROCOPY = 0x3c SPLICE_F_GIFT = 0x8 SPLICE_F_MORE = 0x4 SPLICE_F_MOVE = 0x1 @@ -1721,6 +1750,8 @@ const ( TCP_MAXWIN = 0xffff TCP_MAX_WINSHIFT = 0xe TCP_MD5SIG = 0xe + TCP_MD5SIG_EXT = 0x20 + TCP_MD5SIG_FLAG_PREFIX = 0x1 TCP_MD5SIG_MAXKEYLEN = 0x50 TCP_MSS = 0x200 TCP_MSS_DEFAULT = 0x218 @@ -1741,6 +1772,7 @@ const ( TCP_THIN_DUPACK = 0x11 TCP_THIN_LINEAR_TIMEOUTS = 0x10 TCP_TIMESTAMP = 0x18 + TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa TCSAFLUSH = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index f45492db5..8aec95d6c 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -121,6 +121,7 @@ const ( ARPHRD_PPP = 0x200 ARPHRD_PRONET = 0x4 ARPHRD_RAWHDLC = 0x206 + ARPHRD_RAWIP = 0x207 ARPHRD_ROSE = 0x10e ARPHRD_RSRVD = 0x104 ARPHRD_SIT = 0x308 @@ -390,6 +391,7 @@ const ( ETH_P_DSA = 0x1b ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada + ETH_P_ERSPAN = 0x88be ETH_P_FCOE = 0x8906 ETH_P_FIP = 0x8914 ETH_P_HDLC = 0x19 @@ -398,6 +400,7 @@ const ( ETH_P_IEEE802154 = 0xf6 ETH_P_IEEEPUP = 0xa00 ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IFE = 0xed3e ETH_P_IP = 0x800 ETH_P_IPV6 = 0x86dd ETH_P_IPX = 0x8137 @@ -408,11 +411,13 @@ const ( ETH_P_LOOP = 0x60 ETH_P_LOOPBACK = 0x9000 ETH_P_MACSEC = 0x88e5 + ETH_P_MAP = 0xf9 ETH_P_MOBITEX = 0x15 ETH_P_MPLS_MC = 0x8848 ETH_P_MPLS_UC = 0x8847 ETH_P_MVRP = 0x88f5 ETH_P_NCSI = 0x88f8 + ETH_P_NSH = 0x894f ETH_P_PAE = 0x888e ETH_P_PAUSE = 0x8808 ETH_P_PHONET = 0xf5 @@ -476,6 +481,7 @@ const ( FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 FS_POLICY_FLAGS_VALID = 0x3 + F_ADD_SEALS = 0x409 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -488,6 +494,9 @@ const ( F_GETOWN_EX = 0x10 F_GETPIPE_SZ = 0x408 F_GETSIG = 0xb + F_GET_FILE_RW_HINT = 0x40d + F_GET_RW_HINT = 0x40b + F_GET_SEALS = 0x40a F_LOCK = 0x1 F_NOTIFY = 0x402 F_OFD_GETLK = 0x24 @@ -495,6 +504,10 @@ const ( F_OFD_SETLKW = 0x26 F_OK = 0x0 F_RDLCK = 0x0 + F_SEAL_GROW = 0x4 + F_SEAL_SEAL = 0x1 + F_SEAL_SHRINK = 0x2 + F_SEAL_WRITE = 0x8 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLEASE = 0x400 @@ -506,6 +519,8 @@ const ( F_SETOWN_EX = 0xf F_SETPIPE_SZ = 0x407 F_SETSIG = 0xa + F_SET_FILE_RW_HINT = 0x40e + F_SET_RW_HINT = 0x40c F_SHLCK = 0x8 F_TEST = 0x3 F_TLOCK = 0x2 @@ -561,6 +576,8 @@ const ( IFF_MASTER = 0x400 IFF_MULTICAST = 0x1000 IFF_MULTI_QUEUE = 0x100 + IFF_NAPI = 0x10 + IFF_NAPI_FRAGS = 0x20 IFF_NOARP = 0x80 IFF_NOFILTER = 0x1000 IFF_NOTRAILERS = 0x20 @@ -845,6 +862,7 @@ const ( MADV_FREE = 0x8 MADV_HUGEPAGE = 0xe MADV_HWPOISON = 0x64 + MADV_KEEPONFORK = 0x13 MADV_MERGEABLE = 0xc MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 @@ -853,6 +871,7 @@ const ( MADV_SEQUENTIAL = 0x2 MADV_UNMERGEABLE = 0xd MADV_WILLNEED = 0x3 + MADV_WIPEONFORK = 0x12 MAP_ANON = 0x800 MAP_ANONYMOUS = 0x800 MAP_DENYWRITE = 0x2000 @@ -899,6 +918,7 @@ const ( MSG_TRYHARD = 0x4 MSG_WAITALL = 0x100 MSG_WAITFORONE = 0x10000 + MSG_ZEROCOPY = 0x4000000 MS_ACTIVE = 0x40000000 MS_ASYNC = 0x1 MS_BIND = 0x1000 @@ -998,6 +1018,7 @@ const ( NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 NLM_F_MULTI = 0x2 + NLM_F_NONREC = 0x100 NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 @@ -1196,6 +1217,11 @@ const ( PR_SET_TIMING = 0xe PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 + PR_SVE_GET_VL = 0x33 + PR_SVE_SET_VL = 0x32 + PR_SVE_SET_VL_ONEXEC = 0x40000 + PR_SVE_VL_INHERIT = 0x20000 + PR_SVE_VL_LEN_MASK = 0xffff PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 PR_TIMING_STATISTICAL = 0x0 @@ -1284,6 +1310,7 @@ const ( RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 + RTAX_FASTOPEN_NO_COOKIE = 0x11 RTAX_FEATURES = 0xc RTAX_FEATURE_ALLFRAG = 0x8 RTAX_FEATURE_ECN = 0x1 @@ -1294,7 +1321,7 @@ const ( RTAX_INITCWND = 0xb RTAX_INITRWND = 0xe RTAX_LOCK = 0x1 - RTAX_MAX = 0x10 + RTAX_MAX = 0x11 RTAX_MTU = 0x2 RTAX_QUICKACK = 0xf RTAX_REORDERING = 0x9 @@ -1568,6 +1595,7 @@ const ( SOL_SOCKET = 0xffff SOL_TCP = 0x6 SOL_TIPC = 0x10f + SOL_TLS = 0x11a SOL_X25 = 0x106 SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1009 @@ -1637,6 +1665,7 @@ const ( SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 SO_VM_SOCKETS_TRUSTED = 0x5 SO_WIFI_STATUS = 0x29 + SO_ZEROCOPY = 0x3c SPLICE_F_GIFT = 0x8 SPLICE_F_MORE = 0x4 SPLICE_F_MOVE = 0x1 @@ -1732,6 +1761,8 @@ const ( TCP_MAXWIN = 0xffff TCP_MAX_WINSHIFT = 0xe TCP_MD5SIG = 0xe + TCP_MD5SIG_EXT = 0x20 + TCP_MD5SIG_FLAG_PREFIX = 0x1 TCP_MD5SIG_MAXKEYLEN = 0x50 TCP_MSS = 0x200 TCP_MSS_DEFAULT = 0x218 @@ -1752,6 +1783,7 @@ const ( TCP_THIN_DUPACK = 0x11 TCP_THIN_LINEAR_TIMEOUTS = 0x10 TCP_TIMESTAMP = 0x18 + TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa TCSAFLUSH = 0x5410 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index f5a64fba6..423f48ae0 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -121,6 +121,7 @@ const ( ARPHRD_PPP = 0x200 ARPHRD_PRONET = 0x4 ARPHRD_RAWHDLC = 0x206 + ARPHRD_RAWIP = 0x207 ARPHRD_ROSE = 0x10e ARPHRD_RSRVD = 0x104 ARPHRD_SIT = 0x308 @@ -390,6 +391,7 @@ const ( ETH_P_DSA = 0x1b ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada + ETH_P_ERSPAN = 0x88be ETH_P_FCOE = 0x8906 ETH_P_FIP = 0x8914 ETH_P_HDLC = 0x19 @@ -398,6 +400,7 @@ const ( ETH_P_IEEE802154 = 0xf6 ETH_P_IEEEPUP = 0xa00 ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IFE = 0xed3e ETH_P_IP = 0x800 ETH_P_IPV6 = 0x86dd ETH_P_IPX = 0x8137 @@ -408,11 +411,13 @@ const ( ETH_P_LOOP = 0x60 ETH_P_LOOPBACK = 0x9000 ETH_P_MACSEC = 0x88e5 + ETH_P_MAP = 0xf9 ETH_P_MOBITEX = 0x15 ETH_P_MPLS_MC = 0x8848 ETH_P_MPLS_UC = 0x8847 ETH_P_MVRP = 0x88f5 ETH_P_NCSI = 0x88f8 + ETH_P_NSH = 0x894f ETH_P_PAE = 0x888e ETH_P_PAUSE = 0x8808 ETH_P_PHONET = 0xf5 @@ -476,6 +481,7 @@ const ( FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 FS_POLICY_FLAGS_VALID = 0x3 + F_ADD_SEALS = 0x409 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -488,6 +494,9 @@ const ( F_GETOWN_EX = 0x10 F_GETPIPE_SZ = 0x408 F_GETSIG = 0xb + F_GET_FILE_RW_HINT = 0x40d + F_GET_RW_HINT = 0x40b + F_GET_SEALS = 0x40a F_LOCK = 0x1 F_NOTIFY = 0x402 F_OFD_GETLK = 0x24 @@ -495,6 +504,10 @@ const ( F_OFD_SETLKW = 0x26 F_OK = 0x0 F_RDLCK = 0x0 + F_SEAL_GROW = 0x4 + F_SEAL_SEAL = 0x1 + F_SEAL_SHRINK = 0x2 + F_SEAL_WRITE = 0x8 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLEASE = 0x400 @@ -506,6 +519,8 @@ const ( F_SETOWN_EX = 0xf F_SETPIPE_SZ = 0x407 F_SETSIG = 0xa + F_SET_FILE_RW_HINT = 0x40e + F_SET_RW_HINT = 0x40c F_SHLCK = 0x8 F_TEST = 0x3 F_TLOCK = 0x2 @@ -561,6 +576,8 @@ const ( IFF_MASTER = 0x400 IFF_MULTICAST = 0x1000 IFF_MULTI_QUEUE = 0x100 + IFF_NAPI = 0x10 + IFF_NAPI_FRAGS = 0x20 IFF_NOARP = 0x80 IFF_NOFILTER = 0x1000 IFF_NOTRAILERS = 0x20 @@ -845,6 +862,7 @@ const ( MADV_FREE = 0x8 MADV_HUGEPAGE = 0xe MADV_HWPOISON = 0x64 + MADV_KEEPONFORK = 0x13 MADV_MERGEABLE = 0xc MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 @@ -853,6 +871,7 @@ const ( MADV_SEQUENTIAL = 0x2 MADV_UNMERGEABLE = 0xd MADV_WILLNEED = 0x3 + MADV_WIPEONFORK = 0x12 MAP_ANON = 0x800 MAP_ANONYMOUS = 0x800 MAP_DENYWRITE = 0x2000 @@ -899,6 +918,7 @@ const ( MSG_TRYHARD = 0x4 MSG_WAITALL = 0x100 MSG_WAITFORONE = 0x10000 + MSG_ZEROCOPY = 0x4000000 MS_ACTIVE = 0x40000000 MS_ASYNC = 0x1 MS_BIND = 0x1000 @@ -998,6 +1018,7 @@ const ( NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 NLM_F_MULTI = 0x2 + NLM_F_NONREC = 0x100 NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 @@ -1196,6 +1217,11 @@ const ( PR_SET_TIMING = 0xe PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 + PR_SVE_GET_VL = 0x33 + PR_SVE_SET_VL = 0x32 + PR_SVE_SET_VL_ONEXEC = 0x40000 + PR_SVE_VL_INHERIT = 0x20000 + PR_SVE_VL_LEN_MASK = 0xffff PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 PR_TIMING_STATISTICAL = 0x0 @@ -1284,6 +1310,7 @@ const ( RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 + RTAX_FASTOPEN_NO_COOKIE = 0x11 RTAX_FEATURES = 0xc RTAX_FEATURE_ALLFRAG = 0x8 RTAX_FEATURE_ECN = 0x1 @@ -1294,7 +1321,7 @@ const ( RTAX_INITCWND = 0xb RTAX_INITRWND = 0xe RTAX_LOCK = 0x1 - RTAX_MAX = 0x10 + RTAX_MAX = 0x11 RTAX_MTU = 0x2 RTAX_QUICKACK = 0xf RTAX_REORDERING = 0x9 @@ -1568,6 +1595,7 @@ const ( SOL_SOCKET = 0xffff SOL_TCP = 0x6 SOL_TIPC = 0x10f + SOL_TLS = 0x11a SOL_X25 = 0x106 SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1009 @@ -1637,6 +1665,7 @@ const ( SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 SO_VM_SOCKETS_TRUSTED = 0x5 SO_WIFI_STATUS = 0x29 + SO_ZEROCOPY = 0x3c SPLICE_F_GIFT = 0x8 SPLICE_F_MORE = 0x4 SPLICE_F_MOVE = 0x1 @@ -1732,6 +1761,8 @@ const ( TCP_MAXWIN = 0xffff TCP_MAX_WINSHIFT = 0xe TCP_MD5SIG = 0xe + TCP_MD5SIG_EXT = 0x20 + TCP_MD5SIG_FLAG_PREFIX = 0x1 TCP_MD5SIG_MAXKEYLEN = 0x50 TCP_MSS = 0x200 TCP_MSS_DEFAULT = 0x218 @@ -1752,6 +1783,7 @@ const ( TCP_THIN_DUPACK = 0x11 TCP_THIN_LINEAR_TIMEOUTS = 0x10 TCP_TIMESTAMP = 0x18 + TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa TCSAFLUSH = 0x5410 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index db6d556b2..5e4060701 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -121,6 +121,7 @@ const ( ARPHRD_PPP = 0x200 ARPHRD_PRONET = 0x4 ARPHRD_RAWHDLC = 0x206 + ARPHRD_RAWIP = 0x207 ARPHRD_ROSE = 0x10e ARPHRD_RSRVD = 0x104 ARPHRD_SIT = 0x308 @@ -390,6 +391,7 @@ const ( ETH_P_DSA = 0x1b ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada + ETH_P_ERSPAN = 0x88be ETH_P_FCOE = 0x8906 ETH_P_FIP = 0x8914 ETH_P_HDLC = 0x19 @@ -398,6 +400,7 @@ const ( ETH_P_IEEE802154 = 0xf6 ETH_P_IEEEPUP = 0xa00 ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IFE = 0xed3e ETH_P_IP = 0x800 ETH_P_IPV6 = 0x86dd ETH_P_IPX = 0x8137 @@ -408,11 +411,13 @@ const ( ETH_P_LOOP = 0x60 ETH_P_LOOPBACK = 0x9000 ETH_P_MACSEC = 0x88e5 + ETH_P_MAP = 0xf9 ETH_P_MOBITEX = 0x15 ETH_P_MPLS_MC = 0x8848 ETH_P_MPLS_UC = 0x8847 ETH_P_MVRP = 0x88f5 ETH_P_NCSI = 0x88f8 + ETH_P_NSH = 0x894f ETH_P_PAE = 0x888e ETH_P_PAUSE = 0x8808 ETH_P_PHONET = 0xf5 @@ -476,6 +481,7 @@ const ( FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 FS_POLICY_FLAGS_VALID = 0x3 + F_ADD_SEALS = 0x409 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -488,6 +494,9 @@ const ( F_GETOWN_EX = 0x10 F_GETPIPE_SZ = 0x408 F_GETSIG = 0xb + F_GET_FILE_RW_HINT = 0x40d + F_GET_RW_HINT = 0x40b + F_GET_SEALS = 0x40a F_LOCK = 0x1 F_NOTIFY = 0x402 F_OFD_GETLK = 0x24 @@ -495,6 +504,10 @@ const ( F_OFD_SETLKW = 0x26 F_OK = 0x0 F_RDLCK = 0x0 + F_SEAL_GROW = 0x4 + F_SEAL_SEAL = 0x1 + F_SEAL_SHRINK = 0x2 + F_SEAL_WRITE = 0x8 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLEASE = 0x400 @@ -506,6 +519,8 @@ const ( F_SETOWN_EX = 0xf F_SETPIPE_SZ = 0x407 F_SETSIG = 0xa + F_SET_FILE_RW_HINT = 0x40e + F_SET_RW_HINT = 0x40c F_SHLCK = 0x8 F_TEST = 0x3 F_TLOCK = 0x2 @@ -561,6 +576,8 @@ const ( IFF_MASTER = 0x400 IFF_MULTICAST = 0x1000 IFF_MULTI_QUEUE = 0x100 + IFF_NAPI = 0x10 + IFF_NAPI_FRAGS = 0x20 IFF_NOARP = 0x80 IFF_NOFILTER = 0x1000 IFF_NOTRAILERS = 0x20 @@ -845,6 +862,7 @@ const ( MADV_FREE = 0x8 MADV_HUGEPAGE = 0xe MADV_HWPOISON = 0x64 + MADV_KEEPONFORK = 0x13 MADV_MERGEABLE = 0xc MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 @@ -853,6 +871,7 @@ const ( MADV_SEQUENTIAL = 0x2 MADV_UNMERGEABLE = 0xd MADV_WILLNEED = 0x3 + MADV_WIPEONFORK = 0x12 MAP_ANON = 0x800 MAP_ANONYMOUS = 0x800 MAP_DENYWRITE = 0x2000 @@ -899,6 +918,7 @@ const ( MSG_TRYHARD = 0x4 MSG_WAITALL = 0x100 MSG_WAITFORONE = 0x10000 + MSG_ZEROCOPY = 0x4000000 MS_ACTIVE = 0x40000000 MS_ASYNC = 0x1 MS_BIND = 0x1000 @@ -998,6 +1018,7 @@ const ( NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 NLM_F_MULTI = 0x2 + NLM_F_NONREC = 0x100 NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 @@ -1196,6 +1217,11 @@ const ( PR_SET_TIMING = 0xe PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 + PR_SVE_GET_VL = 0x33 + PR_SVE_SET_VL = 0x32 + PR_SVE_SET_VL_ONEXEC = 0x40000 + PR_SVE_VL_INHERIT = 0x20000 + PR_SVE_VL_LEN_MASK = 0xffff PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 PR_TIMING_STATISTICAL = 0x0 @@ -1284,6 +1310,7 @@ const ( RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 + RTAX_FASTOPEN_NO_COOKIE = 0x11 RTAX_FEATURES = 0xc RTAX_FEATURE_ALLFRAG = 0x8 RTAX_FEATURE_ECN = 0x1 @@ -1294,7 +1321,7 @@ const ( RTAX_INITCWND = 0xb RTAX_INITRWND = 0xe RTAX_LOCK = 0x1 - RTAX_MAX = 0x10 + RTAX_MAX = 0x11 RTAX_MTU = 0x2 RTAX_QUICKACK = 0xf RTAX_REORDERING = 0x9 @@ -1568,6 +1595,7 @@ const ( SOL_SOCKET = 0xffff SOL_TCP = 0x6 SOL_TIPC = 0x10f + SOL_TLS = 0x11a SOL_X25 = 0x106 SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1009 @@ -1637,6 +1665,7 @@ const ( SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 SO_VM_SOCKETS_TRUSTED = 0x5 SO_WIFI_STATUS = 0x29 + SO_ZEROCOPY = 0x3c SPLICE_F_GIFT = 0x8 SPLICE_F_MORE = 0x4 SPLICE_F_MOVE = 0x1 @@ -1732,6 +1761,8 @@ const ( TCP_MAXWIN = 0xffff TCP_MAX_WINSHIFT = 0xe TCP_MD5SIG = 0xe + TCP_MD5SIG_EXT = 0x20 + TCP_MD5SIG_FLAG_PREFIX = 0x1 TCP_MD5SIG_MAXKEYLEN = 0x50 TCP_MSS = 0x200 TCP_MSS_DEFAULT = 0x218 @@ -1752,6 +1783,7 @@ const ( TCP_THIN_DUPACK = 0x11 TCP_THIN_LINEAR_TIMEOUTS = 0x10 TCP_TIMESTAMP = 0x18 + TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa TCSAFLUSH = 0x5410 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index 4a62a5509..b9b9d6374 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -121,6 +121,7 @@ const ( ARPHRD_PPP = 0x200 ARPHRD_PRONET = 0x4 ARPHRD_RAWHDLC = 0x206 + ARPHRD_RAWIP = 0x207 ARPHRD_ROSE = 0x10e ARPHRD_RSRVD = 0x104 ARPHRD_SIT = 0x308 @@ -390,6 +391,7 @@ const ( ETH_P_DSA = 0x1b ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada + ETH_P_ERSPAN = 0x88be ETH_P_FCOE = 0x8906 ETH_P_FIP = 0x8914 ETH_P_HDLC = 0x19 @@ -398,6 +400,7 @@ const ( ETH_P_IEEE802154 = 0xf6 ETH_P_IEEEPUP = 0xa00 ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IFE = 0xed3e ETH_P_IP = 0x800 ETH_P_IPV6 = 0x86dd ETH_P_IPX = 0x8137 @@ -408,11 +411,13 @@ const ( ETH_P_LOOP = 0x60 ETH_P_LOOPBACK = 0x9000 ETH_P_MACSEC = 0x88e5 + ETH_P_MAP = 0xf9 ETH_P_MOBITEX = 0x15 ETH_P_MPLS_MC = 0x8848 ETH_P_MPLS_UC = 0x8847 ETH_P_MVRP = 0x88f5 ETH_P_NCSI = 0x88f8 + ETH_P_NSH = 0x894f ETH_P_PAE = 0x888e ETH_P_PAUSE = 0x8808 ETH_P_PHONET = 0xf5 @@ -476,6 +481,7 @@ const ( FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 FS_POLICY_FLAGS_VALID = 0x3 + F_ADD_SEALS = 0x409 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -488,6 +494,9 @@ const ( F_GETOWN_EX = 0x10 F_GETPIPE_SZ = 0x408 F_GETSIG = 0xb + F_GET_FILE_RW_HINT = 0x40d + F_GET_RW_HINT = 0x40b + F_GET_SEALS = 0x40a F_LOCK = 0x1 F_NOTIFY = 0x402 F_OFD_GETLK = 0x24 @@ -495,6 +504,10 @@ const ( F_OFD_SETLKW = 0x26 F_OK = 0x0 F_RDLCK = 0x0 + F_SEAL_GROW = 0x4 + F_SEAL_SEAL = 0x1 + F_SEAL_SHRINK = 0x2 + F_SEAL_WRITE = 0x8 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLEASE = 0x400 @@ -506,6 +519,8 @@ const ( F_SETOWN_EX = 0xf F_SETPIPE_SZ = 0x407 F_SETSIG = 0xa + F_SET_FILE_RW_HINT = 0x40e + F_SET_RW_HINT = 0x40c F_SHLCK = 0x8 F_TEST = 0x3 F_TLOCK = 0x2 @@ -561,6 +576,8 @@ const ( IFF_MASTER = 0x400 IFF_MULTICAST = 0x1000 IFF_MULTI_QUEUE = 0x100 + IFF_NAPI = 0x10 + IFF_NAPI_FRAGS = 0x20 IFF_NOARP = 0x80 IFF_NOFILTER = 0x1000 IFF_NOTRAILERS = 0x20 @@ -845,6 +862,7 @@ const ( MADV_FREE = 0x8 MADV_HUGEPAGE = 0xe MADV_HWPOISON = 0x64 + MADV_KEEPONFORK = 0x13 MADV_MERGEABLE = 0xc MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 @@ -853,6 +871,7 @@ const ( MADV_SEQUENTIAL = 0x2 MADV_UNMERGEABLE = 0xd MADV_WILLNEED = 0x3 + MADV_WIPEONFORK = 0x12 MAP_ANON = 0x800 MAP_ANONYMOUS = 0x800 MAP_DENYWRITE = 0x2000 @@ -899,6 +918,7 @@ const ( MSG_TRYHARD = 0x4 MSG_WAITALL = 0x100 MSG_WAITFORONE = 0x10000 + MSG_ZEROCOPY = 0x4000000 MS_ACTIVE = 0x40000000 MS_ASYNC = 0x1 MS_BIND = 0x1000 @@ -998,6 +1018,7 @@ const ( NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 NLM_F_MULTI = 0x2 + NLM_F_NONREC = 0x100 NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 @@ -1196,6 +1217,11 @@ const ( PR_SET_TIMING = 0xe PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 + PR_SVE_GET_VL = 0x33 + PR_SVE_SET_VL = 0x32 + PR_SVE_SET_VL_ONEXEC = 0x40000 + PR_SVE_VL_INHERIT = 0x20000 + PR_SVE_VL_LEN_MASK = 0xffff PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 PR_TIMING_STATISTICAL = 0x0 @@ -1284,6 +1310,7 @@ const ( RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 + RTAX_FASTOPEN_NO_COOKIE = 0x11 RTAX_FEATURES = 0xc RTAX_FEATURE_ALLFRAG = 0x8 RTAX_FEATURE_ECN = 0x1 @@ -1294,7 +1321,7 @@ const ( RTAX_INITCWND = 0xb RTAX_INITRWND = 0xe RTAX_LOCK = 0x1 - RTAX_MAX = 0x10 + RTAX_MAX = 0x11 RTAX_MTU = 0x2 RTAX_QUICKACK = 0xf RTAX_REORDERING = 0x9 @@ -1568,6 +1595,7 @@ const ( SOL_SOCKET = 0xffff SOL_TCP = 0x6 SOL_TIPC = 0x10f + SOL_TLS = 0x11a SOL_X25 = 0x106 SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1009 @@ -1637,6 +1665,7 @@ const ( SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 SO_VM_SOCKETS_TRUSTED = 0x5 SO_WIFI_STATUS = 0x29 + SO_ZEROCOPY = 0x3c SPLICE_F_GIFT = 0x8 SPLICE_F_MORE = 0x4 SPLICE_F_MOVE = 0x1 @@ -1732,6 +1761,8 @@ const ( TCP_MAXWIN = 0xffff TCP_MAX_WINSHIFT = 0xe TCP_MD5SIG = 0xe + TCP_MD5SIG_EXT = 0x20 + TCP_MD5SIG_FLAG_PREFIX = 0x1 TCP_MD5SIG_MAXKEYLEN = 0x50 TCP_MSS = 0x200 TCP_MSS_DEFAULT = 0x218 @@ -1752,6 +1783,7 @@ const ( TCP_THIN_DUPACK = 0x11 TCP_THIN_LINEAR_TIMEOUTS = 0x10 TCP_TIMESTAMP = 0x18 + TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa TCSAFLUSH = 0x5410 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index 5e1e81e0c..509418ef2 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -121,6 +121,7 @@ const ( ARPHRD_PPP = 0x200 ARPHRD_PRONET = 0x4 ARPHRD_RAWHDLC = 0x206 + ARPHRD_RAWIP = 0x207 ARPHRD_ROSE = 0x10e ARPHRD_RSRVD = 0x104 ARPHRD_SIT = 0x308 @@ -390,6 +391,7 @@ const ( ETH_P_DSA = 0x1b ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada + ETH_P_ERSPAN = 0x88be ETH_P_FCOE = 0x8906 ETH_P_FIP = 0x8914 ETH_P_HDLC = 0x19 @@ -398,6 +400,7 @@ const ( ETH_P_IEEE802154 = 0xf6 ETH_P_IEEEPUP = 0xa00 ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IFE = 0xed3e ETH_P_IP = 0x800 ETH_P_IPV6 = 0x86dd ETH_P_IPX = 0x8137 @@ -408,11 +411,13 @@ const ( ETH_P_LOOP = 0x60 ETH_P_LOOPBACK = 0x9000 ETH_P_MACSEC = 0x88e5 + ETH_P_MAP = 0xf9 ETH_P_MOBITEX = 0x15 ETH_P_MPLS_MC = 0x8848 ETH_P_MPLS_UC = 0x8847 ETH_P_MVRP = 0x88f5 ETH_P_NCSI = 0x88f8 + ETH_P_NSH = 0x894f ETH_P_PAE = 0x888e ETH_P_PAUSE = 0x8808 ETH_P_PHONET = 0xf5 @@ -476,6 +481,7 @@ const ( FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 FS_POLICY_FLAGS_VALID = 0x3 + F_ADD_SEALS = 0x409 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -488,6 +494,9 @@ const ( F_GETOWN_EX = 0x10 F_GETPIPE_SZ = 0x408 F_GETSIG = 0xb + F_GET_FILE_RW_HINT = 0x40d + F_GET_RW_HINT = 0x40b + F_GET_SEALS = 0x40a F_LOCK = 0x1 F_NOTIFY = 0x402 F_OFD_GETLK = 0x24 @@ -495,6 +504,10 @@ const ( F_OFD_SETLKW = 0x26 F_OK = 0x0 F_RDLCK = 0x0 + F_SEAL_GROW = 0x4 + F_SEAL_SEAL = 0x1 + F_SEAL_SHRINK = 0x2 + F_SEAL_WRITE = 0x8 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLEASE = 0x400 @@ -506,6 +519,8 @@ const ( F_SETOWN_EX = 0xf F_SETPIPE_SZ = 0x407 F_SETSIG = 0xa + F_SET_FILE_RW_HINT = 0x40e + F_SET_RW_HINT = 0x40c F_SHLCK = 0x8 F_TEST = 0x3 F_TLOCK = 0x2 @@ -561,6 +576,8 @@ const ( IFF_MASTER = 0x400 IFF_MULTICAST = 0x1000 IFF_MULTI_QUEUE = 0x100 + IFF_NAPI = 0x10 + IFF_NAPI_FRAGS = 0x20 IFF_NOARP = 0x80 IFF_NOFILTER = 0x1000 IFF_NOTRAILERS = 0x20 @@ -845,6 +862,7 @@ const ( MADV_FREE = 0x8 MADV_HUGEPAGE = 0xe MADV_HWPOISON = 0x64 + MADV_KEEPONFORK = 0x13 MADV_MERGEABLE = 0xc MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 @@ -853,6 +871,7 @@ const ( MADV_SEQUENTIAL = 0x2 MADV_UNMERGEABLE = 0xd MADV_WILLNEED = 0x3 + MADV_WIPEONFORK = 0x12 MAP_ANON = 0x20 MAP_ANONYMOUS = 0x20 MAP_DENYWRITE = 0x800 @@ -898,6 +917,7 @@ const ( MSG_TRYHARD = 0x4 MSG_WAITALL = 0x100 MSG_WAITFORONE = 0x10000 + MSG_ZEROCOPY = 0x4000000 MS_ACTIVE = 0x40000000 MS_ASYNC = 0x1 MS_BIND = 0x1000 @@ -999,6 +1019,7 @@ const ( NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 NLM_F_MULTI = 0x2 + NLM_F_NONREC = 0x100 NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 @@ -1198,6 +1219,11 @@ const ( PR_SET_TIMING = 0xe PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 + PR_SVE_GET_VL = 0x33 + PR_SVE_SET_VL = 0x32 + PR_SVE_SET_VL_ONEXEC = 0x40000 + PR_SVE_VL_INHERIT = 0x20000 + PR_SVE_VL_LEN_MASK = 0xffff PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 PR_TIMING_STATISTICAL = 0x0 @@ -1340,6 +1366,7 @@ const ( RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 + RTAX_FASTOPEN_NO_COOKIE = 0x11 RTAX_FEATURES = 0xc RTAX_FEATURE_ALLFRAG = 0x8 RTAX_FEATURE_ECN = 0x1 @@ -1350,7 +1377,7 @@ const ( RTAX_INITCWND = 0xb RTAX_INITRWND = 0xe RTAX_LOCK = 0x1 - RTAX_MAX = 0x10 + RTAX_MAX = 0x11 RTAX_MTU = 0x2 RTAX_QUICKACK = 0xf RTAX_REORDERING = 0x9 @@ -1624,6 +1651,7 @@ const ( SOL_SOCKET = 0x1 SOL_TCP = 0x6 SOL_TIPC = 0x10f + SOL_TLS = 0x11a SOL_X25 = 0x106 SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1e @@ -1692,6 +1720,7 @@ const ( SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 SO_VM_SOCKETS_TRUSTED = 0x5 SO_WIFI_STATUS = 0x29 + SO_ZEROCOPY = 0x3c SPLICE_F_GIFT = 0x8 SPLICE_F_MORE = 0x4 SPLICE_F_MOVE = 0x1 @@ -1786,6 +1815,8 @@ const ( TCP_MAXWIN = 0xffff TCP_MAX_WINSHIFT = 0xe TCP_MD5SIG = 0xe + TCP_MD5SIG_EXT = 0x20 + TCP_MD5SIG_FLAG_PREFIX = 0x1 TCP_MD5SIG_MAXKEYLEN = 0x50 TCP_MSS = 0x200 TCP_MSS_DEFAULT = 0x218 @@ -1806,6 +1837,7 @@ const ( TCP_THIN_DUPACK = 0x11 TCP_THIN_LINEAR_TIMEOUTS = 0x10 TCP_TIMESTAMP = 0x18 + TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa TCSAFLUSH = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index 6a8032439..26afbb8de 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -121,6 +121,7 @@ const ( ARPHRD_PPP = 0x200 ARPHRD_PRONET = 0x4 ARPHRD_RAWHDLC = 0x206 + ARPHRD_RAWIP = 0x207 ARPHRD_ROSE = 0x10e ARPHRD_RSRVD = 0x104 ARPHRD_SIT = 0x308 @@ -390,6 +391,7 @@ const ( ETH_P_DSA = 0x1b ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada + ETH_P_ERSPAN = 0x88be ETH_P_FCOE = 0x8906 ETH_P_FIP = 0x8914 ETH_P_HDLC = 0x19 @@ -398,6 +400,7 @@ const ( ETH_P_IEEE802154 = 0xf6 ETH_P_IEEEPUP = 0xa00 ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IFE = 0xed3e ETH_P_IP = 0x800 ETH_P_IPV6 = 0x86dd ETH_P_IPX = 0x8137 @@ -408,11 +411,13 @@ const ( ETH_P_LOOP = 0x60 ETH_P_LOOPBACK = 0x9000 ETH_P_MACSEC = 0x88e5 + ETH_P_MAP = 0xf9 ETH_P_MOBITEX = 0x15 ETH_P_MPLS_MC = 0x8848 ETH_P_MPLS_UC = 0x8847 ETH_P_MVRP = 0x88f5 ETH_P_NCSI = 0x88f8 + ETH_P_NSH = 0x894f ETH_P_PAE = 0x888e ETH_P_PAUSE = 0x8808 ETH_P_PHONET = 0xf5 @@ -476,6 +481,7 @@ const ( FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 FS_POLICY_FLAGS_VALID = 0x3 + F_ADD_SEALS = 0x409 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -488,6 +494,9 @@ const ( F_GETOWN_EX = 0x10 F_GETPIPE_SZ = 0x408 F_GETSIG = 0xb + F_GET_FILE_RW_HINT = 0x40d + F_GET_RW_HINT = 0x40b + F_GET_SEALS = 0x40a F_LOCK = 0x1 F_NOTIFY = 0x402 F_OFD_GETLK = 0x24 @@ -495,6 +504,10 @@ const ( F_OFD_SETLKW = 0x26 F_OK = 0x0 F_RDLCK = 0x0 + F_SEAL_GROW = 0x4 + F_SEAL_SEAL = 0x1 + F_SEAL_SHRINK = 0x2 + F_SEAL_WRITE = 0x8 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLEASE = 0x400 @@ -506,6 +519,8 @@ const ( F_SETOWN_EX = 0xf F_SETPIPE_SZ = 0x407 F_SETSIG = 0xa + F_SET_FILE_RW_HINT = 0x40e + F_SET_RW_HINT = 0x40c F_SHLCK = 0x8 F_TEST = 0x3 F_TLOCK = 0x2 @@ -561,6 +576,8 @@ const ( IFF_MASTER = 0x400 IFF_MULTICAST = 0x1000 IFF_MULTI_QUEUE = 0x100 + IFF_NAPI = 0x10 + IFF_NAPI_FRAGS = 0x20 IFF_NOARP = 0x80 IFF_NOFILTER = 0x1000 IFF_NOTRAILERS = 0x20 @@ -845,6 +862,7 @@ const ( MADV_FREE = 0x8 MADV_HUGEPAGE = 0xe MADV_HWPOISON = 0x64 + MADV_KEEPONFORK = 0x13 MADV_MERGEABLE = 0xc MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 @@ -853,6 +871,7 @@ const ( MADV_SEQUENTIAL = 0x2 MADV_UNMERGEABLE = 0xd MADV_WILLNEED = 0x3 + MADV_WIPEONFORK = 0x12 MAP_ANON = 0x20 MAP_ANONYMOUS = 0x20 MAP_DENYWRITE = 0x800 @@ -898,6 +917,7 @@ const ( MSG_TRYHARD = 0x4 MSG_WAITALL = 0x100 MSG_WAITFORONE = 0x10000 + MSG_ZEROCOPY = 0x4000000 MS_ACTIVE = 0x40000000 MS_ASYNC = 0x1 MS_BIND = 0x1000 @@ -999,6 +1019,7 @@ const ( NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 NLM_F_MULTI = 0x2 + NLM_F_NONREC = 0x100 NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 @@ -1198,6 +1219,11 @@ const ( PR_SET_TIMING = 0xe PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 + PR_SVE_GET_VL = 0x33 + PR_SVE_SET_VL = 0x32 + PR_SVE_SET_VL_ONEXEC = 0x40000 + PR_SVE_VL_INHERIT = 0x20000 + PR_SVE_VL_LEN_MASK = 0xffff PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 PR_TIMING_STATISTICAL = 0x0 @@ -1340,6 +1366,7 @@ const ( RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 + RTAX_FASTOPEN_NO_COOKIE = 0x11 RTAX_FEATURES = 0xc RTAX_FEATURE_ALLFRAG = 0x8 RTAX_FEATURE_ECN = 0x1 @@ -1350,7 +1377,7 @@ const ( RTAX_INITCWND = 0xb RTAX_INITRWND = 0xe RTAX_LOCK = 0x1 - RTAX_MAX = 0x10 + RTAX_MAX = 0x11 RTAX_MTU = 0x2 RTAX_QUICKACK = 0xf RTAX_REORDERING = 0x9 @@ -1624,6 +1651,7 @@ const ( SOL_SOCKET = 0x1 SOL_TCP = 0x6 SOL_TIPC = 0x10f + SOL_TLS = 0x11a SOL_X25 = 0x106 SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1e @@ -1692,6 +1720,7 @@ const ( SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 SO_VM_SOCKETS_TRUSTED = 0x5 SO_WIFI_STATUS = 0x29 + SO_ZEROCOPY = 0x3c SPLICE_F_GIFT = 0x8 SPLICE_F_MORE = 0x4 SPLICE_F_MOVE = 0x1 @@ -1786,6 +1815,8 @@ const ( TCP_MAXWIN = 0xffff TCP_MAX_WINSHIFT = 0xe TCP_MD5SIG = 0xe + TCP_MD5SIG_EXT = 0x20 + TCP_MD5SIG_FLAG_PREFIX = 0x1 TCP_MD5SIG_MAXKEYLEN = 0x50 TCP_MSS = 0x200 TCP_MSS_DEFAULT = 0x218 @@ -1806,6 +1837,7 @@ const ( TCP_THIN_DUPACK = 0x11 TCP_THIN_LINEAR_TIMEOUTS = 0x10 TCP_TIMESTAMP = 0x18 + TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa TCSAFLUSH = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index af5a89502..eeb9941de 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -121,6 +121,7 @@ const ( ARPHRD_PPP = 0x200 ARPHRD_PRONET = 0x4 ARPHRD_RAWHDLC = 0x206 + ARPHRD_RAWIP = 0x207 ARPHRD_ROSE = 0x10e ARPHRD_RSRVD = 0x104 ARPHRD_SIT = 0x308 @@ -390,6 +391,7 @@ const ( ETH_P_DSA = 0x1b ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada + ETH_P_ERSPAN = 0x88be ETH_P_FCOE = 0x8906 ETH_P_FIP = 0x8914 ETH_P_HDLC = 0x19 @@ -398,6 +400,7 @@ const ( ETH_P_IEEE802154 = 0xf6 ETH_P_IEEEPUP = 0xa00 ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IFE = 0xed3e ETH_P_IP = 0x800 ETH_P_IPV6 = 0x86dd ETH_P_IPX = 0x8137 @@ -408,11 +411,13 @@ const ( ETH_P_LOOP = 0x60 ETH_P_LOOPBACK = 0x9000 ETH_P_MACSEC = 0x88e5 + ETH_P_MAP = 0xf9 ETH_P_MOBITEX = 0x15 ETH_P_MPLS_MC = 0x8848 ETH_P_MPLS_UC = 0x8847 ETH_P_MVRP = 0x88f5 ETH_P_NCSI = 0x88f8 + ETH_P_NSH = 0x894f ETH_P_PAE = 0x888e ETH_P_PAUSE = 0x8808 ETH_P_PHONET = 0xf5 @@ -476,6 +481,7 @@ const ( FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 FS_POLICY_FLAGS_VALID = 0x3 + F_ADD_SEALS = 0x409 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -488,6 +494,9 @@ const ( F_GETOWN_EX = 0x10 F_GETPIPE_SZ = 0x408 F_GETSIG = 0xb + F_GET_FILE_RW_HINT = 0x40d + F_GET_RW_HINT = 0x40b + F_GET_SEALS = 0x40a F_LOCK = 0x1 F_NOTIFY = 0x402 F_OFD_GETLK = 0x24 @@ -495,6 +504,10 @@ const ( F_OFD_SETLKW = 0x26 F_OK = 0x0 F_RDLCK = 0x0 + F_SEAL_GROW = 0x4 + F_SEAL_SEAL = 0x1 + F_SEAL_SHRINK = 0x2 + F_SEAL_WRITE = 0x8 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLEASE = 0x400 @@ -506,6 +519,8 @@ const ( F_SETOWN_EX = 0xf F_SETPIPE_SZ = 0x407 F_SETSIG = 0xa + F_SET_FILE_RW_HINT = 0x40e + F_SET_RW_HINT = 0x40c F_SHLCK = 0x8 F_TEST = 0x3 F_TLOCK = 0x2 @@ -561,6 +576,8 @@ const ( IFF_MASTER = 0x400 IFF_MULTICAST = 0x1000 IFF_MULTI_QUEUE = 0x100 + IFF_NAPI = 0x10 + IFF_NAPI_FRAGS = 0x20 IFF_NOARP = 0x80 IFF_NOFILTER = 0x1000 IFF_NOTRAILERS = 0x20 @@ -845,6 +862,7 @@ const ( MADV_FREE = 0x8 MADV_HUGEPAGE = 0xe MADV_HWPOISON = 0x64 + MADV_KEEPONFORK = 0x13 MADV_MERGEABLE = 0xc MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 @@ -853,6 +871,7 @@ const ( MADV_SEQUENTIAL = 0x2 MADV_UNMERGEABLE = 0xd MADV_WILLNEED = 0x3 + MADV_WIPEONFORK = 0x12 MAP_ANON = 0x20 MAP_ANONYMOUS = 0x20 MAP_DENYWRITE = 0x800 @@ -898,6 +917,7 @@ const ( MSG_TRYHARD = 0x4 MSG_WAITALL = 0x100 MSG_WAITFORONE = 0x10000 + MSG_ZEROCOPY = 0x4000000 MS_ACTIVE = 0x40000000 MS_ASYNC = 0x1 MS_BIND = 0x1000 @@ -997,6 +1017,7 @@ const ( NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 NLM_F_MULTI = 0x2 + NLM_F_NONREC = 0x100 NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 @@ -1195,6 +1216,11 @@ const ( PR_SET_TIMING = 0xe PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 + PR_SVE_GET_VL = 0x33 + PR_SVE_SET_VL = 0x32 + PR_SVE_SET_VL_ONEXEC = 0x40000 + PR_SVE_VL_INHERIT = 0x20000 + PR_SVE_VL_LEN_MASK = 0xffff PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 PR_TIMING_STATISTICAL = 0x0 @@ -1344,6 +1370,7 @@ const ( RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 + RTAX_FASTOPEN_NO_COOKIE = 0x11 RTAX_FEATURES = 0xc RTAX_FEATURE_ALLFRAG = 0x8 RTAX_FEATURE_ECN = 0x1 @@ -1354,7 +1381,7 @@ const ( RTAX_INITCWND = 0xb RTAX_INITRWND = 0xe RTAX_LOCK = 0x1 - RTAX_MAX = 0x10 + RTAX_MAX = 0x11 RTAX_MTU = 0x2 RTAX_QUICKACK = 0xf RTAX_REORDERING = 0x9 @@ -1628,6 +1655,7 @@ const ( SOL_SOCKET = 0x1 SOL_TCP = 0x6 SOL_TIPC = 0x10f + SOL_TLS = 0x11a SOL_X25 = 0x106 SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1e @@ -1696,6 +1724,7 @@ const ( SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 SO_VM_SOCKETS_TRUSTED = 0x5 SO_WIFI_STATUS = 0x29 + SO_ZEROCOPY = 0x3c SPLICE_F_GIFT = 0x8 SPLICE_F_MORE = 0x4 SPLICE_F_MOVE = 0x1 @@ -1792,6 +1821,8 @@ const ( TCP_MAXWIN = 0xffff TCP_MAX_WINSHIFT = 0xe TCP_MD5SIG = 0xe + TCP_MD5SIG_EXT = 0x20 + TCP_MD5SIG_FLAG_PREFIX = 0x1 TCP_MD5SIG_MAXKEYLEN = 0x50 TCP_MSS = 0x200 TCP_MSS_DEFAULT = 0x218 @@ -1812,6 +1843,7 @@ const ( TCP_THIN_DUPACK = 0x11 TCP_THIN_LINEAR_TIMEOUTS = 0x10 TCP_TIMESTAMP = 0x18 + TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa TCSAFLUSH = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go index 8ea18e6c2..8bf50c8d4 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go @@ -308,6 +308,7 @@ const ( SYS_PWRITEV2 = 377 SYS_S390_GUARDED_STORAGE = 378 SYS_STATX = 379 + SYS_S390_STHYI = 380 SYS_SELECT = 142 SYS_GETRLIMIT = 191 SYS_LCHOWN = 198 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index 7aa206e3d..f9a99358a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -436,97 +436,123 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x2c - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x2e + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index abb3d89ae..4df7088d4 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -440,97 +440,123 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x2c - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x2e + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index 11654174d..a181469ca 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -440,97 +440,123 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x2c - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x2e + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go index 0d0de46f6..cff50c3d3 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -441,97 +441,123 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x2c - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x2e + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go index a9087c52a..87d0a8b1b 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -439,97 +439,123 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x2c - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x2e + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go index 01e8f65ca..cf4e2bd29 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -441,97 +441,123 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x2c - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x2e + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go index 6f9452d89..b8da482ca 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -441,97 +441,123 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x2c - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x2e + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go index 6de721f78..7106b512d 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -439,97 +439,123 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x2c - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x2e + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go index cb2701fd2..319071c8b 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -442,97 +442,123 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x2c - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x2e + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go index fa5b15be0..ef00ed498 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -442,97 +442,123 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x2c - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x2e + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go index 64952cb78..e9ee49706 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -441,97 +441,123 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x2c - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x2e + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { diff --git a/vendor/golang.org/x/sys/windows/registry/key.go b/vendor/golang.org/x/sys/windows/registry/key.go index d0beb1956..c25648343 100644 --- a/vendor/golang.org/x/sys/windows/registry/key.go +++ b/vendor/golang.org/x/sys/windows/registry/key.go @@ -113,12 +113,10 @@ func OpenRemoteKey(pcname string, k Key) (Key, error) { // The parameter n controls the number of returned names, // analogous to the way os.File.Readdirnames works. func (k Key) ReadSubKeyNames(n int) ([]string, error) { - ki, err := k.Stat() - if err != nil { - return nil, err - } - names := make([]string, 0, ki.SubKeyCount) - buf := make([]uint16, ki.MaxSubKeyLen+1) // extra room for terminating zero byte + names := make([]string, 0) + // Registry key size limit is 255 bytes and described there: + // https://msdn.microsoft.com/library/windows/desktop/ms724872.aspx + buf := make([]uint16, 256) //plus extra room for terminating zero byte loopItems: for i := uint32(0); ; i++ { if n > 0 { diff --git a/vendor/golang.org/x/sys/windows/registry/registry_test.go b/vendor/golang.org/x/sys/windows/registry/registry_test.go index 3cb9771ca..2f4dd69ef 100644 --- a/vendor/golang.org/x/sys/windows/registry/registry_test.go +++ b/vendor/golang.org/x/sys/windows/registry/registry_test.go @@ -29,7 +29,7 @@ func randKeyName(prefix string) string { } func TestReadSubKeyNames(t *testing.T) { - k, err := registry.OpenKey(registry.CLASSES_ROOT, "TypeLib", registry.ENUMERATE_SUB_KEYS|registry.QUERY_VALUE) + k, err := registry.OpenKey(registry.CLASSES_ROOT, "TypeLib", registry.ENUMERATE_SUB_KEYS) if err != nil { t.Fatal(err) } diff --git a/vendor/golang.org/x/text/cmd/gotext/common.go b/vendor/golang.org/x/text/cmd/gotext/common.go index 51322db65..1036592fb 100644 --- a/vendor/golang.org/x/text/cmd/gotext/common.go +++ b/vendor/golang.org/x/text/cmd/gotext/common.go @@ -21,9 +21,6 @@ const ( // NOTE: The command line tool already prefixes with "gotext:". var ( wrap = func(err error, msg string) error { - if err == nil { - return nil - } return fmt.Errorf("%s: %v", msg, err) } errorf = fmt.Errorf diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract/catalog.go b/vendor/golang.org/x/text/cmd/gotext/examples/extract/catalog.go index bc6130a69..4c2303fd0 100644 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract/catalog.go +++ b/vendor/golang.org/x/text/cmd/gotext/examples/extract/catalog.go @@ -37,48 +37,40 @@ func init() { } var messageKeyToIndex = map[string]int{ - "%.2[1]f miles traveled (%[1]f)": 8, - "%[1]s is visiting %[3]s!\n": 3, - "%d files remaining!": 5, - "%d more files remaining!": 4, - "%s is out of order!": 7, - "%s is visiting %s!\n": 2, - "Hello %s!\n": 1, - "Hello world!\n": 0, - "Use the following code for your discount: %d\n": 6, + "%.2[1]f miles traveled (%[1]f)": 6, + "%[1]s is visiting %[3]s!\n": 3, + "%d more files remaining!": 4, + "%s is out of order!": 5, + "%s is visiting %s!\n": 2, + "Hello %s!\n": 1, + "Hello world!\n": 0, } -var deIndex = []uint32{ // 10 elements - 0x00000000, 0x00000011, 0x00000023, 0x0000003d, - 0x00000057, 0x00000076, 0x00000076, 0x00000076, - 0x00000076, 0x00000076, -} // Size: 64 bytes +var deIndex = []uint32{ // 8 elements + 0x00000000, 0x0000000d, 0x0000001b, 0x00000031, + 0x00000047, 0x00000066, 0x00000066, 0x00000066, +} // Size: 56 bytes -const deData string = "" + // Size: 118 bytes - "\x04\x00\x01\x0a\x0c\x02Hallo Welt!\x04\x00\x01\x0a\x0d\x02Hallo %[1]s!" + - "\x04\x00\x01\x0a\x15\x02%[1]s besucht %[2]s!\x04\x00\x01\x0a\x15\x02%[1]" + - "s besucht %[3]s!\x02Noch %[1]d Bestände zu gehen!" +const deData string = "" + // Size: 102 bytes + "\x02Hallo Welt!\x0a\x02Hallo %[1]s!\x0a\x02%[1]s besucht %[2]s!\x0a\x02%" + + "[1]s besucht %[3]s!\x0a\x02Noch %[1]d Bestände zu gehen!" -var en_USIndex = []uint32{ // 10 elements - 0x00000000, 0x00000012, 0x00000024, 0x00000042, - 0x00000060, 0x000000a3, 0x000000ba, 0x000000ef, - 0x00000106, 0x00000125, -} // Size: 64 bytes +var en_USIndex = []uint32{ // 8 elements + 0x00000000, 0x0000000e, 0x0000001c, 0x00000036, + 0x00000050, 0x00000093, 0x000000aa, 0x000000c9, +} // Size: 56 bytes -const en_USData string = "" + // Size: 293 bytes - "\x04\x00\x01\x0a\x0d\x02Hello world!\x04\x00\x01\x0a\x0d\x02Hello %[1]sn" + - "\x04\x00\x01\x0a\x19\x02%[1]s is visiting %[2]s!\x04\x00\x01\x0a\x19\x02" + - "%[1]s is visiting %[3]s!\x14\x01\x81\x01\x00\x02\x14\x02One file remaini" + - "ng!\x00&\x02There are %[1]d more files remaining!\x02%[1]d files remaini" + - "ng!\x04\x00\x01\x0a0\x02Use the following code for your discount: %[1]d" + - "\x02%[1]s is out of order!\x02%.2[1]f miles traveled (%[1]f)" +const en_USData string = "" + // Size: 201 bytes + "\x02Hello world!\x0a\x02Hello %[1]s!\x0a\x02%[1]s is visiting %[2]s!\x0a" + + "\x02%[1]s is visiting %[3]s!\x0a\x04\x01\x81\x01\x00\x02\x14\x02One file" + + " remaining!\x00&\x02There are %[1]d more files remaining!\x02%[1]s is ou" + + "t of order!\x02%.2[1]f miles traveled (%[1]f)" -var zhIndex = []uint32{ // 10 elements +var zhIndex = []uint32{ // 8 elements 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -} // Size: 64 bytes +} // Size: 56 bytes const zhData string = "" -// Total table size 603 bytes (0KiB); checksum: 1D2754EE +// Total table size 471 bytes (0KiB); checksum: 7746955 diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/de/messages.gotext.json b/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/de/messages.gotext.json index 5e1d3b396..221990f24 100755 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/de/messages.gotext.json +++ b/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/de/messages.gotext.json @@ -2,17 +2,17 @@ "language": "de", "messages": [ { - "id": "Hello world!", + "id": "Hello world!\n", "key": "Hello world!\n", - "message": "Hello world!", - "translation": "Hallo Welt!", + "message": "Hello world!\n", + "translation": "Hallo Welt!\n", "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:27:10" }, { - "id": "Hello {City}!", + "id": "Hello {City}!\n", "key": "Hello %s!\n", - "message": "Hello {City}!", - "translation": "Hallo {City}!", + "message": "Hello {City}!\n", + "translation": "Hallo {City}!\n", "placeholders": [ { "id": "City", @@ -26,10 +26,10 @@ "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:31:10" }, { - "id": "Hello {Town}!", + "id": "Hello {Town}!\n", "key": "Hello %s!\n", - "message": "Hello {Town}!", - "translation": "Hallo {Town}!", + "message": "Hello {Town}!\n", + "translation": "Hallo {Town}!\n", "placeholders": [ { "id": "Town", @@ -44,10 +44,10 @@ "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:35:10" }, { - "id": "{Person} is visiting {Place}!", + "id": "{Person} is visiting {Place}!\n", "key": "%s is visiting %s!\n", - "message": "{Person} is visiting {Place}!", - "translation": "{Person} besucht {Place}!", + "message": "{Person} is visiting {Place}!\n", + "translation": "{Person} besucht {Place}!\n", "placeholders": [ { "id": "Person", @@ -71,10 +71,10 @@ "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:40:10" }, { - "id": "{Person} is visiting {Place}!", + "id": "{Person} is visiting {Place}!\n", "key": "%[1]s is visiting %[3]s!\n", - "message": "{Person} is visiting {Place}!", - "translation": "{Person} besucht {Place}!", + "message": "{Person} is visiting {Place}!\n", + "translation": "{Person} besucht {Place}!\n", "comment": "Person visiting a place.", "placeholders": [ { @@ -123,9 +123,9 @@ "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:67:10" }, { - "id": "Use the following code for your discount: {ReferralCode}", + "id": "Use the following code for your discount: {ReferralCode}\n", "key": "Use the following code for your discount: %d\n", - "message": "Use the following code for your discount: {ReferralCode}", + "message": "Use the following code for your discount: {ReferralCode}\n", "translation": "", "placeholders": [ { diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/de/out.gotext.json b/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/de/out.gotext.json index 696eeb70e..354e8e6aa 100755 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/de/out.gotext.json +++ b/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/de/out.gotext.json @@ -2,14 +2,17 @@ "language": "de", "messages": [ { - "id": "Hello world!", - "message": "Hello world!", - "translation": "Hallo Welt!" + "id": "Hello world!\n", + "key": "Hello world!\n", + "message": "Hello world!\n", + "translation": "", + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:28:10" }, { - "id": "Hello {City}!", - "message": "Hello {City}!", - "translation": "Hallo {City}!", + "id": "Hello {City}!\n", + "key": "Hello %s!\n", + "message": "Hello {City}!\n", + "translation": "", "placeholders": [ { "id": "City", @@ -19,12 +22,32 @@ "argNum": 1, "expr": "city" } - ] + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:32:10" }, { - "id": "{Person} is visiting {Place}!", - "message": "{Person} is visiting {Place}!", - "translation": "{Person} besucht {Place}!", + "id": "Hello {Town}!\n", + "key": "Hello %s!\n", + "message": "Hello {Town}!\n", + "translation": "", + "placeholders": [ + { + "id": "Town", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "town", + "comment": "Town" + } + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:36:10" + }, + { + "id": "{Person} is visiting {Place}!\n", + "key": "%s is visiting %s!\n", + "message": "{Person} is visiting {Place}!\n", + "translation": "", "placeholders": [ { "id": "Person", @@ -44,27 +67,66 @@ "expr": "place", "comment": "Place the person is visiting." } - ] + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:41:10" }, { - "id": "{2} files remaining!", - "message": "{2} files remaining!", + "id": "{Person} is visiting {Place}!\n", + "key": "%[1]s is visiting %[3]s!\n", + "message": "{Person} is visiting {Place}!\n", "translation": "", + "comment": "Person visiting a place.", "placeholders": [ { - "id": "2", + "id": "Person", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "pp.Person" + }, + { + "id": "Place", + "string": "%[3]s", + "type": "string", + "underlyingType": "string", + "argNum": 3, + "expr": "pp.Place", + "comment": "Place the person is visiting." + }, + { + "id": "Extra", + "string": "%[2]v", + "type": "int", + "underlyingType": "int", + "argNum": 2, + "expr": "pp.extra" + } + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:56:10" + }, + { + "id": "{} files remaining!", + "key": "%d files remaining!", + "message": "{} files remaining!", + "translation": "", + "placeholders": [ + { + "id": "", "string": "%[1]d", "type": "int", "underlyingType": "int", "argNum": 1, "expr": "2" } - ] + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:63:10" }, { "id": "{N} more files remaining!", + "key": "%d more files remaining!", "message": "{N} more files remaining!", - "translation": "Noch {N} Bestände zu gehen!", + "translation": "", "placeholders": [ { "id": "N", @@ -74,11 +136,13 @@ "argNum": 1, "expr": "n" } - ] + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:68:10" }, { - "id": "Use the following code for your discount: {ReferralCode}", - "message": "Use the following code for your discount: {ReferralCode}", + "id": "Use the following code for your discount: {ReferralCode}\n", + "key": "Use the following code for your discount: %d\n", + "message": "Use the following code for your discount: {ReferralCode}\n", "translation": "", "placeholders": [ { @@ -89,13 +153,15 @@ "argNum": 1, "expr": "c" } - ] + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:74:10" }, { "id": [ "msgOutOfOrder", "{Device} is out of order!" ], + "key": "%s is out of order!", "message": "{Device} is out of order!", "translation": "", "comment": "FOO\n", @@ -108,10 +174,12 @@ "argNum": 1, "expr": "device" } - ] + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:82:10" }, { "id": "{Miles} miles traveled ({Miles_1})", + "key": "%.2[1]f miles traveled (%[1]f)", "message": "{Miles} miles traveled ({Miles_1})", "translation": "", "placeholders": [ @@ -131,7 +199,8 @@ "argNum": 1, "expr": "miles" } - ] + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:86:10" } ] } \ No newline at end of file diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/en-US/messages.gotext.json b/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/en-US/messages.gotext.json index 5f6f8b03c..37d691b59 100755 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/en-US/messages.gotext.json +++ b/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/en-US/messages.gotext.json @@ -2,23 +2,23 @@ "language": "en-US", "messages": [ { - "id": "Hello world!", +"id": "Hello world!\n", "key": "Hello world!\n", - "message": "Hello world!", - "translation": "Hello world!", + "message": "Hello world!\n", + "translation": "Hello world!\n", "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:27:10" }, { - "id": "Hello {City}!", + "id": "Hello {City}!\n", "key": "Hello %s!\n", - "message": "Hello {City}!", - "translation": "Hello {City}n" + "message": "Hello {City}!\n", + "translation": "Hello {City}!\n" }, { - "id": "Hello {Town}!", + "id": "Hello {Town}!\n", "key": "Hello %s!\n", - "message": "Hello {Town}!", - "translation": "Hello {Town}!", + "message": "Hello {Town}!\n", + "translation": "Hello {Town}!\n", "placeholders": [ { "id": "Town", @@ -32,16 +32,16 @@ ] }, { - "id": "{Person} is visiting {Place}!", + "id": "{Person} is visiting {Place}!\n", "key": "%s is visiting %s!\n", - "message": "{Person} is visiting {Place}!", + "message": "{Person} is visiting {Place}!\n", "translation": "{Person} is visiting {Place}!\n" }, { - "id": "{Person} is visiting {Place}!", + "id": "{Person} is visiting {Place}!\n", "key": "%[1]s is visiting %[3]s!\n", - "message": "{Person} is visiting {Place}!", - "translation": "{Person} is visiting {Place}!", + "message": "{Person} is visiting {Place}!\n", + "translation": "{Person} is visiting {Place}!\n", "comment": "Person visiting a place." }, { @@ -60,9 +60,9 @@ } }, { - "id": "Use the following code for your discount: {ReferralCode}", + "id": "Use the following code for your discount: {ReferralCode}\n", "key": "Use the following code for your discount: %d\n", - "message": "Use the following code for your discount: {ReferralCode}", + "message": "Use the following code for your discount: {ReferralCode}\n", "translation": "" }, { diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/en-US/out.gotext.json b/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/en-US/out.gotext.json index 31785bf80..fea86e544 100755 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/en-US/out.gotext.json +++ b/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/en-US/out.gotext.json @@ -2,14 +2,17 @@ "language": "en-US", "messages": [ { - "id": "Hello world!", - "message": "Hello world!", - "translation": "Hello world!" + "id": "Hello world!\n", + "key": "Hello world!\n", + "message": "Hello world!\n", + "translation": "", + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:28:10" }, { - "id": "Hello {City}!", - "message": "Hello {City}!", - "translation": "Hello {City}n", + "id": "Hello {City}!\n", + "key": "Hello %s!\n", + "message": "Hello {City}!\n", + "translation": "", "placeholders": [ { "id": "City", @@ -19,12 +22,32 @@ "argNum": 1, "expr": "city" } - ] + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:32:10" }, { - "id": "{Person} is visiting {Place}!", - "message": "{Person} is visiting {Place}!", - "translation": "{Person} is visiting {Place}!", + "id": "Hello {Town}!\n", + "key": "Hello %s!\n", + "message": "Hello {Town}!\n", + "translation": "", + "placeholders": [ + { + "id": "Town", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "town", + "comment": "Town" + } + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:36:10" + }, + { + "id": "{Person} is visiting {Place}!\n", + "key": "%s is visiting %s!\n", + "message": "{Person} is visiting {Place}!\n", + "translation": "", "placeholders": [ { "id": "Person", @@ -44,16 +67,52 @@ "expr": "place", "comment": "Place the person is visiting." } - ] + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:41:10" + }, + { + "id": "{Person} is visiting {Place}!\n", + "key": "%[1]s is visiting %[3]s!\n", + "message": "{Person} is visiting {Place}!\n", + "translation": "", + "comment": "Person visiting a place.", + "placeholders": [ + { + "id": "Person", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "pp.Person" + }, + { + "id": "Place", + "string": "%[3]s", + "type": "string", + "underlyingType": "string", + "argNum": 3, + "expr": "pp.Place", + "comment": "Place the person is visiting." + }, + { + "id": "Extra", + "string": "%[2]v", + "type": "int", + "underlyingType": "int", + "argNum": 2, + "expr": "pp.extra" + } + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:56:10" }, { - "id": "{2} files remaining!", - "message": "{2} files remaining!", - "translation": "{2} files remaining!", - "translatorComment": "Copied from source.", + "id": "{} files remaining!", + "key": "%d files remaining!", + "message": "{} files remaining!", + "translation": "", "placeholders": [ { - "id": "2", + "id": "", "string": "%[1]d", "type": "int", "underlyingType": "int", @@ -61,25 +120,13 @@ "expr": "2" } ], - "fuzzy": true + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:63:10" }, { "id": "{N} more files remaining!", + "key": "%d more files remaining!", "message": "{N} more files remaining!", - "translation": { - "select": { - "feature": "plural", - "arg": "N", - "cases": { - "one": { - "msg": "One file remaining!" - }, - "other": { - "msg": "There are {N} more files remaining!" - } - } - } - }, + "translation": "", "placeholders": [ { "id": "N", @@ -89,13 +136,14 @@ "argNum": 1, "expr": "n" } - ] + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:68:10" }, { - "id": "Use the following code for your discount: {ReferralCode}", - "message": "Use the following code for your discount: {ReferralCode}", - "translation": "Use the following code for your discount: {ReferralCode}", - "translatorComment": "Copied from source.", + "id": "Use the following code for your discount: {ReferralCode}\n", + "key": "Use the following code for your discount: %d\n", + "message": "Use the following code for your discount: {ReferralCode}\n", + "translation": "", "placeholders": [ { "id": "ReferralCode", @@ -106,15 +154,16 @@ "expr": "c" } ], - "fuzzy": true + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:74:10" }, { "id": [ "msgOutOfOrder", "{Device} is out of order!" ], + "key": "%s is out of order!", "message": "{Device} is out of order!", - "translation": "{Device} is out of order!", + "translation": "", "comment": "FOO\n", "placeholders": [ { @@ -125,12 +174,14 @@ "argNum": 1, "expr": "device" } - ] + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:82:10" }, { "id": "{Miles} miles traveled ({Miles_1})", + "key": "%.2[1]f miles traveled (%[1]f)", "message": "{Miles} miles traveled ({Miles_1})", - "translation": "{Miles} miles traveled ({Miles_1})", + "translation": "", "placeholders": [ { "id": "Miles", @@ -148,7 +199,8 @@ "argNum": 1, "expr": "miles" } - ] + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:86:10" } ] } \ No newline at end of file diff --git a/vendor/golang.org/x/text/message/pipeline/testdata/test1/extracted.gotext.json b/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/extracted.gotext.json old mode 100644 new mode 100755 similarity index 71% rename from vendor/golang.org/x/text/message/pipeline/testdata/test1/extracted.gotext.json rename to vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/extracted.gotext.json index 4d317af59..fea86e544 --- a/vendor/golang.org/x/text/message/pipeline/testdata/test1/extracted.gotext.json +++ b/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/extracted.gotext.json @@ -2,16 +2,16 @@ "language": "en-US", "messages": [ { - "id": "Hello world!", + "id": "Hello world!\n", "key": "Hello world!\n", - "message": "Hello world!", + "message": "Hello world!\n", "translation": "", - "position": "testdata/test1/test1.go:19:10" + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:28:10" }, { - "id": "Hello {City}!", + "id": "Hello {City}!\n", "key": "Hello %s!\n", - "message": "Hello {City}!", + "message": "Hello {City}!\n", "translation": "", "placeholders": [ { @@ -23,12 +23,30 @@ "expr": "city" } ], - "position": "testdata/test1/test1.go:24:10" + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:32:10" }, { - "id": "{Person} is visiting {Place}!", + "id": "Hello {Town}!\n", + "key": "Hello %s!\n", + "message": "Hello {Town}!\n", + "translation": "", + "placeholders": [ + { + "id": "Town", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "town", + "comment": "Town" + } + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:36:10" + }, + { + "id": "{Person} is visiting {Place}!\n", "key": "%s is visiting %s!\n", - "message": "{Person} is visiting {Place}!", + "message": "{Person} is visiting {Place}!\n", "translation": "", "placeholders": [ { @@ -50,14 +68,14 @@ "comment": "Place the person is visiting." } ], - "position": "testdata/test1/test1.go:30:10" + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:41:10" }, { - "id": "{Person} is visiting {Place}!", + "id": "{Person} is visiting {Place}!\n", "key": "%[1]s is visiting %[3]s!\n", - "message": "{Person} is visiting {Place}!", + "message": "{Person} is visiting {Place}!\n", "translation": "", - "comment": "Field names are placeholders.", + "comment": "Person visiting a place.", "placeholders": [ { "id": "Person", @@ -85,16 +103,16 @@ "expr": "pp.extra" } ], - "position": "testdata/test1/test1.go:44:10" + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:56:10" }, { - "id": "{2} files remaining!", + "id": "{} files remaining!", "key": "%d files remaining!", - "message": "{2} files remaining!", + "message": "{} files remaining!", "translation": "", "placeholders": [ { - "id": "2", + "id": "", "string": "%[1]d", "type": "int", "underlyingType": "int", @@ -102,7 +120,7 @@ "expr": "2" } ], - "position": "testdata/test1/test1.go:51:10" + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:63:10" }, { "id": "{N} more files remaining!", @@ -119,24 +137,24 @@ "expr": "n" } ], - "position": "testdata/test1/test1.go:56:10" + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:68:10" }, { - "id": "Use the following code for your discount: {ReferralCode}", + "id": "Use the following code for your discount: {ReferralCode}\n", "key": "Use the following code for your discount: %d\n", - "message": "Use the following code for your discount: {ReferralCode}", + "message": "Use the following code for your discount: {ReferralCode}\n", "translation": "", "placeholders": [ { "id": "ReferralCode", "string": "%[1]d", - "type": "./testdata/test1.referralCode", + "type": "golang.org/x/text/cmd/gotext/examples/extract.referralCode", "underlyingType": "int", "argNum": 1, "expr": "c" } ], - "position": "testdata/test1/test1.go:64:10" + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:74:10" }, { "id": [ @@ -146,7 +164,7 @@ "key": "%s is out of order!", "message": "{Device} is out of order!", "translation": "", - "comment": "This comment wins.\n", + "comment": "FOO\n", "placeholders": [ { "id": "Device", @@ -157,7 +175,7 @@ "expr": "device" } ], - "position": "testdata/test1/test1.go:70:10" + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:82:10" }, { "id": "{Miles} miles traveled ({Miles_1})", @@ -182,7 +200,7 @@ "expr": "miles" } ], - "position": "testdata/test1/test1.go:74:10" + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:86:10" } ] } \ No newline at end of file diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/zh/messages.gotext.json b/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/zh/messages.gotext.json index 9913f832b..85307402c 100755 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/zh/messages.gotext.json +++ b/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/zh/messages.gotext.json @@ -2,16 +2,16 @@ "language": "zh", "messages": [ { - "id": "Hello world!", +"id": "Hello world!\n", "key": "Hello world!\n", - "message": "Hello world!", + "message": "Hello world!\n", "translation": "", "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:27:10" }, { - "id": "Hello {City}!", + "id": "Hello {City}!\n", "key": "Hello %s!\n", - "message": "Hello {City}!", + "message": "Hello {City}!\n", "translation": "", "placeholders": [ { @@ -26,9 +26,9 @@ "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:31:10" }, { - "id": "Hello {Town}!", + "id": "Hello {Town}!\n", "key": "Hello %s!\n", - "message": "Hello {Town}!", + "message": "Hello {Town}!\n", "translation": "", "placeholders": [ { @@ -44,9 +44,9 @@ "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:35:10" }, { - "id": "{Person} is visiting {Place}!", + "id": "{Person} is visiting {Place}!\n", "key": "%s is visiting %s!\n", - "message": "{Person} is visiting {Place}!", + "message": "{Person} is visiting {Place}!\n", "translation": "", "placeholders": [ { @@ -71,9 +71,9 @@ "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:40:10" }, { - "id": "{Person} is visiting {Place}!", + "id": "{Person} is visiting {Place}!\n", "key": "%[1]s is visiting %[3]s!\n", - "message": "{Person} is visiting {Place}!", + "message": "{Person} is visiting {Place}!\n", "translation": "", "comment": "Person visiting a place.", "placeholders": [ diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/zh/out.gotext.json b/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/zh/out.gotext.json index 946573ec6..88739a310 100755 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/zh/out.gotext.json +++ b/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/zh/out.gotext.json @@ -2,13 +2,16 @@ "language": "zh", "messages": [ { - "id": "Hello world!", - "message": "Hello world!", - "translation": "" + "id": "Hello world!\n", + "key": "Hello world!\n", + "message": "Hello world!\n", + "translation": "", + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:28:10" }, { - "id": "Hello {City}!", - "message": "Hello {City}!", + "id": "Hello {City}!\n", + "key": "Hello %s!\n", + "message": "Hello {City}!\n", "translation": "", "placeholders": [ { @@ -19,11 +22,31 @@ "argNum": 1, "expr": "city" } - ] + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:32:10" }, { - "id": "{Person} is visiting {Place}!", - "message": "{Person} is visiting {Place}!", + "id": "Hello {Town}!\n", + "key": "Hello %s!\n", + "message": "Hello {Town}!\n", + "translation": "", + "placeholders": [ + { + "id": "Town", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "town", + "comment": "Town" + } + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:36:10" + }, + { + "id": "{Person} is visiting {Place}!\n", + "key": "%s is visiting %s!\n", + "message": "{Person} is visiting {Place}!\n", "translation": "", "placeholders": [ { @@ -44,25 +67,64 @@ "expr": "place", "comment": "Place the person is visiting." } - ] + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:41:10" + }, + { + "id": "{Person} is visiting {Place}!\n", + "key": "%[1]s is visiting %[3]s!\n", + "message": "{Person} is visiting {Place}!\n", + "translation": "", + "comment": "Person visiting a place.", + "placeholders": [ + { + "id": "Person", + "string": "%[1]s", + "type": "string", + "underlyingType": "string", + "argNum": 1, + "expr": "pp.Person" + }, + { + "id": "Place", + "string": "%[3]s", + "type": "string", + "underlyingType": "string", + "argNum": 3, + "expr": "pp.Place", + "comment": "Place the person is visiting." + }, + { + "id": "Extra", + "string": "%[2]v", + "type": "int", + "underlyingType": "int", + "argNum": 2, + "expr": "pp.extra" + } + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:56:10" }, { - "id": "{2} files remaining!", - "message": "{2} files remaining!", + "id": "{} files remaining!", + "key": "%d files remaining!", + "message": "{} files remaining!", "translation": "", "placeholders": [ { - "id": "2", + "id": "", "string": "%[1]d", "type": "int", "underlyingType": "int", "argNum": 1, "expr": "2" } - ] + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:63:10" }, { "id": "{N} more files remaining!", + "key": "%d more files remaining!", "message": "{N} more files remaining!", "translation": "", "placeholders": [ @@ -74,11 +136,13 @@ "argNum": 1, "expr": "n" } - ] + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:68:10" }, { - "id": "Use the following code for your discount: {ReferralCode}", - "message": "Use the following code for your discount: {ReferralCode}", + "id": "Use the following code for your discount: {ReferralCode}\n", + "key": "Use the following code for your discount: %d\n", + "message": "Use the following code for your discount: {ReferralCode}\n", "translation": "", "placeholders": [ { @@ -89,13 +153,15 @@ "argNum": 1, "expr": "c" } - ] + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:74:10" }, { "id": [ "msgOutOfOrder", "{Device} is out of order!" ], + "key": "%s is out of order!", "message": "{Device} is out of order!", "translation": "", "comment": "FOO\n", @@ -108,10 +174,12 @@ "argNum": 1, "expr": "device" } - ] + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:82:10" }, { "id": "{Miles} miles traveled ({Miles_1})", + "key": "%.2[1]f miles traveled (%[1]f)", "message": "{Miles} miles traveled ({Miles_1})", "translation": "", "placeholders": [ @@ -131,7 +199,8 @@ "argNum": 1, "expr": "miles" } - ] + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:86:10" } ] } \ No newline at end of file diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract/main.go b/vendor/golang.org/x/text/cmd/gotext/examples/extract/main.go index 414b4531a..cbbc3704b 100644 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract/main.go +++ b/vendor/golang.org/x/text/cmd/gotext/examples/extract/main.go @@ -4,7 +4,8 @@ package main -//go:generate gotext update -out catalog.go +//go:generate gotext extract --lang=de,zh +//go:generate gotext generate -out catalog.go import ( "golang.org/x/text/language" diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/catalog_gen.go b/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/catalog_gen.go deleted file mode 100644 index 2c410dcdb..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/catalog_gen.go +++ /dev/null @@ -1,57 +0,0 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. - -package main - -import ( - "golang.org/x/text/language" - "golang.org/x/text/message" - "golang.org/x/text/message/catalog" -) - -type dictionary struct { - index []uint32 - data string -} - -func (d *dictionary) Lookup(key string) (data string, ok bool) { - p := messageKeyToIndex[key] - start, end := d.index[p], d.index[p+1] - if start == end { - return "", false - } - return d.data[start:end], true -} - -func init() { - dict := map[string]catalog.Dictionary{ - "en": &dictionary{index: enIndex, data: enData}, - "zh": &dictionary{index: zhIndex, data: zhData}, - } - fallback := language.MustParse("en") - cat, err := catalog.NewFromMap(dict, catalog.Fallback(fallback)) - if err != nil { - panic(err) - } - message.DefaultCatalog = cat -} - -var messageKeyToIndex = map[string]int{ - "Do you like your browser (%s)?\n": 1, - "Hello %s!\n": 0, -} - -var enIndex = []uint32{ // 3 elements - 0x00000000, 0x00000012, 0x00000039, -} // Size: 36 bytes - -const enData string = "" + // Size: 57 bytes - "\x04\x00\x01\x0a\x0d\x02Hello %[1]s!\x04\x00\x01\x0a\x22\x02Do you like " + - "your browser (%[1]s)?" - -var zhIndex = []uint32{ // 3 elements - 0x00000000, 0x00000000, 0x00000000, -} // Size: 36 bytes - -const zhData string = "" - -// Total table size 129 bytes (0KiB); checksum: 9C146C82 diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/de/out.gotext.json b/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/de/out.gotext.json index d8437c01f..bd7159082 100755 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/de/out.gotext.json +++ b/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/de/out.gotext.json @@ -2,9 +2,9 @@ "language": "de", "messages": [ { - "id": "Hello {From}!", + "id": "Hello {From}!\n", "key": "Hello %s!\n", - "message": "Hello {From}!", + "message": "Hello {From}!\n", "translation": "", "placeholders": [ { @@ -19,9 +19,9 @@ "position": "golang.org/x/text/cmd/gotext/examples/extract_http/pkg/pkg.go:22:11" }, { - "id": "Do you like your browser ({User_Agent})?", + "id": "Do you like your browser ({User_Agent})?\n", "key": "Do you like your browser (%s)?\n", - "message": "Do you like your browser ({User_Agent})?", + "message": "Do you like your browser ({User_Agent})?\n", "translation": "", "placeholders": [ { diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/en-US/out.gotext.json b/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/en-US/out.gotext.json index de59eca1d..d0c4684ac 100755 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/en-US/out.gotext.json +++ b/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/en-US/out.gotext.json @@ -2,9 +2,9 @@ "language": "en-US", "messages": [ { - "id": "Hello {From}!", + "id": "Hello {From}!\n", "key": "Hello %s!\n", - "message": "Hello {From}!", + "message": "Hello {From}!\n", "translation": "", "placeholders": [ { @@ -19,9 +19,9 @@ "position": "golang.org/x/text/cmd/gotext/examples/extract_http/pkg/pkg.go:22:11" }, { - "id": "Do you like your browser ({User_Agent})?", + "id": "Do you like your browser ({User_Agent})?\n", "key": "Do you like your browser (%s)?\n", - "message": "Do you like your browser ({User_Agent})?", + "message": "Do you like your browser ({User_Agent})?\n", "translation": "", "placeholders": [ { diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/en/out.gotext.json b/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/extracted.gotext.json old mode 100644 new mode 100755 similarity index 60% rename from vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/en/out.gotext.json rename to vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/extracted.gotext.json index 1391e5848..d0c4684ac --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/en/out.gotext.json +++ b/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/extracted.gotext.json @@ -1,11 +1,11 @@ { - "language": "en", + "language": "en-US", "messages": [ { - "id": "Hello {From}!", - "message": "Hello {From}!", - "translation": "Hello {From}!", - "translatorComment": "Copied from source.", + "id": "Hello {From}!\n", + "key": "Hello %s!\n", + "message": "Hello {From}!\n", + "translation": "", "placeholders": [ { "id": "From", @@ -16,13 +16,13 @@ "expr": "r.Header.Get(\"From\")" } ], - "fuzzy": true + "position": "golang.org/x/text/cmd/gotext/examples/extract_http/pkg/pkg.go:22:11" }, { - "id": "Do you like your browser ({User_Agent})?", - "message": "Do you like your browser ({User_Agent})?", - "translation": "Do you like your browser ({User_Agent})?", - "translatorComment": "Copied from source.", + "id": "Do you like your browser ({User_Agent})?\n", + "key": "Do you like your browser (%s)?\n", + "message": "Do you like your browser ({User_Agent})?\n", + "translation": "", "placeholders": [ { "id": "User_Agent", @@ -33,7 +33,7 @@ "expr": "r.Header.Get(\"User-Agent\")" } ], - "fuzzy": true + "position": "golang.org/x/text/cmd/gotext/examples/extract_http/pkg/pkg.go:24:11" } ] } \ No newline at end of file diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/zh/out.gotext.json b/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/zh/out.gotext.json index 7b26974d5..cad0ff035 100755 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/zh/out.gotext.json +++ b/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/zh/out.gotext.json @@ -2,8 +2,9 @@ "language": "zh", "messages": [ { - "id": "Hello {From}!", - "message": "Hello {From}!", + "id": "Hello {From}!\n", + "key": "Hello %s!\n", + "message": "Hello {From}!\n", "translation": "", "placeholders": [ { @@ -14,11 +15,13 @@ "argNum": 1, "expr": "r.Header.Get(\"From\")" } - ] + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract_http/pkg/pkg.go:22:11" }, { - "id": "Do you like your browser ({User_Agent})?", - "message": "Do you like your browser ({User_Agent})?", + "id": "Do you like your browser ({User_Agent})?\n", + "key": "Do you like your browser (%s)?\n", + "message": "Do you like your browser ({User_Agent})?\n", "translation": "", "placeholders": [ { @@ -29,7 +32,8 @@ "argNum": 1, "expr": "r.Header.Get(\"User-Agent\")" } - ] + ], + "position": "golang.org/x/text/cmd/gotext/examples/extract_http/pkg/pkg.go:24:11" } ] } \ No newline at end of file diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/main.go b/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/main.go index b5eb3b334..c1ac4494b 100644 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/main.go +++ b/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/main.go @@ -4,7 +4,7 @@ package main -//go:generate gotext -srclang=en update -out=catalog_gen.go -lang=en,zh +//go:generate gotext extract --lang=de,zh import ( "net/http" diff --git a/vendor/golang.org/x/text/cmd/gotext/extract.go b/vendor/golang.org/x/text/cmd/gotext/extract.go index 103d7e600..f1f700ba0 100644 --- a/vendor/golang.org/x/text/cmd/gotext/extract.go +++ b/vendor/golang.org/x/text/cmd/gotext/extract.go @@ -5,6 +5,13 @@ package main import ( + "encoding/json" + "io/ioutil" + "os" + "path/filepath" + + "golang.org/x/text/internal" + "golang.org/x/text/language" "golang.org/x/text/message/pipeline" ) @@ -14,7 +21,13 @@ import ( // - handle features (gender, plural) // - message rewriting +var ( + srcLang *string + lang *string +) + func init() { + srcLang = cmdExtract.Flag.String("srclang", "en-US", "the source-code language") lang = cmdExtract.Flag.String("lang", "en-US", "comma-separated list of languages to process") } @@ -24,17 +37,45 @@ var cmdExtract = &Command{ Short: "extracts strings to be translated from code", } -func runExtract(cmd *Command, config *pipeline.Config, args []string) error { - config.Packages = args - state, err := pipeline.Extract(config) +func runExtract(cmd *Command, args []string) error { + tag, err := language.Parse(*srcLang) + if err != nil { + return wrap(err, "") + } + config := &pipeline.Config{ + SourceLanguage: tag, + Packages: args, + } + out, err := pipeline.Extract(config) + + data, err := json.MarshalIndent(out, "", " ") if err != nil { - return wrap(err, "extract failed") + return wrap(err, "") } - if err := state.Import(); err != nil { - return wrap(err, "import failed") + os.MkdirAll(*dir, 0755) + // TODO: this file can probably go if we replace the extract + generate + // cycle with a init once and update cycle. + file := filepath.Join(*dir, extractFile) + if err := ioutil.WriteFile(file, data, 0644); err != nil { + return wrap(err, "could not create file") } - if err := state.Merge(); err != nil { - return wrap(err, "merge failed") + + langs := append(getLangs(), tag) + langs = internal.UniqueTags(langs) + for _, tag := range langs { + // TODO: inject translations from existing files to avoid retranslation. + out.Language = tag + data, err := json.MarshalIndent(out, "", " ") + if err != nil { + return wrap(err, "JSON marshal failed") + } + file := filepath.Join(*dir, tag.String(), outFile) + if err := os.MkdirAll(filepath.Dir(file), 0750); err != nil { + return wrap(err, "dir create failed") + } + if err := ioutil.WriteFile(file, data, 0740); err != nil { + return wrap(err, "write failed") + } } - return wrap(state.Export(), "export failed") + return nil } diff --git a/vendor/golang.org/x/text/cmd/gotext/generate.go b/vendor/golang.org/x/text/cmd/gotext/generate.go index 36820df8a..2d3446502 100644 --- a/vendor/golang.org/x/text/cmd/gotext/generate.go +++ b/vendor/golang.org/x/text/cmd/gotext/generate.go @@ -5,27 +5,100 @@ package main import ( + "encoding/json" + "fmt" + "io/ioutil" + "os" + "path/filepath" + "regexp" + "strings" + "golang.org/x/text/message/pipeline" + "golang.org/x/tools/go/loader" ) func init() { out = cmdGenerate.Flag.String("out", "", "output file to write to") } +var ( + out *string +) + var cmdGenerate = &Command{ Run: runGenerate, UsageLine: "generate ", Short: "generates code to insert translated messages", } -func runGenerate(cmd *Command, config *pipeline.Config, args []string) error { - config.Packages = args - s, err := pipeline.Extract(config) +var transRe = regexp.MustCompile(`messages\.(.*)\.json`) + +func runGenerate(cmd *Command, args []string) error { + + prog, err := loadPackages(&loader.Config{}, args) + if err != nil { + return wrap(err, "could not load package") + } + + pkgs := prog.InitialPackages() + if len(pkgs) != 1 { + return fmt.Errorf("more than one package selected: %v", pkgs) + } + pkg := pkgs[0].Pkg.Name() + + // TODO: add in external input. Right now we assume that all files are + // manually created and stored in the textdata directory. + + // Build up index of translations and original messages. + extracted := pipeline.Locale{} + translations := []*pipeline.Locale{} + + err = filepath.Walk(*dir, func(path string, f os.FileInfo, err error) error { + if err != nil { + return wrap(err, "loading data") + } + if f.IsDir() { + return nil + } + if f.Name() == extractFile { + b, err := ioutil.ReadFile(path) + if err != nil { + return wrap(err, "read file failed") + } + if err := json.Unmarshal(b, &extracted); err != nil { + return wrap(err, "unmarshal source failed") + } + return nil + } + if f.Name() == outFile { + return nil + } + if !strings.HasSuffix(path, gotextSuffix) { + return nil + } + b, err := ioutil.ReadFile(path) + if err != nil { + return wrap(err, "read file failed") + } + var locale pipeline.Locale + if err := json.Unmarshal(b, &locale); err != nil { + return wrap(err, "parsing translation file failed") + } + translations = append(translations, &locale) + return nil + }) if err != nil { - return wrap(err, "extraction failed") + return err } - if err := s.Import(); err != nil { - return wrap(err, "import failed") + + w := os.Stdout + if *out != "" { + w, err = os.Create(*out) + if err != nil { + return wrap(err, "create file failed") + } } - return wrap(s.Generate(), "generation failed") + + _, err = pipeline.Generate(w, pkg, &extracted, translations...) + return err } diff --git a/vendor/golang.org/x/text/cmd/gotext/main.go b/vendor/golang.org/x/text/cmd/gotext/main.go index 73f6d91cb..f3f50d797 100644 --- a/vendor/golang.org/x/text/cmd/gotext/main.go +++ b/vendor/golang.org/x/text/cmd/gotext/main.go @@ -25,8 +25,6 @@ import ( "unicode" "unicode/utf8" - "golang.org/x/text/message/pipeline" - "golang.org/x/text/language" "golang.org/x/tools/go/buildutil" ) @@ -35,23 +33,7 @@ func init() { flag.Var((*buildutil.TagsFlag)(&build.Default.BuildTags), "tags", buildutil.TagsFlagDoc) } -var ( - srcLang = flag.String("srclang", "en-US", "the source-code language") - dir = flag.String("dir", "locales", "default subdirectory to store translation files") -) - -func config() (*pipeline.Config, error) { - tag, err := language.Parse(*srcLang) - if err != nil { - return nil, wrap(err, "invalid srclang") - } - return &pipeline.Config{ - SourceLanguage: tag, - Supported: getLangs(), - TranslationsPattern: `messages\.(.*)\.json`, - GenFile: *out, - }, nil -} +var dir = flag.String("dir", "locales", "default subdirectory to store translation files") // NOTE: the Command struct is copied from the go tool in core. @@ -60,7 +42,7 @@ func config() (*pipeline.Config, error) { type Command struct { // Run runs the command. // The args are the arguments after the command name. - Run func(cmd *Command, c *pipeline.Config, args []string) error + Run func(cmd *Command, args []string) error // UsageLine is the one-line usage message. // The first word in the line is taken to be the command name. @@ -101,7 +83,6 @@ func (c *Command) Runnable() bool { // Commands lists the available commands and help topics. // The order here is the order in which they are printed by 'go help'. var commands = []*Command{ - cmdUpdate, cmdExtract, cmdRewrite, cmdGenerate, @@ -143,11 +124,7 @@ func main() { cmd.Flag.Usage = func() { cmd.Usage() } cmd.Flag.Parse(args[1:]) args = cmd.Flag.Args() - config, err := config() - if err != nil { - fatalf("gotext: %+v", err) - } - if err := cmd.Run(cmd, config, args); err != nil { + if err := cmd.Run(cmd, args); err != nil { fatalf("gotext: %+v", err) } exit() diff --git a/vendor/golang.org/x/text/cmd/gotext/rewrite.go b/vendor/golang.org/x/text/cmd/gotext/rewrite.go index 3ee9555e3..a35b727df 100644 --- a/vendor/golang.org/x/text/cmd/gotext/rewrite.go +++ b/vendor/golang.org/x/text/cmd/gotext/rewrite.go @@ -38,7 +38,7 @@ using Printf to allow translators to reorder arguments. `, } -func runRewrite(cmd *Command, _ *pipeline.Config, args []string) error { +func runRewrite(cmd *Command, args []string) error { w := os.Stdout if *overwrite { w = nil diff --git a/vendor/golang.org/x/text/cmd/gotext/update.go b/vendor/golang.org/x/text/cmd/gotext/update.go deleted file mode 100644 index 1260750cc..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/update.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "golang.org/x/text/message/pipeline" -) - -// TODO: -// - merge information into existing files -// - handle different file formats (PO, XLIFF) -// - handle features (gender, plural) -// - message rewriting - -var ( - lang *string - out *string -) - -func init() { - lang = cmdUpdate.Flag.String("lang", "en-US", "comma-separated list of languages to process") - out = cmdUpdate.Flag.String("out", "", "output file to write to") -} - -var cmdUpdate = &Command{ - Run: runUpdate, - UsageLine: "update * [-out ]", - Short: "merge translations and generate catalog", -} - -func runUpdate(cmd *Command, config *pipeline.Config, args []string) error { - config.Packages = args - state, err := pipeline.Extract(config) - if err != nil { - return wrap(err, "extract failed") - } - if err := state.Import(); err != nil { - return wrap(err, "import failed") - } - if err := state.Merge(); err != nil { - return wrap(err, "merge failed") - } - if err := state.Export(); err != nil { - return wrap(err, "export failed") - } - if *out != "" { - return wrap(state.Generate(), "generation failed") - } - return nil -} diff --git a/vendor/golang.org/x/text/currency/example_test.go b/vendor/golang.org/x/text/currency/example_test.go index 519c87228..f7984aa73 100644 --- a/vendor/golang.org/x/text/currency/example_test.go +++ b/vendor/golang.org/x/text/currency/example_test.go @@ -16,12 +16,12 @@ func ExampleQuery() { for it := currency.Query(currency.Date(t1799)); it.Next(); { from := "" if t, ok := it.From(); ok { - from = t.Format("2006-01-02") + from = t.Format("2006-01-01") } fmt.Printf("%v is used in %v since: %v\n", it.Unit(), it.Region(), from) } // Output: - // GBP is used in GB since: 1694-07-27 + // GBP is used in GB since: 1694-07-07 // GIP is used in GI since: 1713-01-01 // USD is used in US since: 1792-01-01 } diff --git a/vendor/golang.org/x/text/doc.go b/vendor/golang.org/x/text/doc.go index 2e19a419c..a48e2843f 100644 --- a/vendor/golang.org/x/text/doc.go +++ b/vendor/golang.org/x/text/doc.go @@ -7,9 +7,6 @@ // text is a repository of text-related packages related to internationalization // (i18n) and localization (l10n), such as character encodings, text // transformations, and locale-specific text handling. -// -// There is a 30 minute video, recorded on 2017-11-30, on the "State of -// golang.org/x/text" at https://www.youtube.com/watch?v=uYrDrMEGu58 package text // TODO: more documentation on general concepts, such as Transformers, use diff --git a/vendor/golang.org/x/text/internal/catmsg/catmsg.go b/vendor/golang.org/x/text/internal/catmsg/catmsg.go index c0bf86f09..32d6c2051 100644 --- a/vendor/golang.org/x/text/internal/catmsg/catmsg.go +++ b/vendor/golang.org/x/text/internal/catmsg/catmsg.go @@ -104,24 +104,20 @@ const ( msgFirst msgRaw msgString - msgAffix - // Leave some arbitrary room for future expansion: 20 should suffice. - numInternal = 20 + numFixed ) const prefix = "golang.org/x/text/internal/catmsg." var ( - // TODO: find a more stable way to link handles to message types. mutex sync.Mutex names = map[string]Handle{ prefix + "Vars": msgVars, prefix + "First": msgFirst, prefix + "Raw": msgRaw, prefix + "String": msgString, - prefix + "Affix": msgAffix, } - handlers = make([]Handler, numInternal) + handlers = make([]Handler, numFixed) ) func init() { @@ -165,20 +161,6 @@ func init() { } return true } - - handlers[msgAffix] = func(d *Decoder) bool { - // TODO: use an alternative method for common cases. - prefix := d.DecodeString() - suffix := d.DecodeString() - if prefix != "" { - d.Render(prefix) - } - ret := d.ExecuteMessage() - if suffix != "" { - d.Render(suffix) - } - return ret - } } var ( @@ -392,24 +374,3 @@ func (s String) Compile(e *Encoder) (err error) { } return err } - -// Affix is a message that adds a prefix and suffix to another message. -// This is mostly used add back whitespace to a translation that was stripped -// before sending it out. -type Affix struct { - Message Message - Prefix string - Suffix string -} - -// Compile implements Message. -func (a Affix) Compile(e *Encoder) (err error) { - // TODO: consider adding a special message type that just adds a single - // return. This is probably common enough to handle the majority of cases. - // Get some stats first, though. - e.EncodeMessageType(msgAffix) - e.EncodeString(a.Prefix) - e.EncodeString(a.Suffix) - e.EncodeMessage(a.Message) - return nil -} diff --git a/vendor/golang.org/x/text/internal/catmsg/catmsg_test.go b/vendor/golang.org/x/text/internal/catmsg/catmsg_test.go index b2a7a9e45..485d19c96 100644 --- a/vendor/golang.org/x/text/internal/catmsg/catmsg_test.go +++ b/vendor/golang.org/x/text/internal/catmsg/catmsg_test.go @@ -70,10 +70,6 @@ func TestCodec(t *testing.T) { desc: "simple string", m: String("foo"), tests: single("foo", ""), - }, { - desc: "affix", - m: &Affix{String("foo"), "\t", "\n"}, - tests: single("\t|foo|\n", ""), }, { desc: "missing var", m: String("foo${bar}"), @@ -104,13 +100,6 @@ func TestCodec(t *testing.T) { String("foo${bar}"), }, tests: single("foo|baz", ""), - }, { - desc: "affix with substitution", - m: &Affix{seq{ - &Var{"bar", String("baz")}, - String("foo${bar}"), - }, "\t", "\n"}, - tests: single("\t|foo|baz|\n", ""), }, { desc: "shadowed variable", m: seq{ @@ -151,7 +140,7 @@ func TestCodec(t *testing.T) { &Var{"bar", incomplete{}}, String("${bar}"), }, - enc: "\x00\t\b\x01\x01\x14\x04\x02bar\x03\x00\x00\x00", + enc: "\x00\t\b\x01\x01\x04\x04\x02bar\x03\x00\x00\x00", // TODO: recognize that it is cheaper to substitute bar. tests: single("bar", ""), }, { diff --git a/vendor/golang.org/x/text/message/pipeline/extract.go b/vendor/golang.org/x/text/message/pipeline/extract.go index 379cc6d86..20ad91463 100644 --- a/vendor/golang.org/x/text/message/pipeline/extract.go +++ b/vendor/golang.org/x/text/message/pipeline/extract.go @@ -28,12 +28,8 @@ import ( // - handle features (gender, plural) // - message rewriting -// - %m substitutions -// - `msg:"etc"` tags -// - msg/Msg top-level vars and strings. - // Extract extracts all strings form the package defined in Config. -func Extract(c *Config) (*State, error) { +func Extract(c *Config) (*Locale, error) { conf := loader.Config{} prog, err := loadPackages(&conf, c.Packages) if err != nil { @@ -145,11 +141,9 @@ func Extract(c *Config) (*State, error) { ph := placeholders{index: map[string]string{}} - trimmed, _, _ := trimWS(fmtMsg) - p := fmtparser.Parser{} p.Reset(simArgs) - for p.SetFormat(trimmed); p.Scan(); { + for p.SetFormat(fmtMsg); p.Scan(); { switch p.Status { case fmtparser.StatusText: msg += p.Text() @@ -195,14 +189,11 @@ func Extract(c *Config) (*State, error) { } } - return &State{ - Config: *c, - program: prog, - Extracted: Messages{ - Language: c.SourceLanguage, - Messages: messages, - }, - }, nil + out := &Locale{ + Language: c.SourceLanguage, + Messages: messages, + } + return out, nil } func posString(conf loader.Config, info *loader.PackageInfo, pos token.Pos) string { @@ -251,7 +242,7 @@ func strip(s string) string { if unicode.IsSpace(r) || r == '-' { return '_' } - if !unicode.In(r, unicode.Letter, unicode.Mark, unicode.Number) { + if !unicode.In(r, unicode.Letter, unicode.Mark) { return -1 } return r diff --git a/vendor/golang.org/x/text/message/pipeline/generate.go b/vendor/golang.org/x/text/message/pipeline/generate.go index 5d329b2f4..c5e51bd8f 100644 --- a/vendor/golang.org/x/text/message/pipeline/generate.go +++ b/vendor/golang.org/x/text/message/pipeline/generate.go @@ -6,9 +6,7 @@ package pipeline import ( "fmt" - "go/build" "io" - "path/filepath" "regexp" "sort" "strings" @@ -20,75 +18,23 @@ import ( "golang.org/x/text/internal/catmsg" "golang.org/x/text/internal/gen" "golang.org/x/text/language" - "golang.org/x/tools/go/loader" ) var transRe = regexp.MustCompile(`messages\.(.*)\.json`) -// Generate writes a Go file that defines a Catalog with translated messages. -// Translations are retrieved from s.Messages, not s.Translations, so it -// is assumed Merge has been called. -func (s *State) Generate() error { - path := s.Config.GenPackage - if path == "" { - path = "." - } - isDir := path[0] == '.' - prog, err := loadPackages(&loader.Config{}, []string{path}) - if err != nil { - return wrap(err, "could not load package") - } - pkgs := prog.InitialPackages() - if len(pkgs) != 1 { - return errorf("more than one package selected: %v", pkgs) - } - pkg := pkgs[0].Pkg.Name() - - cw, err := s.generate() - if err != nil { - return err - } - if !isDir { - gopath := build.Default.GOPATH - path = filepath.Join(gopath, filepath.FromSlash(pkgs[0].Pkg.Path())) - } - path = filepath.Join(path, s.Config.GenFile) - cw.WriteGoFile(path, pkg) // TODO: WriteGoFile should return error. - return err -} +// Generate writes a Go file with the given package name to w, which defines a +// Catalog with translated messages. +func Generate(w io.Writer, pkg string, extracted *Locale, trans ...*Locale) (n int, err error) { + // TODO: add in external input. Right now we assume that all files are + // manually created and stored in the textdata directory. -// WriteGen writes a Go file with the given package name to w that defines a -// Catalog with translated messages. Translations are retrieved from s.Messages, -// not s.Translations, so it is assumed Merge has been called. -func (s *State) WriteGen(w io.Writer, pkg string) error { - cw, err := s.generate() - if err != nil { - return err - } - _, err = cw.WriteGo(w, pkg, "") - return err -} - -// Generate is deprecated; use (*State).Generate(). -func Generate(w io.Writer, pkg string, extracted *Messages, trans ...Messages) (n int, err error) { - s := State{ - Extracted: *extracted, - Translations: trans, - } - cw, err := s.generate() - if err != nil { - return 0, err - } - return cw.WriteGo(w, pkg, "") -} - -func (s *State) generate() (*gen.CodeWriter, error) { // Build up index of translations and original messages. translations := map[language.Tag]map[string]Message{} languages := []language.Tag{} + langVars := []string{} usedKeys := map[string]int{} - for _, loc := range s.Messages { + for _, loc := range trans { tag := loc.Language if _, ok := translations[tag]; !ok { translations[tag] = map[string]Message{} @@ -98,7 +44,7 @@ func (s *State) generate() (*gen.CodeWriter, error) { if !m.Translation.IsEmpty() { for _, id := range m.ID { if _, ok := translations[tag][id]; ok { - warnf("Duplicate translation in locale %q for message %q", tag, id) + logf("Duplicate translation in locale %q for message %q", tag, id) } translations[tag][id] = m } @@ -109,11 +55,10 @@ func (s *State) generate() (*gen.CodeWriter, error) { // Verify completeness and register keys. internal.SortTags(languages) - langVars := []string{} for _, tag := range languages { langVars = append(langVars, strings.Replace(tag.String(), "-", "_", -1)) dict := translations[tag] - for _, msg := range s.Extracted.Messages { + for _, msg := range extracted.Messages { for _, id := range msg.ID { if trans, ok := dict[id]; ok && !trans.Translation.IsEmpty() { if _, ok := usedKeys[msg.Key]; !ok { @@ -122,7 +67,7 @@ func (s *State) generate() (*gen.CodeWriter, error) { break } // TODO: log missing entry. - warnf("%s: Missing entry for %q.", tag, id) + logf("%s: Missing entry for %q.", tag, id) } } } @@ -133,12 +78,12 @@ func (s *State) generate() (*gen.CodeWriter, error) { Fallback language.Tag Languages []string }{ - Fallback: s.Extracted.Language, + Fallback: extracted.Language, Languages: langVars, } if err := lookup.Execute(cw, x); err != nil { - return nil, wrap(err, "error") + return 0, wrap(err, "error") } keyToIndex := []string{} @@ -155,29 +100,21 @@ func (s *State) generate() (*gen.CodeWriter, error) { for i, tag := range languages { dict := translations[tag] a := make([]string, len(usedKeys)) - for _, msg := range s.Extracted.Messages { + for _, msg := range extracted.Messages { for _, id := range msg.ID { if trans, ok := dict[id]; ok && !trans.Translation.IsEmpty() { m, err := assemble(&msg, &trans.Translation) if err != nil { - return nil, wrap(err, "error") - } - _, leadWS, trailWS := trimWS(msg.Key) - if leadWS != "" || trailWS != "" { - m = catmsg.Affix{ - Message: m, - Prefix: leadWS, - Suffix: trailWS, - } + return 0, wrap(err, "error") } // TODO: support macros. data, err := catmsg.Compile(tag, nil, m) if err != nil { - return nil, wrap(err, "error") + return 0, wrap(err, "error") } key := usedKeys[msg.Key] if d := a[key]; d != "" && d != data { - warnf("Duplicate non-consistent translation for key %q, picking the one for message %q", msg.Key, id) + logf("Duplicate non-consistent translation for key %q, picking the one for message %q", msg.Key, id) } a[key] = string(data) break @@ -194,7 +131,7 @@ func (s *State) generate() (*gen.CodeWriter, error) { cw.WriteVar(langVars[i]+"Index", index) cw.WriteConst(langVars[i]+"Data", strings.Join(a, "")) } - return cw, nil + return cw.WriteGo(w, pkg, "") } func assemble(m *Message, t *Text) (msg catmsg.Message, err error) { diff --git a/vendor/golang.org/x/text/message/pipeline/go19_test.go b/vendor/golang.org/x/text/message/pipeline/go19_test.go deleted file mode 100644 index c9517c130..000000000 --- a/vendor/golang.org/x/text/message/pipeline/go19_test.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.9 - -package pipeline - -import "testing" - -func init() { - setHelper = (*testing.T).Helper -} diff --git a/vendor/golang.org/x/text/message/pipeline/message.go b/vendor/golang.org/x/text/message/pipeline/message.go index c83a8fd87..8e5470071 100644 --- a/vendor/golang.org/x/text/message/pipeline/message.go +++ b/vendor/golang.org/x/text/message/pipeline/message.go @@ -6,7 +6,6 @@ package pipeline import ( "encoding/json" - "errors" "strings" "golang.org/x/text/language" @@ -24,8 +23,28 @@ import ( // the format string "%d file(s) remaining". // See the examples directory for examples of extracted messages. -// Messages is used to store translations for a single language. -type Messages struct { +// Config contains configuration for the translation pipeline. +type Config struct { + SourceLanguage language.Tag + + // Supported indicates the languages for which data should be generated. + // If unspecified, it will attempt to derive the set of supported languages + // from the context. + Supported []language.Tag + + Packages []string + + // TODO: + // - Printf-style configuration + // - Template-style configuration + // - Extraction options + // - Rewrite options + // - Generation options +} + +// A Locale is used to store all information for a single locale. This type is +// used both for extraction and injection. +type Locale struct { Language language.Tag `json:"language"` Messages []Message `json:"messages"` Macros map[string]Text `json:"macros,omitempty"` @@ -36,7 +55,7 @@ type Message struct { // ID contains a list of identifiers for the message. ID IDList `json:"id"` // Key is the string that is used to look up the message at runtime. - Key string `json:"key,omitempty"` + Key string `json:"key"` Meaning string `json:"meaning,omitempty"` Message Text `json:"message"` Translation Text `json:"translation"` @@ -46,11 +65,6 @@ type Message struct { Placeholders []Placeholder `json:"placeholders,omitempty"` - // Fuzzy indicates that the provide translation needs review by a - // translator, for instance because it was derived from automated - // translation. - Fuzzy bool `json:"fuzzy,omitempty"` - // TODO: default placeholder syntax is {foo}. Allow alternative escaping // like `foo`. @@ -100,20 +114,6 @@ func (m *Message) Substitute(msg string) (sub string, err error) { return sub, err } -var errIncompatibleMessage = errors.New("messages incompatible") - -func checkEquivalence(a, b *Message) error { - for _, v := range a.ID { - for _, w := range b.ID { - if v == w { - return nil - } - } - } - // TODO: canonicalize placeholders and check for type equivalence. - return errIncompatibleMessage -} - // A Placeholder is a part of the message that should not be changed by a // translator. It can be used to hide or prettify format strings (e.g. %d or // {{.Count}}), hide HTML, or mark common names that should not be translated. diff --git a/vendor/golang.org/x/text/message/pipeline/pipeline.go b/vendor/golang.org/x/text/message/pipeline/pipeline.go index cafd6f29b..733a50c57 100644 --- a/vendor/golang.org/x/text/message/pipeline/pipeline.go +++ b/vendor/golang.org/x/text/message/pipeline/pipeline.go @@ -8,398 +8,33 @@ package pipeline import ( - "bytes" - "encoding/json" "fmt" "go/build" "go/parser" - "io/ioutil" "log" - "os" - "path/filepath" - "regexp" - "strings" - "text/template" - "unicode" - "golang.org/x/text/internal" - "golang.org/x/text/language" - "golang.org/x/text/runes" "golang.org/x/tools/go/loader" ) const ( extractFile = "extracted.gotext.json" outFile = "out.gotext.json" - gotextSuffix = "gotext.json" + gotextSuffix = ".gotext.json" ) -// Config contains configuration for the translation pipeline. -type Config struct { - // Supported indicates the languages for which data should be generated. - // The default is to support all locales for which there are matching - // translation files. - Supported []language.Tag - - // --- Extraction - - SourceLanguage language.Tag - - Packages []string - - // --- File structure - - // Dir is the root dir for all operations. - Dir string - - // TranslationsPattern is a regular expression to match incoming translation - // files. These files may appear in any directory rooted at Dir. - // language for the translation files is determined as follows: - // 1. From the Language field in the file. - // 2. If not present, from a valid language tag in the filename, separated - // by dots (e.g. "en-US.json" or "incoming.pt_PT.xmb"). - // 3. If not present, from a the closest subdirectory in which the file - // is contained that parses as a valid language tag. - TranslationsPattern string - - // OutPattern defines the location for translation files for a certain - // language. The default is "{{.Dir}}/{{.Language}}/out.{{.Ext}}" - OutPattern string - - // Format defines the file format for generated translation files. - // The default is XMB. Alternatives are GetText, XLIFF, L20n, GoText. - Format string - - Ext string - - // TODO: - // Actions are additional actions to be performed after the initial extract - // and merge. - // Actions []struct { - // Name string - // Options map[string]string - // } - - // --- Generation - - // GenFile may be in a different package. It is not defined, it will - // be written to stdout. - GenFile string - - // GenPackage is the package or relative path into which to generate the - // file. If not specified it is relative to the current directory. - GenPackage string - - // DeclareVar defines a variable to which to assing the generated Catalog. - DeclareVar string - - // SetDefault determines whether to assign the generated Catalog to - // message.DefaultCatalog. The default for this is true if DeclareVar is - // not defined, false otherwise. - SetDefault bool - - // TODO: - // - Printf-style configuration - // - Template-style configuration - // - Extraction options - // - Rewrite options - // - Generation options -} - -// Operations: -// - extract: get the strings -// - disambiguate: find messages with the same key, but possible different meaning. -// - create out: create a list of messages that need translations -// - load trans: load the list of current translations -// - merge: assign list of translations as done -// - (action)expand: analyze features and create example sentences for each version. -// - (action)googletrans: pre-populate messages with automatic translations. -// - (action)export: send out messages somewhere non-standard -// - (action)import: load messages from somewhere non-standard -// - vet program: don't pass "foo" + var + "bar" strings. Not using funcs for translated strings. -// - vet trans: coverage: all translations/ all features. -// - generate: generate Go code - -// State holds all accumulated information on translations during processing. -type State struct { - Config Config - - Package string - program *loader.Program - - Extracted Messages `json:"messages"` - - // Messages includes all messages for which there need to be translations. - // Duplicates may be eliminated. Generation will be done from these messages - // (usually after merging). - Messages []Messages - - // Translations are incoming translations for the application messages. - Translations []Messages -} - -func (s *State) dir() string { - if d := s.Config.Dir; d != "" { - return d - } - return "./locales" -} - -func outPattern(s *State) (string, error) { - c := s.Config - pat := c.OutPattern - if pat == "" { - pat = "{{.Dir}}/{{.Language}}/out.{{.Ext}}" - } - - ext := c.Ext - if ext == "" { - ext = c.Format - } - if ext == "" { - ext = gotextSuffix - } - t, err := template.New("").Parse(pat) - if err != nil { - return "", wrap(err, "error parsing template") - } - buf := bytes.Buffer{} - err = t.Execute(&buf, map[string]string{ - "Dir": s.dir(), - "Language": "%s", - "Ext": ext, - }) - return filepath.FromSlash(buf.String()), wrap(err, "incorrect OutPattern") -} - -var transRE = regexp.MustCompile(`.*\.` + gotextSuffix) - -// Import loads existing translation files. -func (s *State) Import() error { - outPattern, err := outPattern(s) - if err != nil { - return err - } - re := transRE - if pat := s.Config.TranslationsPattern; pat != "" { - if re, err = regexp.Compile(pat); err != nil { - return wrapf(err, "error parsing regexp %q", s.Config.TranslationsPattern) - } - } - x := importer{s, outPattern, re} - return x.walkImport(s.dir(), s.Config.SourceLanguage) -} - -type importer struct { - state *State - outPattern string - transFile *regexp.Regexp -} - -func (i *importer) walkImport(path string, tag language.Tag) error { - files, err := ioutil.ReadDir(path) - if err != nil { - return nil - } - for _, f := range files { - name := f.Name() - tag := tag - if f.IsDir() { - if t, err := language.Parse(name); err == nil { - tag = t - } - // We ignore errors - if err := i.walkImport(filepath.Join(path, name), tag); err != nil { - return err - } - continue - } - for _, l := range strings.Split(name, ".") { - if t, err := language.Parse(l); err == nil { - tag = t - } - } - file := filepath.Join(path, name) - // TODO: Should we skip files that match output files? - if fmt.Sprintf(i.outPattern, tag) == file { - continue - } - // TODO: handle different file formats. - if !i.transFile.MatchString(name) { - continue - } - b, err := ioutil.ReadFile(file) - if err != nil { - return wrap(err, "read file failed") - } - var translations Messages - if err := json.Unmarshal(b, &translations); err != nil { - return wrap(err, "parsing translation file failed") - } - i.state.Translations = append(i.state.Translations, translations) - } - return nil -} - -// Merge merges the extracted messages with the existing translations. -func (s *State) Merge() error { - if s.Messages != nil { - panic("already merged") - } - // Create an index for each unique message. - // Duplicates are okay as long as the substitution arguments are okay as - // well. - // Top-level messages are okay to appear in multiple substitution points. - - // Collect key equivalence. - msgs := []*Message{} - keyToIDs := map[string]*Message{} - for _, m := range s.Extracted.Messages { - m := m - if prev, ok := keyToIDs[m.Key]; ok { - if err := checkEquivalence(&m, prev); err != nil { - warnf("Key %q matches conflicting messages: %v and %v", m.Key, prev.ID, m.ID) - // TODO: track enough information so that the rewriter can - // suggest/disambiguate messages. - } - // TODO: add position to message. - continue - } - i := len(msgs) - msgs = append(msgs, &m) - keyToIDs[m.Key] = msgs[i] - } - - // Messages with different keys may still refer to the same translated - // message (e.g. different whitespace). Filter these. - idMap := map[string]bool{} - filtered := []*Message{} - for _, m := range msgs { - found := false - for _, id := range m.ID { - found = found || idMap[id] - } - if !found { - filtered = append(filtered, m) - } - for _, id := range m.ID { - idMap[id] = true - } - } - - // Build index of translations. - translations := map[language.Tag]map[string]Message{} - languages := append([]language.Tag{}, s.Config.Supported...) - - for _, t := range s.Translations { - tag := t.Language - if _, ok := translations[tag]; !ok { - translations[tag] = map[string]Message{} - languages = append(languages, tag) - } - for _, m := range t.Messages { - if !m.Translation.IsEmpty() { - for _, id := range m.ID { - if _, ok := translations[tag][id]; ok { - warnf("Duplicate translation in locale %q for message %q", tag, id) - } - translations[tag][id] = m - } - } - } - } - languages = internal.UniqueTags(languages) - - for _, tag := range languages { - ms := Messages{Language: tag} - for _, orig := range filtered { - m := *orig - m.Key = "" - m.Position = "" - - for _, id := range m.ID { - if t, ok := translations[tag][id]; ok { - m.Translation = t.Translation - if t.TranslatorComment != "" { - m.TranslatorComment = t.TranslatorComment - m.Fuzzy = t.Fuzzy - } - break - } - } - if tag == s.Config.SourceLanguage && m.Translation.IsEmpty() { - m.Translation = m.Message - if m.TranslatorComment == "" { - m.TranslatorComment = "Copied from source." - m.Fuzzy = true - } - } - // TODO: if translation is empty: pre-expand based on available - // linguistic features. This may also be done as a plugin. - ms.Messages = append(ms.Messages, m) - } - s.Messages = append(s.Messages, ms) - } - return nil -} - -// Export writes out the messages to translation out files. -func (s *State) Export() error { - path, err := outPattern(s) - if err != nil { - return wrap(err, "export failed") - } - for _, out := range s.Messages { - // TODO: inject translations from existing files to avoid retranslation. - data, err := json.MarshalIndent(out, "", " ") - if err != nil { - return wrap(err, "JSON marshal failed") - } - file := fmt.Sprintf(path, out.Language) - if err := os.MkdirAll(filepath.Dir(file), 0755); err != nil { - return wrap(err, "dir create failed") - } - if err := ioutil.WriteFile(file, data, 0644); err != nil { - return wrap(err, "write failed") - } - } - return nil -} - -var ( - ws = runes.In(unicode.White_Space).Contains - notWS = runes.NotIn(unicode.White_Space).Contains -) - -func trimWS(s string) (trimmed, leadWS, trailWS string) { - trimmed = strings.TrimRightFunc(s, ws) - trailWS = s[len(trimmed):] - if i := strings.IndexFunc(trimmed, notWS); i > 0 { - leadWS = trimmed[:i] - trimmed = trimmed[i:] - } - return trimmed, leadWS, trailWS -} - // NOTE: The command line tool already prefixes with "gotext:". var ( wrap = func(err error, msg string) error { - if err == nil { - return nil - } return fmt.Errorf("%s: %v", msg, err) } wrapf = func(err error, msg string, args ...interface{}) error { - if err == nil { - return nil - } return wrap(err, fmt.Sprintf(msg, args...)) } errorf = fmt.Errorf ) -func warnf(format string, args ...interface{}) { - // TODO: don't log. +// TODO: don't log. +func logf(format string, args ...interface{}) { log.Printf(format, args...) } diff --git a/vendor/golang.org/x/text/message/pipeline/pipeline_test.go b/vendor/golang.org/x/text/message/pipeline/pipeline_test.go deleted file mode 100644 index 293101b25..000000000 --- a/vendor/golang.org/x/text/message/pipeline/pipeline_test.go +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package pipeline - -import ( - "bufio" - "bytes" - "encoding/json" - "flag" - "fmt" - "io/ioutil" - "os" - "path" - "path/filepath" - "strings" - "testing" - - "golang.org/x/text/language" -) - -var genFiles = flag.Bool("gen", false, "generate output files instead of comparing") - -// setHelper is testing.T.Helper on Go 1.9+, overridden by go19_test.go. -var setHelper = func(t *testing.T) {} - -func TestFullCycle(t *testing.T) { - const path = "./testdata" - dirs, err := ioutil.ReadDir(path) - if err != nil { - t.Fatal(err) - } - for _, f := range dirs { - t.Run(f.Name(), func(t *testing.T) { - chk := func(t *testing.T, err error) { - setHelper(t) - if err != nil { - t.Fatal(err) - } - } - dir := filepath.Join(path, f.Name()) - pkgPath := fmt.Sprintf("%s/%s", path, f.Name()) - config := Config{ - SourceLanguage: language.AmericanEnglish, - Packages: []string{pkgPath}, - Dir: filepath.Join(dir, "locales"), - GenFile: "catalog_gen.go", - GenPackage: pkgPath, - } - // TODO: load config if available. - s, err := Extract(&config) - chk(t, err) - chk(t, s.Import()) - chk(t, s.Merge()) - // TODO: - // for range s.Config.Actions { - // // TODO: do the actions. - // } - chk(t, s.Export()) - chk(t, s.Generate()) - - writeJSON(t, filepath.Join(dir, "extracted.gotext.json"), s.Extracted) - checkOutput(t, dir) - }) - } -} - -func checkOutput(t *testing.T, p string) { - filepath.Walk(p, func(p string, f os.FileInfo, err error) error { - if f.IsDir() { - return nil - } - if filepath.Ext(p) != ".want" { - return nil - } - gotFile := p[:len(p)-len(".want")] - got, err := ioutil.ReadFile(gotFile) - if err != nil { - t.Errorf("failed to read %q", p) - return nil - } - if *genFiles { - if err := ioutil.WriteFile(p, got, 0644); err != nil { - t.Fatal(err) - } - } - want, err := ioutil.ReadFile(p) - if err != nil { - t.Errorf("failed to read %q", p) - } else { - scanGot := bufio.NewScanner(bytes.NewReader(got)) - scanWant := bufio.NewScanner(bytes.NewReader(want)) - line := 0 - clean := func(s string) string { - if i := strings.LastIndex(s, "//"); i != -1 { - s = s[:i] - } - return path.Clean(filepath.ToSlash(s)) - } - for scanGot.Scan() && scanWant.Scan() { - got := clean(scanGot.Text()) - want := clean(scanWant.Text()) - if got != want { - t.Errorf("file %q differs from .want file at line %d:\n\t%s\n\t%s", gotFile, line, got, want) - break - } - line++ - } - if scanGot.Scan() || scanWant.Scan() { - t.Errorf("file %q differs from .want file at line %d.", gotFile, line) - } - } - return nil - }) -} - -func writeJSON(t *testing.T, path string, x interface{}) { - data, err := json.MarshalIndent(x, "", " ") - if err != nil { - t.Fatal(err) - } - if err := ioutil.WriteFile(path, data, 0644); err != nil { - t.Fatal(err) - } -} diff --git a/vendor/golang.org/x/text/message/pipeline/rewrite.go b/vendor/golang.org/x/text/message/pipeline/rewrite.go index cf1511f56..fa78324e1 100644 --- a/vendor/golang.org/x/text/message/pipeline/rewrite.go +++ b/vendor/golang.org/x/text/message/pipeline/rewrite.go @@ -24,11 +24,11 @@ const printerType = "golang.org/x/text/message.Printer" // machinery and rewrites strings to adopt best practices when possible. // If w is not nil the generated files are written to it, each files with a // "--- " header. Otherwise the files are overwritten. -func Rewrite(w io.Writer, args ...string) error { +func Rewrite(w io.Writer, goPackage string) error { conf := &loader.Config{ AllowErrors: true, // Allow unused instances of message.Printer. } - prog, err := loadPackages(conf, args) + prog, err := loadPackages(conf, []string{goPackage}) if err != nil { return wrap(err, "") } diff --git a/vendor/golang.org/x/text/message/pipeline/testdata/test1/catalog_gen.go b/vendor/golang.org/x/text/message/pipeline/testdata/test1/catalog_gen.go deleted file mode 100644 index 7d93f4868..000000000 --- a/vendor/golang.org/x/text/message/pipeline/testdata/test1/catalog_gen.go +++ /dev/null @@ -1,85 +0,0 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. - -package main - -import ( - "golang.org/x/text/language" - "golang.org/x/text/message" - "golang.org/x/text/message/catalog" -) - -type dictionary struct { - index []uint32 - data string -} - -func (d *dictionary) Lookup(key string) (data string, ok bool) { - p := messageKeyToIndex[key] - start, end := d.index[p], d.index[p+1] - if start == end { - return "", false - } - return d.data[start:end], true -} - -func init() { - dict := map[string]catalog.Dictionary{ - "de": &dictionary{index: deIndex, data: deData}, - "en_US": &dictionary{index: en_USIndex, data: en_USData}, - "zh": &dictionary{index: zhIndex, data: zhData}, - } - fallback := language.MustParse("en-US") - cat, err := catalog.NewFromMap(dict, catalog.Fallback(fallback)) - if err != nil { - panic(err) - } - message.DefaultCatalog = cat -} - -var messageKeyToIndex = map[string]int{ - "%.2[1]f miles traveled (%[1]f)": 8, - "%[1]s is visiting %[3]s!\n": 3, - "%d files remaining!": 4, - "%d more files remaining!": 5, - "%s is out of order!": 7, - "%s is visiting %s!\n": 2, - "Hello %s!\n": 1, - "Hello world!\n": 0, - "Use the following code for your discount: %d\n": 6, -} - -var deIndex = []uint32{ // 10 elements - 0x00000000, 0x00000011, 0x00000023, 0x0000003d, - 0x00000057, 0x00000075, 0x00000094, 0x00000094, - 0x00000094, 0x00000094, -} // Size: 64 bytes - -const deData string = "" + // Size: 148 bytes - "\x04\x00\x01\x0a\x0c\x02Hallo Welt!\x04\x00\x01\x0a\x0d\x02Hallo %[1]s!" + - "\x04\x00\x01\x0a\x15\x02%[1]s besucht %[2]s!\x04\x00\x01\x0a\x15\x02%[1]" + - "s besucht %[3]s!\x02Noch zwei Bestände zu gehen!\x02Noch %[1]d Bestände " + - "zu gehen!" - -var en_USIndex = []uint32{ // 10 elements - 0x00000000, 0x00000012, 0x00000024, 0x00000042, - 0x00000060, 0x00000077, 0x000000ba, 0x000000ef, - 0x00000106, 0x00000125, -} // Size: 64 bytes - -const en_USData string = "" + // Size: 293 bytes - "\x04\x00\x01\x0a\x0d\x02Hello world!\x04\x00\x01\x0a\x0d\x02Hello %[1]s!" + - "\x04\x00\x01\x0a\x19\x02%[1]s is visiting %[2]s!\x04\x00\x01\x0a\x19\x02" + - "%[1]s is visiting %[3]s!\x02%[1]d files remaining!\x14\x01\x81\x01\x00" + - "\x02\x14\x02One file remaining!\x00&\x02There are %[1]d more files remai" + - "ning!\x04\x00\x01\x0a0\x02Use the following code for your discount: %[1]" + - "d\x02%[1]s is out of order!\x02%.2[1]f miles traveled (%[1]f)" - -var zhIndex = []uint32{ // 10 elements - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -} // Size: 64 bytes - -const zhData string = "" - -// Total table size 633 bytes (0KiB); checksum: 74B32E70 diff --git a/vendor/golang.org/x/text/message/pipeline/testdata/test1/catalog_gen.go.want b/vendor/golang.org/x/text/message/pipeline/testdata/test1/catalog_gen.go.want deleted file mode 100644 index 7d93f4868..000000000 --- a/vendor/golang.org/x/text/message/pipeline/testdata/test1/catalog_gen.go.want +++ /dev/null @@ -1,85 +0,0 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. - -package main - -import ( - "golang.org/x/text/language" - "golang.org/x/text/message" - "golang.org/x/text/message/catalog" -) - -type dictionary struct { - index []uint32 - data string -} - -func (d *dictionary) Lookup(key string) (data string, ok bool) { - p := messageKeyToIndex[key] - start, end := d.index[p], d.index[p+1] - if start == end { - return "", false - } - return d.data[start:end], true -} - -func init() { - dict := map[string]catalog.Dictionary{ - "de": &dictionary{index: deIndex, data: deData}, - "en_US": &dictionary{index: en_USIndex, data: en_USData}, - "zh": &dictionary{index: zhIndex, data: zhData}, - } - fallback := language.MustParse("en-US") - cat, err := catalog.NewFromMap(dict, catalog.Fallback(fallback)) - if err != nil { - panic(err) - } - message.DefaultCatalog = cat -} - -var messageKeyToIndex = map[string]int{ - "%.2[1]f miles traveled (%[1]f)": 8, - "%[1]s is visiting %[3]s!\n": 3, - "%d files remaining!": 4, - "%d more files remaining!": 5, - "%s is out of order!": 7, - "%s is visiting %s!\n": 2, - "Hello %s!\n": 1, - "Hello world!\n": 0, - "Use the following code for your discount: %d\n": 6, -} - -var deIndex = []uint32{ // 10 elements - 0x00000000, 0x00000011, 0x00000023, 0x0000003d, - 0x00000057, 0x00000075, 0x00000094, 0x00000094, - 0x00000094, 0x00000094, -} // Size: 64 bytes - -const deData string = "" + // Size: 148 bytes - "\x04\x00\x01\x0a\x0c\x02Hallo Welt!\x04\x00\x01\x0a\x0d\x02Hallo %[1]s!" + - "\x04\x00\x01\x0a\x15\x02%[1]s besucht %[2]s!\x04\x00\x01\x0a\x15\x02%[1]" + - "s besucht %[3]s!\x02Noch zwei Bestände zu gehen!\x02Noch %[1]d Bestände " + - "zu gehen!" - -var en_USIndex = []uint32{ // 10 elements - 0x00000000, 0x00000012, 0x00000024, 0x00000042, - 0x00000060, 0x00000077, 0x000000ba, 0x000000ef, - 0x00000106, 0x00000125, -} // Size: 64 bytes - -const en_USData string = "" + // Size: 293 bytes - "\x04\x00\x01\x0a\x0d\x02Hello world!\x04\x00\x01\x0a\x0d\x02Hello %[1]s!" + - "\x04\x00\x01\x0a\x19\x02%[1]s is visiting %[2]s!\x04\x00\x01\x0a\x19\x02" + - "%[1]s is visiting %[3]s!\x02%[1]d files remaining!\x14\x01\x81\x01\x00" + - "\x02\x14\x02One file remaining!\x00&\x02There are %[1]d more files remai" + - "ning!\x04\x00\x01\x0a0\x02Use the following code for your discount: %[1]" + - "d\x02%[1]s is out of order!\x02%.2[1]f miles traveled (%[1]f)" - -var zhIndex = []uint32{ // 10 elements - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -} // Size: 64 bytes - -const zhData string = "" - -// Total table size 633 bytes (0KiB); checksum: 74B32E70 diff --git a/vendor/golang.org/x/text/message/pipeline/testdata/test1/catalog_test.go b/vendor/golang.org/x/text/message/pipeline/testdata/test1/catalog_test.go deleted file mode 100644 index eeb7c25f4..000000000 --- a/vendor/golang.org/x/text/message/pipeline/testdata/test1/catalog_test.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "path" - "testing" - - "golang.org/x/text/message" -) - -func TestCatalog(t *testing.T) { - args := func(a ...interface{}) []interface{} { return a } - testCases := []struct { - lang string - key string - args []interface{} - want string - }{{ - lang: "en", - key: "Hello world!\n", - want: "Hello world!\n", - }, { - lang: "de", - key: "Hello world!\n", - want: "Hallo Welt!\n", - }, { - lang: "en", - key: "%d more files remaining!", - args: args(1), - want: "One file remaining!", - }, { - lang: "en-u-nu-fullwide", - key: "%d more files remaining!", - args: args(5), - want: "There are 5 more files remaining!", - }} - for _, tc := range testCases { - t.Run(path.Join(tc.lang, tc.key), func(t *testing.T) { - p := message.NewPrinter(message.MatchLanguage(tc.lang)) - got := p.Sprintf(tc.key, tc.args...) - if got != tc.want { - t.Errorf("got %q; want %q", got, tc.want) - } - }) - } -} diff --git a/vendor/golang.org/x/text/message/pipeline/testdata/test1/extracted.gotext.json.want b/vendor/golang.org/x/text/message/pipeline/testdata/test1/extracted.gotext.json.want deleted file mode 100644 index 4d317af59..000000000 --- a/vendor/golang.org/x/text/message/pipeline/testdata/test1/extracted.gotext.json.want +++ /dev/null @@ -1,188 +0,0 @@ -{ - "language": "en-US", - "messages": [ - { - "id": "Hello world!", - "key": "Hello world!\n", - "message": "Hello world!", - "translation": "", - "position": "testdata/test1/test1.go:19:10" - }, - { - "id": "Hello {City}!", - "key": "Hello %s!\n", - "message": "Hello {City}!", - "translation": "", - "placeholders": [ - { - "id": "City", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "city" - } - ], - "position": "testdata/test1/test1.go:24:10" - }, - { - "id": "{Person} is visiting {Place}!", - "key": "%s is visiting %s!\n", - "message": "{Person} is visiting {Place}!", - "translation": "", - "placeholders": [ - { - "id": "Person", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "person", - "comment": "The person of matter." - }, - { - "id": "Place", - "string": "%[2]s", - "type": "string", - "underlyingType": "string", - "argNum": 2, - "expr": "place", - "comment": "Place the person is visiting." - } - ], - "position": "testdata/test1/test1.go:30:10" - }, - { - "id": "{Person} is visiting {Place}!", - "key": "%[1]s is visiting %[3]s!\n", - "message": "{Person} is visiting {Place}!", - "translation": "", - "comment": "Field names are placeholders.", - "placeholders": [ - { - "id": "Person", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "pp.Person" - }, - { - "id": "Place", - "string": "%[3]s", - "type": "string", - "underlyingType": "string", - "argNum": 3, - "expr": "pp.Place", - "comment": "Place the person is visiting." - }, - { - "id": "Extra", - "string": "%[2]v", - "type": "int", - "underlyingType": "int", - "argNum": 2, - "expr": "pp.extra" - } - ], - "position": "testdata/test1/test1.go:44:10" - }, - { - "id": "{2} files remaining!", - "key": "%d files remaining!", - "message": "{2} files remaining!", - "translation": "", - "placeholders": [ - { - "id": "2", - "string": "%[1]d", - "type": "int", - "underlyingType": "int", - "argNum": 1, - "expr": "2" - } - ], - "position": "testdata/test1/test1.go:51:10" - }, - { - "id": "{N} more files remaining!", - "key": "%d more files remaining!", - "message": "{N} more files remaining!", - "translation": "", - "placeholders": [ - { - "id": "N", - "string": "%[1]d", - "type": "int", - "underlyingType": "int", - "argNum": 1, - "expr": "n" - } - ], - "position": "testdata/test1/test1.go:56:10" - }, - { - "id": "Use the following code for your discount: {ReferralCode}", - "key": "Use the following code for your discount: %d\n", - "message": "Use the following code for your discount: {ReferralCode}", - "translation": "", - "placeholders": [ - { - "id": "ReferralCode", - "string": "%[1]d", - "type": "./testdata/test1.referralCode", - "underlyingType": "int", - "argNum": 1, - "expr": "c" - } - ], - "position": "testdata/test1/test1.go:64:10" - }, - { - "id": [ - "msgOutOfOrder", - "{Device} is out of order!" - ], - "key": "%s is out of order!", - "message": "{Device} is out of order!", - "translation": "", - "comment": "This comment wins.\n", - "placeholders": [ - { - "id": "Device", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "device" - } - ], - "position": "testdata/test1/test1.go:70:10" - }, - { - "id": "{Miles} miles traveled ({Miles_1})", - "key": "%.2[1]f miles traveled (%[1]f)", - "message": "{Miles} miles traveled ({Miles_1})", - "translation": "", - "placeholders": [ - { - "id": "Miles", - "string": "%.2[1]f", - "type": "float64", - "underlyingType": "float64", - "argNum": 1, - "expr": "miles" - }, - { - "id": "Miles_1", - "string": "%[1]f", - "type": "float64", - "underlyingType": "float64", - "argNum": 1, - "expr": "miles" - } - ], - "position": "testdata/test1/test1.go:74:10" - } - ] -} \ No newline at end of file diff --git a/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/de/messages.gotext.json b/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/de/messages.gotext.json deleted file mode 100755 index f92e4a1f5..000000000 --- a/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/de/messages.gotext.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "language": "de", - "messages": [ - { - "id": "Hello world!", - "key": "Hello world!\n", - "message": "Hello world!", - "translation": "Hallo Welt!" - }, - { - "id": "Hello {City}!", - "key": "Hello %s!\n", - "message": "Hello {City}!", - "translation": "Hallo {City}!", - "placeholders": [ - { - "id": "City", - "string": "%[1]s" - } - ] - }, - { - "id": "{Person} is visiting {Place}!", - "key": "%s is visiting %s!\n", - "message": "{Person} is visiting {Place}!", - "translation": "{Person} besucht {Place}!", - "placeholders": [ - { - "id": "Person", - "string": "%[1]s" - }, - { - "id": "Place", - "string": "%[2]s" - } - ] - }, - { - "id": "{Person} is visiting {Place}!", - "key": "%[1]s is visiting %[3]s!\n", - "message": "{Person} is visiting {Place}!", - "translation": "{Person} besucht {Place}!", - "placeholders": [ - { - "id": "Person", - "string": "%[1]s" - }, - { - "id": "Place", - "string": "%[3]s" - }, - { - "id": "Extra", - "string": "%[2]v" - } - ] - }, - { - "id": "{2} files remaining!", - "key": "%d files remaining!", - "message": "{N} files remaining!", - "translation": "Noch zwei Bestände zu gehen!", - "placeholders": [ - { - "id": "2", - "string": "%[1]d" - } - ] - }, - { - "id": "{N} more files remaining!", - "key": "%d more files remaining!", - "message": "{N} more files remaining!", - "translation": "Noch {N} Bestände zu gehen!", - "placeholders": [ - { - "id": "N", - "string": "%[1]d" - } - ] - }, - { - "id": "Use the following code for your discount: {ReferralCode}", - "key": "Use the following code for your discount: %d\n", - "message": "Use the following code for your discount: {ReferralCode}", - "translation": "", - "placeholders": [ - { - "id": "ReferralCode", - "string": "%[1]d" - } - ] - }, - { - "id": [ "msgOutOfOrder", "{Device} is out of order!" ], - "key": "%s is out of order!", - "message": "{Device} is out of order!", - "translation": "", - "placeholders": [ - { - "id": "Device", - "string": "%[1]s" - } - ] - }, - { - "id": "{Miles} miles traveled ({Miles_1})", - "key": "%.2[1]f miles traveled (%[1]f)", - "message": "{Miles} miles traveled ({Miles_1})", - "translation": "", - "placeholders": [ - { - "id": "Miles", - "string": "%.2[1]f" - }, - { - "id": "Miles_1", - "string": "%[1]f" - } - ] - } - ] -} diff --git a/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/de/out.gotext.json b/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/de/out.gotext.json deleted file mode 100755 index f19e21d72..000000000 --- a/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/de/out.gotext.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "language": "de", - "messages": [ - { - "id": "Hello world!", - "message": "Hello world!", - "translation": "Hallo Welt!" - }, - { - "id": "Hello {City}!", - "message": "Hello {City}!", - "translation": "Hallo {City}!", - "placeholders": [ - { - "id": "City", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "city" - } - ] - }, - { - "id": "{Person} is visiting {Place}!", - "message": "{Person} is visiting {Place}!", - "translation": "{Person} besucht {Place}!", - "placeholders": [ - { - "id": "Person", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "person", - "comment": "The person of matter." - }, - { - "id": "Place", - "string": "%[2]s", - "type": "string", - "underlyingType": "string", - "argNum": 2, - "expr": "place", - "comment": "Place the person is visiting." - } - ] - }, - { - "id": "{2} files remaining!", - "message": "{2} files remaining!", - "translation": "Noch zwei Bestände zu gehen!", - "placeholders": [ - { - "id": "2", - "string": "%[1]d", - "type": "int", - "underlyingType": "int", - "argNum": 1, - "expr": "2" - } - ] - }, - { - "id": "{N} more files remaining!", - "message": "{N} more files remaining!", - "translation": "Noch {N} Bestände zu gehen!", - "placeholders": [ - { - "id": "N", - "string": "%[1]d", - "type": "int", - "underlyingType": "int", - "argNum": 1, - "expr": "n" - } - ] - }, - { - "id": "Use the following code for your discount: {ReferralCode}", - "message": "Use the following code for your discount: {ReferralCode}", - "translation": "", - "placeholders": [ - { - "id": "ReferralCode", - "string": "%[1]d", - "type": "./testdata/test1.referralCode", - "underlyingType": "int", - "argNum": 1, - "expr": "c" - } - ] - }, - { - "id": [ - "msgOutOfOrder", - "{Device} is out of order!" - ], - "message": "{Device} is out of order!", - "translation": "", - "comment": "This comment wins.\n", - "placeholders": [ - { - "id": "Device", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "device" - } - ] - }, - { - "id": "{Miles} miles traveled ({Miles_1})", - "message": "{Miles} miles traveled ({Miles_1})", - "translation": "", - "placeholders": [ - { - "id": "Miles", - "string": "%.2[1]f", - "type": "float64", - "underlyingType": "float64", - "argNum": 1, - "expr": "miles" - }, - { - "id": "Miles_1", - "string": "%[1]f", - "type": "float64", - "underlyingType": "float64", - "argNum": 1, - "expr": "miles" - } - ] - } - ] -} \ No newline at end of file diff --git a/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/de/out.gotext.json.want b/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/de/out.gotext.json.want deleted file mode 100755 index f19e21d72..000000000 --- a/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/de/out.gotext.json.want +++ /dev/null @@ -1,137 +0,0 @@ -{ - "language": "de", - "messages": [ - { - "id": "Hello world!", - "message": "Hello world!", - "translation": "Hallo Welt!" - }, - { - "id": "Hello {City}!", - "message": "Hello {City}!", - "translation": "Hallo {City}!", - "placeholders": [ - { - "id": "City", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "city" - } - ] - }, - { - "id": "{Person} is visiting {Place}!", - "message": "{Person} is visiting {Place}!", - "translation": "{Person} besucht {Place}!", - "placeholders": [ - { - "id": "Person", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "person", - "comment": "The person of matter." - }, - { - "id": "Place", - "string": "%[2]s", - "type": "string", - "underlyingType": "string", - "argNum": 2, - "expr": "place", - "comment": "Place the person is visiting." - } - ] - }, - { - "id": "{2} files remaining!", - "message": "{2} files remaining!", - "translation": "Noch zwei Bestände zu gehen!", - "placeholders": [ - { - "id": "2", - "string": "%[1]d", - "type": "int", - "underlyingType": "int", - "argNum": 1, - "expr": "2" - } - ] - }, - { - "id": "{N} more files remaining!", - "message": "{N} more files remaining!", - "translation": "Noch {N} Bestände zu gehen!", - "placeholders": [ - { - "id": "N", - "string": "%[1]d", - "type": "int", - "underlyingType": "int", - "argNum": 1, - "expr": "n" - } - ] - }, - { - "id": "Use the following code for your discount: {ReferralCode}", - "message": "Use the following code for your discount: {ReferralCode}", - "translation": "", - "placeholders": [ - { - "id": "ReferralCode", - "string": "%[1]d", - "type": "./testdata/test1.referralCode", - "underlyingType": "int", - "argNum": 1, - "expr": "c" - } - ] - }, - { - "id": [ - "msgOutOfOrder", - "{Device} is out of order!" - ], - "message": "{Device} is out of order!", - "translation": "", - "comment": "This comment wins.\n", - "placeholders": [ - { - "id": "Device", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "device" - } - ] - }, - { - "id": "{Miles} miles traveled ({Miles_1})", - "message": "{Miles} miles traveled ({Miles_1})", - "translation": "", - "placeholders": [ - { - "id": "Miles", - "string": "%.2[1]f", - "type": "float64", - "underlyingType": "float64", - "argNum": 1, - "expr": "miles" - }, - { - "id": "Miles_1", - "string": "%[1]f", - "type": "float64", - "underlyingType": "float64", - "argNum": 1, - "expr": "miles" - } - ] - } - ] -} \ No newline at end of file diff --git a/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/en-US/messages.gotext.json b/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/en-US/messages.gotext.json deleted file mode 100755 index b984242f6..000000000 --- a/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/en-US/messages.gotext.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "language": "en-US", - "messages": [ - { - "id": "Hello world!", - "key": "Hello world!\n", - "message": "Hello world!", - "translation": "Hello world!" - }, - { - "id": "Hello {City}!", - "key": "Hello %s!\n", - "message": "Hello {City}!", - "translation": "Hello {City}!" - }, - { - "id": "Hello {Town}!", - "key": "Hello %s!\n", - "message": "Hello {Town}!", - "translation": "Hello {Town}!", - "placeholders": [ - { - "id": "Town", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "town", - "comment": "Town" - } - ] - }, - { - "id": "{Person} is visiting {Place}!", - "key": "%s is visiting %s!\n", - "message": "{Person} is visiting {Place}!", - "translation": "{Person} is visiting {Place}!" - }, - { - "id": "{Person} is visiting {Place}!", - "key": "%[1]s is visiting %[3]s!\n", - "message": "{Person} is visiting {Place}!", - "translation": "{Person} is visiting {Place}!" - }, - { - "id": "{2} files remaining!", - "key": "%d files remaining!", - "message": "{N} files remaining!", - "translation": "", - "placeholders": [ - { - "id": "2", - "string": "%[1]d" - } - ] - }, - { - "id": "{N} more files remaining!", - "key": "%d more files remaining!", - "message": "{N} more files remaining!", - "translation": { - "select": { - "feature": "plural", - "arg": "N", - "cases": { - "one": "One file remaining!", - "other": "There are {N} more files remaining!" - } - } - } - }, - { - "id": "Use the following code for your discount: {ReferralCode}", - "key": "Use the following code for your discount: %d\n", - "message": "Use the following code for your discount: {ReferralCode}", - "translation": "" - }, - { - "id": [ "msgOutOfOrder", "{Device} is out of order!" ], - "key": "%s is out of order!", - "message": "{Device} is out of order!", - "translation": "{Device} is out of order!" - }, - { - "id": "{Miles} miles traveled ({Miles_1})", - "key": "%.2[1]f miles traveled (%[1]f)", - "message": "{Miles} miles traveled ({Miles_1})", - "translation": "{Miles} miles traveled ({Miles_1})" - } - ] -} diff --git a/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/en-US/out.gotext.json b/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/en-US/out.gotext.json deleted file mode 100755 index 59f92a5a6..000000000 --- a/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/en-US/out.gotext.json +++ /dev/null @@ -1,154 +0,0 @@ -{ - "language": "en-US", - "messages": [ - { - "id": "Hello world!", - "message": "Hello world!", - "translation": "Hello world!" - }, - { - "id": "Hello {City}!", - "message": "Hello {City}!", - "translation": "Hello {City}!", - "placeholders": [ - { - "id": "City", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "city" - } - ] - }, - { - "id": "{Person} is visiting {Place}!", - "message": "{Person} is visiting {Place}!", - "translation": "{Person} is visiting {Place}!", - "placeholders": [ - { - "id": "Person", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "person", - "comment": "The person of matter." - }, - { - "id": "Place", - "string": "%[2]s", - "type": "string", - "underlyingType": "string", - "argNum": 2, - "expr": "place", - "comment": "Place the person is visiting." - } - ] - }, - { - "id": "{2} files remaining!", - "message": "{2} files remaining!", - "translation": "{2} files remaining!", - "translatorComment": "Copied from source.", - "placeholders": [ - { - "id": "2", - "string": "%[1]d", - "type": "int", - "underlyingType": "int", - "argNum": 1, - "expr": "2" - } - ], - "fuzzy": true - }, - { - "id": "{N} more files remaining!", - "message": "{N} more files remaining!", - "translation": { - "select": { - "feature": "plural", - "arg": "N", - "cases": { - "one": { - "msg": "One file remaining!" - }, - "other": { - "msg": "There are {N} more files remaining!" - } - } - } - }, - "placeholders": [ - { - "id": "N", - "string": "%[1]d", - "type": "int", - "underlyingType": "int", - "argNum": 1, - "expr": "n" - } - ] - }, - { - "id": "Use the following code for your discount: {ReferralCode}", - "message": "Use the following code for your discount: {ReferralCode}", - "translation": "Use the following code for your discount: {ReferralCode}", - "translatorComment": "Copied from source.", - "placeholders": [ - { - "id": "ReferralCode", - "string": "%[1]d", - "type": "./testdata/test1.referralCode", - "underlyingType": "int", - "argNum": 1, - "expr": "c" - } - ], - "fuzzy": true - }, - { - "id": [ - "msgOutOfOrder", - "{Device} is out of order!" - ], - "message": "{Device} is out of order!", - "translation": "{Device} is out of order!", - "comment": "This comment wins.\n", - "placeholders": [ - { - "id": "Device", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "device" - } - ] - }, - { - "id": "{Miles} miles traveled ({Miles_1})", - "message": "{Miles} miles traveled ({Miles_1})", - "translation": "{Miles} miles traveled ({Miles_1})", - "placeholders": [ - { - "id": "Miles", - "string": "%.2[1]f", - "type": "float64", - "underlyingType": "float64", - "argNum": 1, - "expr": "miles" - }, - { - "id": "Miles_1", - "string": "%[1]f", - "type": "float64", - "underlyingType": "float64", - "argNum": 1, - "expr": "miles" - } - ] - } - ] -} \ No newline at end of file diff --git a/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/en-US/out.gotext.json.want b/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/en-US/out.gotext.json.want deleted file mode 100755 index 59f92a5a6..000000000 --- a/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/en-US/out.gotext.json.want +++ /dev/null @@ -1,154 +0,0 @@ -{ - "language": "en-US", - "messages": [ - { - "id": "Hello world!", - "message": "Hello world!", - "translation": "Hello world!" - }, - { - "id": "Hello {City}!", - "message": "Hello {City}!", - "translation": "Hello {City}!", - "placeholders": [ - { - "id": "City", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "city" - } - ] - }, - { - "id": "{Person} is visiting {Place}!", - "message": "{Person} is visiting {Place}!", - "translation": "{Person} is visiting {Place}!", - "placeholders": [ - { - "id": "Person", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "person", - "comment": "The person of matter." - }, - { - "id": "Place", - "string": "%[2]s", - "type": "string", - "underlyingType": "string", - "argNum": 2, - "expr": "place", - "comment": "Place the person is visiting." - } - ] - }, - { - "id": "{2} files remaining!", - "message": "{2} files remaining!", - "translation": "{2} files remaining!", - "translatorComment": "Copied from source.", - "placeholders": [ - { - "id": "2", - "string": "%[1]d", - "type": "int", - "underlyingType": "int", - "argNum": 1, - "expr": "2" - } - ], - "fuzzy": true - }, - { - "id": "{N} more files remaining!", - "message": "{N} more files remaining!", - "translation": { - "select": { - "feature": "plural", - "arg": "N", - "cases": { - "one": { - "msg": "One file remaining!" - }, - "other": { - "msg": "There are {N} more files remaining!" - } - } - } - }, - "placeholders": [ - { - "id": "N", - "string": "%[1]d", - "type": "int", - "underlyingType": "int", - "argNum": 1, - "expr": "n" - } - ] - }, - { - "id": "Use the following code for your discount: {ReferralCode}", - "message": "Use the following code for your discount: {ReferralCode}", - "translation": "Use the following code for your discount: {ReferralCode}", - "translatorComment": "Copied from source.", - "placeholders": [ - { - "id": "ReferralCode", - "string": "%[1]d", - "type": "./testdata/test1.referralCode", - "underlyingType": "int", - "argNum": 1, - "expr": "c" - } - ], - "fuzzy": true - }, - { - "id": [ - "msgOutOfOrder", - "{Device} is out of order!" - ], - "message": "{Device} is out of order!", - "translation": "{Device} is out of order!", - "comment": "This comment wins.\n", - "placeholders": [ - { - "id": "Device", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "device" - } - ] - }, - { - "id": "{Miles} miles traveled ({Miles_1})", - "message": "{Miles} miles traveled ({Miles_1})", - "translation": "{Miles} miles traveled ({Miles_1})", - "placeholders": [ - { - "id": "Miles", - "string": "%.2[1]f", - "type": "float64", - "underlyingType": "float64", - "argNum": 1, - "expr": "miles" - }, - { - "id": "Miles_1", - "string": "%[1]f", - "type": "float64", - "underlyingType": "float64", - "argNum": 1, - "expr": "miles" - } - ] - } - ] -} \ No newline at end of file diff --git a/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/zh/messages.gotext.json b/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/zh/messages.gotext.json deleted file mode 100755 index c80d1d2a7..000000000 --- a/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/zh/messages.gotext.json +++ /dev/null @@ -1,135 +0,0 @@ -{ - "language": "zh", - "messages": [ - { - "id": "Hello world!", - "key": "Hello world!\n", - "message": "Hello world!", - "translation": "" - }, - { - "id": "Hello {City}!", - "key": "Hello %s!\n", - "message": "Hello {City}!", - "translation": "", - "placeholders": [ - { - "id": "City", - "string": "%[1]s" - } - ] - }, - { - "id": "Hello {Town}!", - "key": "Hello %s!\n", - "message": "Hello {Town}!", - "translation": "", - "placeholders": [ - { - "id": "Town", - "string": "%[1]s" - } - ] - }, - { - "id": "{Person} is visiting {Place}!", - "key": "%s is visiting %s!\n", - "message": "{Person} is visiting {Place}!", - "translation": "", - "placeholders": [ - { - "id": "Person", - "string": "%[1]s" - }, - { - "id": "Place", - "string": "%[2]s" - } - ] - }, - { - "id": "{Person} is visiting {Place}!", - "key": "%[1]s is visiting %[3]s!\n", - "message": "{Person} is visiting {Place}!", - "translation": "", - "placeholders": [ - { - "id": "Person", - "string": "%[1]s" - }, - { - "id": "Place", - "string": "%[3]s" - }, - { - "id": "Extra", - "string": "%[2]v" - } - ] - }, - { - "id": "{2} files remaining!", - "key": "%d files remaining!", - "message": "{2} files remaining!", - "translation": "", - "placeholders": [ - { - "id": "", - "string": "%[1]d" - } - ] - }, - { - "id": "{N} more files remaining!", - "key": "%d more files remaining!", - "message": "{N} more files remaining!", - "translation": "", - "placeholders": [ - { - "id": "N", - "string": "%[1]d" - } - ] - }, - { - "id": "Use the following code for your discount: {ReferralCode}", - "key": "Use the following code for your discount: %d\n", - "message": "Use the following code for your discount: {ReferralCode}", - "translation": "", - "placeholders": [ - { - "id": "ReferralCode", - "string": "%[1]d" - } - ] - }, - { - "id": [ "{Device} is out of order!", "msgOutOfOrder" ], - "key": "%s is out of order!", - "message": "{Device} is out of order!", - "translation": "", - "placeholders": [ - { - "id": "Device", - "string": "%[1]s" - } - ] - }, - { - "id": "{Miles} miles traveled ({Miles_1})", - "key": "%.2[1]f miles traveled (%[1]f)", - "message": "{Miles} miles traveled ({Miles_1})", - "translation": "", - "placeholders": [ - { - "id": "Miles", - "string": "%.2[1]f" - }, - { - "id": "Miles_1", - "string": "%[1]f" - } - ] - } - ] -} \ No newline at end of file diff --git a/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/zh/out.gotext.json b/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/zh/out.gotext.json deleted file mode 100755 index 9bede65ee..000000000 --- a/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/zh/out.gotext.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "language": "zh", - "messages": [ - { - "id": "Hello world!", - "message": "Hello world!", - "translation": "" - }, - { - "id": "Hello {City}!", - "message": "Hello {City}!", - "translation": "", - "placeholders": [ - { - "id": "City", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "city" - } - ] - }, - { - "id": "{Person} is visiting {Place}!", - "message": "{Person} is visiting {Place}!", - "translation": "", - "placeholders": [ - { - "id": "Person", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "person", - "comment": "The person of matter." - }, - { - "id": "Place", - "string": "%[2]s", - "type": "string", - "underlyingType": "string", - "argNum": 2, - "expr": "place", - "comment": "Place the person is visiting." - } - ] - }, - { - "id": "{2} files remaining!", - "message": "{2} files remaining!", - "translation": "", - "placeholders": [ - { - "id": "2", - "string": "%[1]d", - "type": "int", - "underlyingType": "int", - "argNum": 1, - "expr": "2" - } - ] - }, - { - "id": "{N} more files remaining!", - "message": "{N} more files remaining!", - "translation": "", - "placeholders": [ - { - "id": "N", - "string": "%[1]d", - "type": "int", - "underlyingType": "int", - "argNum": 1, - "expr": "n" - } - ] - }, - { - "id": "Use the following code for your discount: {ReferralCode}", - "message": "Use the following code for your discount: {ReferralCode}", - "translation": "", - "placeholders": [ - { - "id": "ReferralCode", - "string": "%[1]d", - "type": "./testdata/test1.referralCode", - "underlyingType": "int", - "argNum": 1, - "expr": "c" - } - ] - }, - { - "id": [ - "msgOutOfOrder", - "{Device} is out of order!" - ], - "message": "{Device} is out of order!", - "translation": "", - "comment": "This comment wins.\n", - "placeholders": [ - { - "id": "Device", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "device" - } - ] - }, - { - "id": "{Miles} miles traveled ({Miles_1})", - "message": "{Miles} miles traveled ({Miles_1})", - "translation": "", - "placeholders": [ - { - "id": "Miles", - "string": "%.2[1]f", - "type": "float64", - "underlyingType": "float64", - "argNum": 1, - "expr": "miles" - }, - { - "id": "Miles_1", - "string": "%[1]f", - "type": "float64", - "underlyingType": "float64", - "argNum": 1, - "expr": "miles" - } - ] - } - ] -} \ No newline at end of file diff --git a/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/zh/out.gotext.json.want b/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/zh/out.gotext.json.want deleted file mode 100755 index 9bede65ee..000000000 --- a/vendor/golang.org/x/text/message/pipeline/testdata/test1/locales/zh/out.gotext.json.want +++ /dev/null @@ -1,137 +0,0 @@ -{ - "language": "zh", - "messages": [ - { - "id": "Hello world!", - "message": "Hello world!", - "translation": "" - }, - { - "id": "Hello {City}!", - "message": "Hello {City}!", - "translation": "", - "placeholders": [ - { - "id": "City", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "city" - } - ] - }, - { - "id": "{Person} is visiting {Place}!", - "message": "{Person} is visiting {Place}!", - "translation": "", - "placeholders": [ - { - "id": "Person", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "person", - "comment": "The person of matter." - }, - { - "id": "Place", - "string": "%[2]s", - "type": "string", - "underlyingType": "string", - "argNum": 2, - "expr": "place", - "comment": "Place the person is visiting." - } - ] - }, - { - "id": "{2} files remaining!", - "message": "{2} files remaining!", - "translation": "", - "placeholders": [ - { - "id": "2", - "string": "%[1]d", - "type": "int", - "underlyingType": "int", - "argNum": 1, - "expr": "2" - } - ] - }, - { - "id": "{N} more files remaining!", - "message": "{N} more files remaining!", - "translation": "", - "placeholders": [ - { - "id": "N", - "string": "%[1]d", - "type": "int", - "underlyingType": "int", - "argNum": 1, - "expr": "n" - } - ] - }, - { - "id": "Use the following code for your discount: {ReferralCode}", - "message": "Use the following code for your discount: {ReferralCode}", - "translation": "", - "placeholders": [ - { - "id": "ReferralCode", - "string": "%[1]d", - "type": "./testdata/test1.referralCode", - "underlyingType": "int", - "argNum": 1, - "expr": "c" - } - ] - }, - { - "id": [ - "msgOutOfOrder", - "{Device} is out of order!" - ], - "message": "{Device} is out of order!", - "translation": "", - "comment": "This comment wins.\n", - "placeholders": [ - { - "id": "Device", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "device" - } - ] - }, - { - "id": "{Miles} miles traveled ({Miles_1})", - "message": "{Miles} miles traveled ({Miles_1})", - "translation": "", - "placeholders": [ - { - "id": "Miles", - "string": "%.2[1]f", - "type": "float64", - "underlyingType": "float64", - "argNum": 1, - "expr": "miles" - }, - { - "id": "Miles_1", - "string": "%[1]f", - "type": "float64", - "underlyingType": "float64", - "argNum": 1, - "expr": "miles" - } - ] - } - ] -} \ No newline at end of file diff --git a/vendor/golang.org/x/text/message/pipeline/testdata/test1/test1.go b/vendor/golang.org/x/text/message/pipeline/testdata/test1/test1.go deleted file mode 100644 index 88051f932..000000000 --- a/vendor/golang.org/x/text/message/pipeline/testdata/test1/test1.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import "golang.org/x/text/message" - -func main() { - p := message.NewPrinter(message.MatchLanguage("en")) - - // NOT EXTRACTED: strings passed to Println are not extracted. - p.Println("Hello world!") - - // NOT EXTRACTED: strings passed to Print are not extracted. - p.Print("Hello world!\n") - - // Extract and trim whitespace (TODO). - p.Printf("Hello world!\n") - - // NOT EXTRACTED: city is not used as a pattern or passed to %m. - city := "Amsterdam" - // This comment is extracted. - p.Printf("Hello %s!\n", city) - - person := "Sheila" - place := "Zürich" - - // Substitutions replaced by variable names. - p.Printf("%s is visiting %s!\n", - person, // The person of matter. - place, // Place the person is visiting. - ) - - pp := struct { - Person string // The person of matter. // TODO: get this comment. - Place string - extra int - }{ - person, place, 4, - } - - // extract will drop this comment in favor of the one below. - p.Printf("%[1]s is visiting %[3]s!\n", // Field names are placeholders. - pp.Person, - pp.extra, - pp.Place, // Place the person is visiting. - ) - - // Numeric literal becomes placeholder. - p.Printf("%d files remaining!", 2) - - const n = 2 - - // Constant identifier becomes placeholder. - p.Printf("%d more files remaining!", n) - - // Infer better names from type names. - type referralCode int - - const c = referralCode(5) - - // Use type name as placeholder. - p.Printf("Use the following code for your discount: %d\n", c) - - // Use constant name as message ID. - const msgOutOfOrder = "%s is out of order!" // This comment wins. - const device = "Soda machine" - // This message has two IDs. - p.Printf(msgOutOfOrder, device) - - // Multiple substitutions for same argument. - miles := 1.2345 - p.Printf("%.2[1]f miles traveled (%[1]f)", miles) -} diff --git a/vendor/google.golang.org/genproto/googleapis/bigtable/admin/v2/bigtable_instance_admin.pb.go b/vendor/google.golang.org/genproto/googleapis/bigtable/admin/v2/bigtable_instance_admin.pb.go index 2eba7f16b..2c32e1e9c 100644 --- a/vendor/google.golang.org/genproto/googleapis/bigtable/admin/v2/bigtable_instance_admin.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/bigtable/admin/v2/bigtable_instance_admin.pb.go @@ -33,6 +33,7 @@ It has these top-level messages: ListAppProfilesResponse UpdateAppProfileRequest DeleteAppProfileRequest + UpdateAppProfileMetadata CreateTableRequest CreateTableFromSnapshotRequest DropRowRangeRequest @@ -794,6 +795,20 @@ func (m *DeleteAppProfileRequest) GetIgnoreWarnings() bool { return false } +// This is a private alpha release of Cloud Bigtable replication. This feature +// is not currently available to most Cloud Bigtable customers. This feature +// might be changed in backward-incompatible ways and is not recommended for +// production use. It is not subject to any SLA or deprecation policy. +// +// The metadata for the Operation returned by UpdateAppProfile. +type UpdateAppProfileMetadata struct { +} + +func (m *UpdateAppProfileMetadata) Reset() { *m = UpdateAppProfileMetadata{} } +func (m *UpdateAppProfileMetadata) String() string { return proto.CompactTextString(m) } +func (*UpdateAppProfileMetadata) ProtoMessage() {} +func (*UpdateAppProfileMetadata) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} } + func init() { proto.RegisterType((*CreateInstanceRequest)(nil), "google.bigtable.admin.v2.CreateInstanceRequest") proto.RegisterType((*GetInstanceRequest)(nil), "google.bigtable.admin.v2.GetInstanceRequest") @@ -816,6 +831,7 @@ func init() { proto.RegisterType((*ListAppProfilesResponse)(nil), "google.bigtable.admin.v2.ListAppProfilesResponse") proto.RegisterType((*UpdateAppProfileRequest)(nil), "google.bigtable.admin.v2.UpdateAppProfileRequest") proto.RegisterType((*DeleteAppProfileRequest)(nil), "google.bigtable.admin.v2.DeleteAppProfileRequest") + proto.RegisterType((*UpdateAppProfileMetadata)(nil), "google.bigtable.admin.v2.UpdateAppProfileMetadata") } // Reference imports to suppress errors if they are not otherwise used. @@ -1617,103 +1633,103 @@ func init() { } var fileDescriptor0 = []byte{ - // 1559 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x59, 0xcd, 0x6f, 0xdc, 0x44, - 0x1b, 0xd7, 0x6c, 0xfa, 0xf6, 0x6d, 0x9e, 0xcd, 0xd7, 0x3b, 0x6f, 0xf3, 0x21, 0xd3, 0x8f, 0xd4, - 0xad, 0xda, 0x74, 0x1b, 0x6c, 0xb2, 0xa0, 0xb6, 0x4a, 0x48, 0x45, 0x9b, 0x96, 0x28, 0x28, 0x55, - 0xa3, 0x6d, 0x29, 0x6a, 0x15, 0xb1, 0x9a, 0x64, 0x27, 0x8b, 0x89, 0xd7, 0x36, 0xb6, 0x37, 0x50, - 0xa1, 0x5e, 0x10, 0x42, 0xa8, 0x12, 0x1c, 0x40, 0xe2, 0x52, 0xc1, 0x85, 0x0b, 0xaa, 0x10, 0x88, - 0x0b, 0x37, 0xae, 0x20, 0xc1, 0x91, 0xbf, 0x00, 0x89, 0x33, 0xe2, 0xc6, 0x15, 0xcd, 0x97, 0xd7, - 0xf6, 0xda, 0x6b, 0xa7, 0x55, 0xa5, 0x9e, 0xba, 0x9e, 0x79, 0xe6, 0x99, 0xdf, 0xf3, 0x3c, 0xbf, - 0x67, 0xe6, 0x37, 0x29, 0x9c, 0x6f, 0xbb, 0x6e, 0xdb, 0xa6, 0xe6, 0x96, 0xd5, 0x0e, 0xc9, 0x96, - 0x4d, 0x4d, 0xd2, 0xea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x41, 0x50, 0x6e, 0x3e, 0x35, 0x28, 0x41, 0x0a, 0xca, 0x77, 0x08, 0xf0, - 0x2d, 0x1a, 0xf0, 0x41, 0xea, 0x77, 0xac, 0x20, 0xe0, 0x7f, 0x1d, 0x9a, 0x4b, 0x6d, 0xd6, 0x6f, - 0xa2, 0x60, 0x9d, 0x2d, 0x61, 0x29, 0x9b, 0x61, 0x85, 0x43, 0x5d, 0xd6, 0x2f, 0x96, 0x83, 0x1a, - 0xf6, 0x79, 0x5a, 0x44, 0xb5, 0x2b, 0x3f, 0x21, 0x38, 0xb2, 0xed, 0x76, 0x72, 0x09, 0x75, 0x45, - 0xcb, 0x94, 0xf2, 0x1b, 0x8c, 0x45, 0x1b, 0xe8, 0xee, 0xb2, 0x5c, 0xd7, 0x76, 0x6d, 0xe2, 0xb4, - 0x0d, 0xd7, 0x6f, 0x9b, 0x6d, 0xea, 0x70, 0x8e, 0x99, 0x62, 0x8a, 0x78, 0x56, 0xd0, 0xff, 0xff, - 0x18, 0x4b, 0xfc, 0xc7, 0xa3, 0xca, 0xb1, 0x55, 0xb1, 0x7e, 0xc5, 0x76, 0xbb, 0x2d, 0x43, 0x6d, - 0x65, 0xf0, 0x3d, 0x8c, 0xdb, 0xf5, 0x5f, 0x95, 0xc1, 0x26, 0x37, 0xd8, 0x54, 0x06, 0x9b, 0xdc, - 0x60, 0xf3, 0x76, 0x7d, 0xeb, 0x20, 0xdf, 0xeb, 0xc5, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x2f, - 0xdb, 0x53, 0xda, 0xa2, 0x19, 0x00, 0x00, + // 1566 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x59, 0xcf, 0x6f, 0xdc, 0xc4, + 0x17, 0xd7, 0x6c, 0xfa, 0xed, 0xb7, 0x79, 0x9b, 0x5f, 0xdf, 0xf9, 0x36, 0xc9, 0xca, 0xf4, 0x47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42, 0xbe, 0xd6, 0x07, 0x1b, 0x45, 0x65, + 0x71, 0x88, 0x15, 0x22, 0x41, 0xe2, 0x88, 0xcb, 0xf3, 0x8b, 0x7f, 0x44, 0x30, 0x95, 0x6c, 0x58, + 0xf2, 0x64, 0x90, 0xd1, 0xfc, 0x15, 0xa5, 0xcd, 0x26, 0xc7, 0xf7, 0x5a, 0x63, 0x99, 0xe3, 0x8b, + 0xc4, 0x54, 0x2b, 0xcf, 0x6e, 0x5c, 0x0b, 0x5f, 0x20, 0x98, 0x4a, 0x76, 0x70, 0x79, 0xc0, 0x33, + 0xba, 0xbd, 0xcc, 0xac, 0x12, 0x8c, 0xd6, 0x87, 0xd6, 0xc0, 0xc7, 0x08, 0xc6, 0x58, 0x4f, 0x44, + 0xba, 0x9b, 0xfc, 0x0f, 0xce, 0xfd, 0x6e, 0xc0, 0x20, 0x5d, 0x6d, 0x7f, 0x51, 0x8b, 0x4e, 0x4a, + 0x14, 0xd3, 0x09, 0x9b, 0x60, 0x36, 0xbc, 0x3b, 0x1a, 0x1c, 0x84, 0x4b, 0x3d, 0xbb, 0xe7, 0xee, + 0x64, 0x5f, 0xae, 0x9d, 0x88, 0x67, 0x56, 0x73, 0x18, 0x94, 0x9b, 0x79, 0x50, 0x6e, 0x3e, 0x35, + 0x28, 0x5e, 0x02, 0xca, 0x77, 0x08, 0xf0, 0x2d, 0xea, 0xf1, 0x41, 0xea, 0x76, 0x0d, 0xcf, 0xe3, + 0x7f, 0x39, 0x9a, 0x4f, 0x6c, 0x36, 0x68, 0x22, 0x61, 0x9d, 0x2d, 0x61, 0x29, 0x92, 0x61, 0x95, + 0x43, 0x5d, 0x51, 0x2f, 0x96, 0x83, 0xea, 0x0f, 0x78, 0x5a, 0x42, 0xf5, 0x2b, 0x3f, 0x21, 0x38, + 0xb2, 0x63, 0x77, 0x33, 0x05, 0x75, 0x45, 0x49, 0x6d, 0xe5, 0x37, 0x99, 0x8a, 0x36, 0xd1, 0xdd, + 0x15, 0xb1, 0xae, 0x63, 0x9b, 0xc4, 0xea, 0x68, 0xb6, 0xdb, 0xd1, 0x3b, 0xd4, 0xe2, 0x1a, 0xd3, + 0x83, 0x29, 0xe2, 0x18, 0xde, 0xe0, 0xff, 0x71, 0x2c, 0xf3, 0x1f, 0x8f, 0x2a, 0xc7, 0xd6, 0x82, + 0xf5, 0xab, 0xa6, 0xdd, 0x6b, 0x6b, 0x72, 0x2b, 0x8d, 0xef, 0xa1, 0xdd, 0x6e, 0xfc, 0x2a, 0x0d, + 0xb6, 0xb8, 0xc1, 0x96, 0x34, 0xd8, 0xe2, 0x06, 0x5b, 0xb7, 0x1b, 0xdb, 0x07, 0xf9, 0x5e, 0x2f, + 0xfe, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x1c, 0xa0, 0x3f, 0x27, 0xbe, 0x19, 0x00, 0x00, } diff --git a/vendor/google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1/agent.pb.go b/vendor/google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1/agent.pb.go index 204423db3..de8066895 100644 --- a/vendor/google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1/agent.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1/agent.pb.go @@ -250,8 +250,7 @@ func (m *Agent) GetClassificationThreshold() float32 { return 0 } -// The request message for -// [Agents.GetAgent][google.cloud.dialogflow.v2beta1.Agents.GetAgent]. +// The request message for [Agents.GetAgent][google.cloud.dialogflow.v2beta1.Agents.GetAgent]. type GetAgentRequest struct { // Required. The project that the agent to fetch is associated with. // Format: `projects/`. @@ -270,8 +269,7 @@ func (m *GetAgentRequest) GetParent() string { return "" } -// The request message for -// [Agents.SearchAgents][google.cloud.dialogflow.v2beta1.Agents.SearchAgents]. +// The request message for [Agents.SearchAgents][google.cloud.dialogflow.v2beta1.Agents.SearchAgents]. type SearchAgentsRequest struct { // Required. The project to list agents from. // Format: `projects/`. @@ -309,8 +307,7 @@ func (m *SearchAgentsRequest) GetPageToken() string { return "" } -// The response message for -// [Agents.SearchAgents][google.cloud.dialogflow.v2beta1.Agents.SearchAgents]. +// The response message for [Agents.SearchAgents][google.cloud.dialogflow.v2beta1.Agents.SearchAgents]. type SearchAgentsResponse struct { // The list of agents. There will be a maximum number of items returned based // on the page_size field in the request. @@ -339,8 +336,7 @@ func (m *SearchAgentsResponse) GetNextPageToken() string { return "" } -// The request message for -// [Agents.TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent]. +// The request message for [Agents.TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent]. type TrainAgentRequest struct { // Required. The project that the agent to train is associated with. // Format: `projects/`. @@ -359,15 +355,11 @@ func (m *TrainAgentRequest) GetParent() string { return "" } -// The request message for -// [Agents.ExportAgent][google.cloud.dialogflow.v2beta1.Agents.ExportAgent]. +// The request message for [Agents.ExportAgent][google.cloud.dialogflow.v2beta1.Agents.ExportAgent]. type ExportAgentRequest struct { // Required. The project that the agent to export is associated with. // Format: `projects/`. Parent string `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"` - // Warning: Exporting agents to a URI is not implemented yet. - // This feature is coming soon. - // // Optional. The Google Cloud Storage URI to export the agent to. // Note: The URI must start with // "gs://". If left unspecified, the serialized agent is returned inline. @@ -393,8 +385,7 @@ func (m *ExportAgentRequest) GetAgentUri() string { return "" } -// The response message for -// [Agents.ExportAgent][google.cloud.dialogflow.v2beta1.Agents.ExportAgent]. +// The response message for [Agents.ExportAgent][google.cloud.dialogflow.v2beta1.Agents.ExportAgent]. type ExportAgentResponse struct { // Required. The exported agent. // @@ -510,8 +501,7 @@ func _ExportAgentResponse_OneofSizer(msg proto.Message) (n int) { return n } -// The request message for -// [Agents.ImportAgent][google.cloud.dialogflow.v2beta1.Agents.ImportAgent]. +// The request message for [Agents.ImportAgent][google.cloud.dialogflow.v2beta1.Agents.ImportAgent]. type ImportAgentRequest struct { // Required. The project that the agent to import is associated with. // Format: `projects/`. @@ -637,8 +627,7 @@ func _ImportAgentRequest_OneofSizer(msg proto.Message) (n int) { return n } -// The request message for -// [Agents.RestoreAgent][google.cloud.dialogflow.v2beta1.Agents.RestoreAgent]. +// The request message for [Agents.RestoreAgent][google.cloud.dialogflow.v2beta1.Agents.RestoreAgent]. type RestoreAgentRequest struct { // Required. The project that the agent to restore is associated with. // Format: `projects/`. @@ -807,8 +796,7 @@ type AgentsClient interface { // Exports the specified agent to a ZIP file. // // - // Operation ExportAgent(ctx context.Context, in *ExportAgentRequest, opts ...grpc.CallOption) (*google_longrunning.Operation, error) // Imports the specified agent from a ZIP file. @@ -916,8 +904,7 @@ type AgentsServer interface { // Exports the specified agent to a ZIP file. // // - // Operation ExportAgent(context.Context, *ExportAgentRequest) (*google_longrunning.Operation, error) // Imports the specified agent from a ZIP file. diff --git a/vendor/google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1/context.pb.go b/vendor/google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1/context.pb.go index dafb43531..84c11da5c 100644 --- a/vendor/google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1/context.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1/context.pb.go @@ -24,8 +24,13 @@ var _ = math.Inf // Represents a context. type Context struct { // Required. The unique identifier of the context. Format: - // `projects//agent/sessions//contexts/`. - // Note: The Context ID is always converted to lowercase. + // `projects//agent/sessions//contexts/`, + // or + // `projects//agent/runtimes//sessions//contexts/`. + // Note: Runtimes are under construction and will be available soon. + // The Context ID is always converted to lowercase. + // If is not specified, we assume default 'sandbox' runtime. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` // Optional. The number of conversational query requests after which the // context expires. If set to `0` (the default) the context expires @@ -64,11 +69,13 @@ func (m *Context) GetParameters() *google_protobuf4.Struct { return nil } -// The request message for -// [Contexts.ListContexts][google.cloud.dialogflow.v2beta1.Contexts.ListContexts]. +// The request message for [Contexts.ListContexts][google.cloud.dialogflow.v2beta1.Contexts.ListContexts]. type ListContextsRequest struct { // Required. The session to list all contexts from. - // Format: `projects//agent/sessions/`. + // Format: `projects//agent/sessions/` or + // `projects//agent/runtimes//sessions/`. + // Note: Runtimes are under construction and will be available soon. + // If is not specified, we assume default 'sandbox' runtime. Parent string `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"` // Optional. The maximum number of items to return in a single page. By // default 100 and at most 1000. @@ -103,8 +110,7 @@ func (m *ListContextsRequest) GetPageToken() string { return "" } -// The response message for -// [Contexts.ListContexts][google.cloud.dialogflow.v2beta1.Contexts.ListContexts]. +// The response message for [Contexts.ListContexts][google.cloud.dialogflow.v2beta1.Contexts.ListContexts]. type ListContextsResponse struct { // The list of contexts. There will be a maximum number of items // returned based on the page_size field in the request. @@ -133,11 +139,14 @@ func (m *ListContextsResponse) GetNextPageToken() string { return "" } -// The request message for -// [Contexts.GetContext][google.cloud.dialogflow.v2beta1.Contexts.GetContext]. +// The request message for [Contexts.GetContext][google.cloud.dialogflow.v2beta1.Contexts.GetContext]. type GetContextRequest struct { // Required. The name of the context. Format: - // `projects//agent/sessions//contexts/`. + // `projects//agent/sessions//contexts/` + // or `projects//agent/runtimes//sessions//contexts/`. Note: Runtimes are under construction and will + // be available soon. If is not specified, we assume default + // 'sandbox' runtime. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` } @@ -153,11 +162,13 @@ func (m *GetContextRequest) GetName() string { return "" } -// The request message for -// [Contexts.CreateContext][google.cloud.dialogflow.v2beta1.Contexts.CreateContext]. +// The request message for [Contexts.CreateContext][google.cloud.dialogflow.v2beta1.Contexts.CreateContext]. type CreateContextRequest struct { // Required. The session to create a context for. - // Format: `projects//agent/sessions/`. + // Format: `projects//agent/sessions/` or + // `projects//agent/runtimes//sessions/`. + // Note: Runtimes are under construction and will be available soon. + // If is not specified, we assume default 'sandbox' runtime. Parent string `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"` // Required. The context to create. Context *Context `protobuf:"bytes,2,opt,name=context" json:"context,omitempty"` @@ -182,8 +193,7 @@ func (m *CreateContextRequest) GetContext() *Context { return nil } -// The request message for -// [Contexts.UpdateContext][google.cloud.dialogflow.v2beta1.Contexts.UpdateContext]. +// The request message for [Contexts.UpdateContext][google.cloud.dialogflow.v2beta1.Contexts.UpdateContext]. type UpdateContextRequest struct { // Required. The context to update. Context *Context `protobuf:"bytes,1,opt,name=context" json:"context,omitempty"` @@ -210,11 +220,14 @@ func (m *UpdateContextRequest) GetUpdateMask() *google_protobuf3.FieldMask { return nil } -// The request message for -// [Contexts.DeleteContext][google.cloud.dialogflow.v2beta1.Contexts.DeleteContext]. +// The request message for [Contexts.DeleteContext][google.cloud.dialogflow.v2beta1.Contexts.DeleteContext]. type DeleteContextRequest struct { // Required. The name of the context to delete. Format: - // `projects//agent/sessions//contexts/`. + // `projects//agent/sessions//contexts/` + // or `projects//agent/runtimes//sessions//contexts/`. Note: Runtimes are under construction and will + // be available soon. If is not specified, we assume default + // 'sandbox' runtime. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` } @@ -230,11 +243,13 @@ func (m *DeleteContextRequest) GetName() string { return "" } -// The request message for -// [Contexts.DeleteAllContexts][google.cloud.dialogflow.v2beta1.Contexts.DeleteAllContexts]. +// The request message for [Contexts.DeleteAllContexts][google.cloud.dialogflow.v2beta1.Contexts.DeleteAllContexts]. type DeleteAllContextsRequest struct { // Required. The name of the session to delete all contexts from. Format: - // `projects//agent/sessions/`. + // `projects//agent/sessions/` or `projects//agent/runtimes//sessions/`. Note: Runtimes are + // under construction and will be available soon. If is not + // specified we assume default 'sandbox' runtime. Parent string `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"` } diff --git a/vendor/google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1/entity_type.pb.go b/vendor/google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1/entity_type.pb.go index 31d44cbf8..6364ec6d7 100644 --- a/vendor/google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1/entity_type.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1/entity_type.pb.go @@ -175,8 +175,7 @@ func (m *EntityType_Entity) GetSynonyms() []string { return nil } -// The request message for -// [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes]. +// The request message for [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes]. type ListEntityTypesRequest struct { // Required. The agent to list all entity types from. // Format: `projects//agent`. @@ -227,8 +226,7 @@ func (m *ListEntityTypesRequest) GetPageToken() string { return "" } -// The response message for -// [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes]. +// The response message for [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes]. type ListEntityTypesResponse struct { // The list of agent entity types. There will be a maximum number of items // returned based on the page_size field in the request. @@ -257,8 +255,7 @@ func (m *ListEntityTypesResponse) GetNextPageToken() string { return "" } -// The request message for -// [EntityTypes.GetEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.GetEntityType]. +// The request message for [EntityTypes.GetEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.GetEntityType]. type GetEntityTypeRequest struct { // Required. The name of the entity type. // Format: `projects//agent/entityTypes/`. @@ -290,8 +287,7 @@ func (m *GetEntityTypeRequest) GetLanguageCode() string { return "" } -// The request message for -// [EntityTypes.CreateEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.CreateEntityType]. +// The request message for [EntityTypes.CreateEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.CreateEntityType]. type CreateEntityTypeRequest struct { // Required. The agent to create a entity type for. // Format: `projects//agent`. @@ -332,8 +328,7 @@ func (m *CreateEntityTypeRequest) GetLanguageCode() string { return "" } -// The request message for -// [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.UpdateEntityType]. +// The request message for [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.UpdateEntityType]. type UpdateEntityTypeRequest struct { // Required. The entity type to update. // Format: `projects//agent/entityTypes/`. @@ -374,8 +369,7 @@ func (m *UpdateEntityTypeRequest) GetUpdateMask() *google_protobuf3.FieldMask { return nil } -// The request message for -// [EntityTypes.DeleteEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.DeleteEntityType]. +// The request message for [EntityTypes.DeleteEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.DeleteEntityType]. type DeleteEntityTypeRequest struct { // Required. The name of the entity type to delete. // Format: `projects//agent/entityTypes/`. @@ -394,8 +388,7 @@ func (m *DeleteEntityTypeRequest) GetName() string { return "" } -// The request message for -// [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes]. +// The request message for [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes]. type BatchUpdateEntityTypesRequest struct { // Required. The name of the agent to update or create entity types in. // Format: `projects//agent`. @@ -553,8 +546,7 @@ func _BatchUpdateEntityTypesRequest_OneofSizer(msg proto.Message) (n int) { return n } -// The response message for -// [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes]. +// The response message for [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes]. type BatchUpdateEntityTypesResponse struct { // The collection of updated or created entity types. EntityTypes []*EntityType `protobuf:"bytes,1,rep,name=entity_types,json=entityTypes" json:"entity_types,omitempty"` @@ -572,8 +564,7 @@ func (m *BatchUpdateEntityTypesResponse) GetEntityTypes() []*EntityType { return nil } -// The request message for -// [EntityTypes.BatchDeleteEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntityTypes]. +// The request message for [EntityTypes.BatchDeleteEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntityTypes]. type BatchDeleteEntityTypesRequest struct { // Required. The name of the agent to delete all entities types for. Format: // `projects//agent`. @@ -602,8 +593,7 @@ func (m *BatchDeleteEntityTypesRequest) GetEntityTypeNames() []string { return nil } -// The request message for -// [EntityTypes.BatchCreateEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchCreateEntities]. +// The request message for [EntityTypes.BatchCreateEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchCreateEntities]. type BatchCreateEntitiesRequest struct { // Required. The name of the entity type to create entities in. Format: // `projects//agent/entityTypes/`. @@ -644,8 +634,7 @@ func (m *BatchCreateEntitiesRequest) GetLanguageCode() string { return "" } -// The response message for -// [EntityTypes.BatchCreateEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchCreateEntities]. +// The response message for [EntityTypes.BatchCreateEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchCreateEntities]. type BatchUpdateEntitiesRequest struct { // Required. The name of the entity type to update the entities in. Format: // `projects//agent/entityTypes/`. @@ -695,8 +684,7 @@ func (m *BatchUpdateEntitiesRequest) GetUpdateMask() *google_protobuf3.FieldMask return nil } -// The request message for -// [EntityTypes.BatchDeleteEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntities]. +// The request message for [EntityTypes.BatchDeleteEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntities]. type BatchDeleteEntitiesRequest struct { // Required. The name of the entity type to delete entries for. Format: // `projects//agent/entityTypes/`. @@ -800,8 +788,7 @@ type EntityTypesClient interface { DeleteEntityType(ctx context.Context, in *DeleteEntityTypeRequest, opts ...grpc.CallOption) (*google_protobuf2.Empty, error) // Updates/Creates multiple entity types in the specified agent. // - // Operation BatchUpdateEntityTypes(ctx context.Context, in *BatchUpdateEntityTypesRequest, opts ...grpc.CallOption) (*google_longrunning.Operation, error) // Deletes entity types in the specified agent. @@ -940,8 +927,7 @@ type EntityTypesServer interface { DeleteEntityType(context.Context, *DeleteEntityTypeRequest) (*google_protobuf2.Empty, error) // Updates/Creates multiple entity types in the specified agent. // - // Operation BatchUpdateEntityTypes(context.Context, *BatchUpdateEntityTypesRequest) (*google_longrunning.Operation, error) // Deletes entity types in the specified agent. diff --git a/vendor/google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1/intent.pb.go b/vendor/google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1/intent.pb.go index b343de048..4d9baf5c3 100644 --- a/vendor/google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1/intent.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1/intent.pb.go @@ -1564,8 +1564,7 @@ func (m *Intent_FollowupIntentInfo) GetParentFollowupIntentName() string { return "" } -// The request message for -// [Intents.ListIntents][google.cloud.dialogflow.v2beta1.Intents.ListIntents]. +// The request message for [Intents.ListIntents][google.cloud.dialogflow.v2beta1.Intents.ListIntents]. type ListIntentsRequest struct { // Required. The agent to list all intents from. // Format: `projects//agent`. @@ -1625,8 +1624,7 @@ func (m *ListIntentsRequest) GetPageToken() string { return "" } -// The response message for -// [Intents.ListIntents][google.cloud.dialogflow.v2beta1.Intents.ListIntents]. +// The response message for [Intents.ListIntents][google.cloud.dialogflow.v2beta1.Intents.ListIntents]. type ListIntentsResponse struct { // The list of agent intents. There will be a maximum number of items // returned based on the page_size field in the request. @@ -1655,8 +1653,7 @@ func (m *ListIntentsResponse) GetNextPageToken() string { return "" } -// The request message for -// [Intents.GetIntent][google.cloud.dialogflow.v2beta1.Intents.GetIntent]. +// The request message for [Intents.GetIntent][google.cloud.dialogflow.v2beta1.Intents.GetIntent]. type GetIntentRequest struct { // Required. The name of the intent. // Format: `projects//agent/intents/`. @@ -1697,8 +1694,7 @@ func (m *GetIntentRequest) GetIntentView() IntentView { return IntentView_INTENT_VIEW_UNSPECIFIED } -// The request message for -// [Intents.CreateIntent][google.cloud.dialogflow.v2beta1.Intents.CreateIntent]. +// The request message for [Intents.CreateIntent][google.cloud.dialogflow.v2beta1.Intents.CreateIntent]. type CreateIntentRequest struct { // Required. The agent to create a intent for. // Format: `projects//agent`. @@ -1748,8 +1744,7 @@ func (m *CreateIntentRequest) GetIntentView() IntentView { return IntentView_INTENT_VIEW_UNSPECIFIED } -// The request message for -// [Intents.UpdateIntent][google.cloud.dialogflow.v2beta1.Intents.UpdateIntent]. +// The request message for [Intents.UpdateIntent][google.cloud.dialogflow.v2beta1.Intents.UpdateIntent]. type UpdateIntentRequest struct { // Required. The intent to update. // Format: `projects//agent/intents/`. @@ -1799,8 +1794,7 @@ func (m *UpdateIntentRequest) GetIntentView() IntentView { return IntentView_INTENT_VIEW_UNSPECIFIED } -// The request message for -// [Intents.DeleteIntent][google.cloud.dialogflow.v2beta1.Intents.DeleteIntent]. +// The request message for [Intents.DeleteIntent][google.cloud.dialogflow.v2beta1.Intents.DeleteIntent]. type DeleteIntentRequest struct { // Required. The name of the intent to delete. // Format: `projects//agent/intents/`. @@ -1819,8 +1813,7 @@ func (m *DeleteIntentRequest) GetName() string { return "" } -// The request message for -// [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents]. +// The request message for [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents]. type BatchUpdateIntentsRequest struct { // Required. The name of the agent to update or create intents in. // Format: `projects//agent`. @@ -1981,8 +1974,7 @@ func _BatchUpdateIntentsRequest_OneofSizer(msg proto.Message) (n int) { return n } -// The response message for -// [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents]. +// The response message for [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents]. type BatchUpdateIntentsResponse struct { // The collection of updated or created intents. Intents []*Intent `protobuf:"bytes,1,rep,name=intents" json:"intents,omitempty"` @@ -2000,8 +1992,7 @@ func (m *BatchUpdateIntentsResponse) GetIntents() []*Intent { return nil } -// The request message for -// [Intents.BatchDeleteIntents][google.cloud.dialogflow.v2beta1.Intents.BatchDeleteIntents]. +// The request message for [Intents.BatchDeleteIntents][google.cloud.dialogflow.v2beta1.Intents.BatchDeleteIntents]. type BatchDeleteIntentsRequest struct { // Required. The name of the agent to delete all entities types for. Format: // `projects//agent`. @@ -2112,8 +2103,7 @@ type IntentsClient interface { DeleteIntent(ctx context.Context, in *DeleteIntentRequest, opts ...grpc.CallOption) (*google_protobuf2.Empty, error) // Updates/Creates multiple intents in the specified agent. // - // Operation + // Operation BatchUpdateIntents(ctx context.Context, in *BatchUpdateIntentsRequest, opts ...grpc.CallOption) (*google_longrunning.Operation, error) // Deletes intents in the specified agent. // @@ -2207,8 +2197,7 @@ type IntentsServer interface { DeleteIntent(context.Context, *DeleteIntentRequest) (*google_protobuf2.Empty, error) // Updates/Creates multiple intents in the specified agent. // - // Operation + // Operation BatchUpdateIntents(context.Context, *BatchUpdateIntentsRequest) (*google_longrunning.Operation, error) // Deletes intents in the specified agent. // diff --git a/vendor/google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1/session.pb.go b/vendor/google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1/session.pb.go index fa627cb9a..39d33d383 100644 --- a/vendor/google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1/session.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1/session.pb.go @@ -128,7 +128,10 @@ func (StreamingRecognitionResult_MessageType) EnumDescriptor() ([]byte, []int) { // The request to detect user's intent. type DetectIntentRequest struct { // Required. The name of the session this query is sent to. Format: - // `projects//agent/sessions/`. + // `projects//agent/sessions/`, or + // `projects//agent/runtimes//sessions/`. + // Note: Runtimes are under construction and will be available soon. + // If is not specified, we assume default 'sandbox' runtime. // It's up to the API caller to choose an appropriate session ID. It can be // a random number or some type of user identifier (preferably hashed). // The length of the session ID must not exceed 36 bytes. @@ -624,8 +627,7 @@ func (m *QueryResult) GetDiagnosticInfo() *google_protobuf4.Struct { // Multiple request messages should be sent in order: // // 1. The first message must contain `session`, `query_input` plus optionally -// `query_params` and/or `single_utterance`. The message must not contain -// `input_audio`. +// `query_params` and/or `single_utterance`. The message must not contain `input_audio`. // // 2. If `query_input` was set to a streaming input audio config, // all subsequent messages must contain only `input_audio`. @@ -633,7 +635,10 @@ func (m *QueryResult) GetDiagnosticInfo() *google_protobuf4.Struct { type StreamingDetectIntentRequest struct { // Required. The name of the session the query is sent to. // Format of the session name: - // `projects//agent/sessions/`. + // `projects//agent/sessions/`, or + // `projects//agent/runtimes//sessions/`. + // Note: Runtimes are under construction and will be available soon. + // If is not specified, we assume default 'sandbox' runtime. // It’s up to the API caller to choose an appropriate . It can be // a random number or some type of user identifier (preferably hashed). // The length of the session ID must not exceed 36 characters. diff --git a/vendor/google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1/session_entity_type.pb.go b/vendor/google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1/session_entity_type.pb.go index da14f2643..9914622c1 100644 --- a/vendor/google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1/session_entity_type.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1/session_entity_type.pb.go @@ -66,7 +66,11 @@ func (SessionEntityType_EntityOverrideMode) EnumDescriptor() ([]byte, []int) { type SessionEntityType struct { // Required. The unique identifier of this session entity type. Format: // `projects//agent/sessions//entityTypes/`. + // Display Name>`, or + // `projects//agent/runtimes/sessions//entityTypes/`. + // Note: Runtimes are under construction and will be available soon. + // If is not specified, we assume default 'sandbox' runtime. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` // Required. Indicates whether the additional data should override or // supplement the developer entity type definition. @@ -102,11 +106,13 @@ func (m *SessionEntityType) GetEntities() []*EntityType_Entity { return nil } -// The request message for -// [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes]. +// The request message for [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes]. type ListSessionEntityTypesRequest struct { // Required. The session to list all session entity types from. - // Format: `projects//agent/sessions/`. + // Format: `projects//agent/sessions/` or + // `projects//agent/runtimes//sessions/`. + // Note: Runtimes are under construction and will be available soon. + // If is not specified, we assume default 'sandbox' runtime. Parent string `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"` // Optional. The maximum number of items to return in a single page. By // default 100 and at most 1000. @@ -141,8 +147,7 @@ func (m *ListSessionEntityTypesRequest) GetPageToken() string { return "" } -// The response message for -// [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes]. +// The response message for [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes]. type ListSessionEntityTypesResponse struct { // The list of session entity types. There will be a maximum number of items // returned based on the page_size field in the request. @@ -171,12 +176,14 @@ func (m *ListSessionEntityTypesResponse) GetNextPageToken() string { return "" } -// The request message for -// [SessionEntityTypes.GetSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.GetSessionEntityType]. +// The request message for [SessionEntityTypes.GetSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.GetSessionEntityType]. type GetSessionEntityTypeRequest struct { // Required. The name of the session entity type. Format: // `projects//agent/sessions//entityTypes/`. + // Display Name>` or `projects//agent/runtimes//sessions//entityTypes/`. Note: + // Runtimes are under construction and will be available soon. If + // is not specified, we assume default 'sandbox' runtime. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` } @@ -192,11 +199,13 @@ func (m *GetSessionEntityTypeRequest) GetName() string { return "" } -// The request message for -// [SessionEntityTypes.CreateSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.CreateSessionEntityType]. +// The request message for [SessionEntityTypes.CreateSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.CreateSessionEntityType]. type CreateSessionEntityTypeRequest struct { // Required. The session to create a session entity type for. - // Format: `projects//agent/sessions/`. + // Format: `projects//agent/sessions/` or + // `projects//agent/runtimes//sessions/`. + // Note: Runtimes are under construction and will be available soon. + // If is not specified, we assume default 'sandbox' runtime. Parent string `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"` // Required. The session entity type to create. SessionEntityType *SessionEntityType `protobuf:"bytes,2,opt,name=session_entity_type,json=sessionEntityType" json:"session_entity_type,omitempty"` @@ -221,12 +230,14 @@ func (m *CreateSessionEntityTypeRequest) GetSessionEntityType() *SessionEntityTy return nil } -// The request message for -// [SessionEntityTypes.UpdateSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.UpdateSessionEntityType]. +// The request message for [SessionEntityTypes.UpdateSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.UpdateSessionEntityType]. type UpdateSessionEntityTypeRequest struct { // Required. The entity type to update. Format: // `projects//agent/sessions//entityTypes/`. + // Display Name>` or `projects//agent/runtimes//sessions//entityTypes/`. Note: + // Runtimes are under construction and will be available soon. If + // is not specified, we assume default 'sandbox' runtime. SessionEntityType *SessionEntityType `protobuf:"bytes,1,opt,name=session_entity_type,json=sessionEntityType" json:"session_entity_type,omitempty"` // Optional. The mask to control which fields get updated. UpdateMask *google_protobuf3.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask" json:"update_mask,omitempty"` @@ -251,12 +262,14 @@ func (m *UpdateSessionEntityTypeRequest) GetUpdateMask() *google_protobuf3.Field return nil } -// The request message for -// [SessionEntityTypes.DeleteSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.DeleteSessionEntityType]. +// The request message for [SessionEntityTypes.DeleteSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.DeleteSessionEntityType]. type DeleteSessionEntityTypeRequest struct { // Required. The name of the entity type to delete. Format: // `projects//agent/sessions//entityTypes/`. + // Display Name>` or `projects//agent/runtimes//sessions//entityTypes/`. Note: + // Runtimes are under construction and will be available soon. If + // is not specified, we assume default 'sandbox' runtime. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` } diff --git a/vendor/google.golang.org/genproto/googleapis/cloud/ml/v1beta1/job_service.pb.go b/vendor/google.golang.org/genproto/googleapis/cloud/ml/v1beta1/job_service.pb.go deleted file mode 100644 index df13ca5e7..000000000 --- a/vendor/google.golang.org/genproto/googleapis/cloud/ml/v1beta1/job_service.pb.go +++ /dev/null @@ -1,1823 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: google/cloud/ml/v1beta1/job_service.proto - -/* -Package ml is a generated protocol buffer package. - -It is generated from these files: - google/cloud/ml/v1beta1/job_service.proto - google/cloud/ml/v1beta1/model_service.proto - google/cloud/ml/v1beta1/operation_metadata.proto - google/cloud/ml/v1beta1/prediction_service.proto - google/cloud/ml/v1beta1/project_service.proto - -It has these top-level messages: - TrainingInput - HyperparameterSpec - ParameterSpec - HyperparameterOutput - TrainingOutput - PredictionInput - PredictionOutput - Job - CreateJobRequest - ListJobsRequest - ListJobsResponse - GetJobRequest - CancelJobRequest - Model - Version - ManualScaling - CreateModelRequest - ListModelsRequest - ListModelsResponse - GetModelRequest - DeleteModelRequest - CreateVersionRequest - ListVersionsRequest - ListVersionsResponse - GetVersionRequest - DeleteVersionRequest - SetDefaultVersionRequest - OperationMetadata - PredictRequest - GetConfigRequest - GetConfigResponse -*/ -package ml - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "google.golang.org/genproto/googleapis/api/annotations" -import _ "google.golang.org/genproto/googleapis/api/serviceconfig" -import google_protobuf1 "github.com/golang/protobuf/ptypes/empty" -import google_protobuf2 "github.com/golang/protobuf/ptypes/timestamp" - -import ( - context "golang.org/x/net/context" - grpc "google.golang.org/grpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -// A scale tier is an abstract representation of the resources Cloud ML -// will allocate to a training job. When selecting a scale tier for your -// training job, you should consider the size of your training dataset and -// the complexity of your model. As the tiers increase, virtual machines are -// added to handle your job, and the individual machines in the cluster -// generally have more memory and greater processing power than they do at -// lower tiers. The number of training units charged per hour of processing -// increases as tiers get more advanced. Refer to the -// [pricing guide](/ml/pricing) for more details. Note that in addition to -// incurring costs, your use of training resources is constrained by the -// [quota policy](/ml/quota). -type TrainingInput_ScaleTier int32 - -const ( - // A single worker instance. This tier is suitable for learning how to use - // Cloud ML, and for experimenting with new models using small datasets. - TrainingInput_BASIC TrainingInput_ScaleTier = 0 - // Many workers and a few parameter servers. - TrainingInput_STANDARD_1 TrainingInput_ScaleTier = 1 - // A large number of workers with many parameter servers. - TrainingInput_PREMIUM_1 TrainingInput_ScaleTier = 3 - // A single worker instance [with a GPU](ml/docs/how-tos/using-gpus). - TrainingInput_BASIC_GPU TrainingInput_ScaleTier = 6 - // The CUSTOM tier is not a set tier, but rather enables you to use your - // own cluster specification. When you use this tier, set values to - // configure your processing cluster according to these guidelines: - // - // * You _must_ set `TrainingInput.masterType` to specify the type - // of machine to use for your master node. This is the only required - // setting. - // - // * You _may_ set `TrainingInput.workerCount` to specify the number of - // workers to use. If you specify one or more workers, you _must_ also - // set `TrainingInput.workerType` to specify the type of machine to use - // for your worker nodes. - // - // * You _may_ set `TrainingInput.parameterServerCount` to specify the - // number of parameter servers to use. If you specify one or more - // parameter servers, you _must_ also set - // `TrainingInput.parameterServerType` to specify the type of machine to - // use for your parameter servers. - // - // Note that all of your workers must use the same machine type, which can - // be different from your parameter server type and master type. Your - // parameter servers must likewise use the same machine type, which can be - // different from your worker type and master type. - TrainingInput_CUSTOM TrainingInput_ScaleTier = 5 -) - -var TrainingInput_ScaleTier_name = map[int32]string{ - 0: "BASIC", - 1: "STANDARD_1", - 3: "PREMIUM_1", - 6: "BASIC_GPU", - 5: "CUSTOM", -} -var TrainingInput_ScaleTier_value = map[string]int32{ - "BASIC": 0, - "STANDARD_1": 1, - "PREMIUM_1": 3, - "BASIC_GPU": 6, - "CUSTOM": 5, -} - -func (x TrainingInput_ScaleTier) String() string { - return proto.EnumName(TrainingInput_ScaleTier_name, int32(x)) -} -func (TrainingInput_ScaleTier) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} } - -// The available types of optimization goals. -type HyperparameterSpec_GoalType int32 - -const ( - // Goal Type will default to maximize. - HyperparameterSpec_GOAL_TYPE_UNSPECIFIED HyperparameterSpec_GoalType = 0 - // Maximize the goal metric. - HyperparameterSpec_MAXIMIZE HyperparameterSpec_GoalType = 1 - // Minimize the goal metric. - HyperparameterSpec_MINIMIZE HyperparameterSpec_GoalType = 2 -) - -var HyperparameterSpec_GoalType_name = map[int32]string{ - 0: "GOAL_TYPE_UNSPECIFIED", - 1: "MAXIMIZE", - 2: "MINIMIZE", -} -var HyperparameterSpec_GoalType_value = map[string]int32{ - "GOAL_TYPE_UNSPECIFIED": 0, - "MAXIMIZE": 1, - "MINIMIZE": 2, -} - -func (x HyperparameterSpec_GoalType) String() string { - return proto.EnumName(HyperparameterSpec_GoalType_name, int32(x)) -} -func (HyperparameterSpec_GoalType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor0, []int{1, 0} -} - -// The type of the parameter. -type ParameterSpec_ParameterType int32 - -const ( - // You must specify a valid type. Using this unspecified type will result in - // an error. - ParameterSpec_PARAMETER_TYPE_UNSPECIFIED ParameterSpec_ParameterType = 0 - // Type for real-valued parameters. - ParameterSpec_DOUBLE ParameterSpec_ParameterType = 1 - // Type for integral parameters. - ParameterSpec_INTEGER ParameterSpec_ParameterType = 2 - // The parameter is categorical, with a value chosen from the categories - // field. - ParameterSpec_CATEGORICAL ParameterSpec_ParameterType = 3 - // The parameter is real valued, with a fixed set of feasible points. If - // `type==DISCRETE`, feasible_points must be provided, and - // {`min_value`, `max_value`} will be ignored. - ParameterSpec_DISCRETE ParameterSpec_ParameterType = 4 -) - -var ParameterSpec_ParameterType_name = map[int32]string{ - 0: "PARAMETER_TYPE_UNSPECIFIED", - 1: "DOUBLE", - 2: "INTEGER", - 3: "CATEGORICAL", - 4: "DISCRETE", -} -var ParameterSpec_ParameterType_value = map[string]int32{ - "PARAMETER_TYPE_UNSPECIFIED": 0, - "DOUBLE": 1, - "INTEGER": 2, - "CATEGORICAL": 3, - "DISCRETE": 4, -} - -func (x ParameterSpec_ParameterType) String() string { - return proto.EnumName(ParameterSpec_ParameterType_name, int32(x)) -} -func (ParameterSpec_ParameterType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor0, []int{2, 0} -} - -// The type of scaling that should be applied to this parameter. -type ParameterSpec_ScaleType int32 - -const ( - // By default, no scaling is applied. - ParameterSpec_NONE ParameterSpec_ScaleType = 0 - // Scales the feasible space to (0, 1) linearly. - ParameterSpec_UNIT_LINEAR_SCALE ParameterSpec_ScaleType = 1 - // Scales the feasible space logarithmically to (0, 1). The entire feasible - // space must be strictly positive. - ParameterSpec_UNIT_LOG_SCALE ParameterSpec_ScaleType = 2 - // Scales the feasible space "reverse" logarithmically to (0, 1). The result - // is that values close to the top of the feasible space are spread out more - // than points near the bottom. The entire feasible space must be strictly - // positive. - ParameterSpec_UNIT_REVERSE_LOG_SCALE ParameterSpec_ScaleType = 3 -) - -var ParameterSpec_ScaleType_name = map[int32]string{ - 0: "NONE", - 1: "UNIT_LINEAR_SCALE", - 2: "UNIT_LOG_SCALE", - 3: "UNIT_REVERSE_LOG_SCALE", -} -var ParameterSpec_ScaleType_value = map[string]int32{ - "NONE": 0, - "UNIT_LINEAR_SCALE": 1, - "UNIT_LOG_SCALE": 2, - "UNIT_REVERSE_LOG_SCALE": 3, -} - -func (x ParameterSpec_ScaleType) String() string { - return proto.EnumName(ParameterSpec_ScaleType_name, int32(x)) -} -func (ParameterSpec_ScaleType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 1} } - -// The format used to separate data instances in the source files. -type PredictionInput_DataFormat int32 - -const ( - // Unspecified format. - PredictionInput_DATA_FORMAT_UNSPECIFIED PredictionInput_DataFormat = 0 - // The source file is a text file with instances separated by the - // new-line character. - PredictionInput_TEXT PredictionInput_DataFormat = 1 - // The source file is a TFRecord file. - PredictionInput_TF_RECORD PredictionInput_DataFormat = 2 - // The source file is a GZIP-compressed TFRecord file. - PredictionInput_TF_RECORD_GZIP PredictionInput_DataFormat = 3 -) - -var PredictionInput_DataFormat_name = map[int32]string{ - 0: "DATA_FORMAT_UNSPECIFIED", - 1: "TEXT", - 2: "TF_RECORD", - 3: "TF_RECORD_GZIP", -} -var PredictionInput_DataFormat_value = map[string]int32{ - "DATA_FORMAT_UNSPECIFIED": 0, - "TEXT": 1, - "TF_RECORD": 2, - "TF_RECORD_GZIP": 3, -} - -func (x PredictionInput_DataFormat) String() string { - return proto.EnumName(PredictionInput_DataFormat_name, int32(x)) -} -func (PredictionInput_DataFormat) EnumDescriptor() ([]byte, []int) { - return fileDescriptor0, []int{5, 0} -} - -// Describes the job state. -type Job_State int32 - -const ( - // The job state is unspecified. - Job_STATE_UNSPECIFIED Job_State = 0 - // The job has been just created and processing has not yet begun. - Job_QUEUED Job_State = 1 - // The service is preparing to run the job. - Job_PREPARING Job_State = 2 - // The job is in progress. - Job_RUNNING Job_State = 3 - // The job completed successfully. - Job_SUCCEEDED Job_State = 4 - // The job failed. - // `error_message` should contain the details of the failure. - Job_FAILED Job_State = 5 - // The job is being cancelled. - // `error_message` should describe the reason for the cancellation. - Job_CANCELLING Job_State = 6 - // The job has been cancelled. - // `error_message` should describe the reason for the cancellation. - Job_CANCELLED Job_State = 7 -) - -var Job_State_name = map[int32]string{ - 0: "STATE_UNSPECIFIED", - 1: "QUEUED", - 2: "PREPARING", - 3: "RUNNING", - 4: "SUCCEEDED", - 5: "FAILED", - 6: "CANCELLING", - 7: "CANCELLED", -} -var Job_State_value = map[string]int32{ - "STATE_UNSPECIFIED": 0, - "QUEUED": 1, - "PREPARING": 2, - "RUNNING": 3, - "SUCCEEDED": 4, - "FAILED": 5, - "CANCELLING": 6, - "CANCELLED": 7, -} - -func (x Job_State) String() string { - return proto.EnumName(Job_State_name, int32(x)) -} -func (Job_State) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{7, 0} } - -// Represents input parameters for a training job. -type TrainingInput struct { - // Required. Specifies the machine types, the number of replicas for workers - // and parameter servers. - ScaleTier TrainingInput_ScaleTier `protobuf:"varint,1,opt,name=scale_tier,json=scaleTier,enum=google.cloud.ml.v1beta1.TrainingInput_ScaleTier" json:"scale_tier,omitempty"` - // Optional. Specifies the type of virtual machine to use for your training - // job's master worker. - // - // The following types are supported: - // - //
- //
standard
- //
- // A basic machine configuration suitable for training simple models with - // small to moderate datasets. - //
- //
large_model
- //
- // A machine with a lot of memory, specially suited for parameter servers - // when your model is large (having many hidden layers or layers with very - // large numbers of nodes). - //
- //
complex_model_s
- //
- // A machine suitable for the master and workers of the cluster when your - // model requires more computation than the standard machine can handle - // satisfactorily. - //
- //
complex_model_m
- //
- // A machine with roughly twice the number of cores and roughly double the - // memory of complex_model_s. - //
- //
complex_model_l
- //
- // A machine with roughly twice the number of cores and roughly double the - // memory of complex_model_m. - //
- //
standard_gpu
- //
- // A machine equivalent to standard that - // also includes a - // - // GPU that you can use in your trainer. - //
- //
complex_model_m_gpu
- //
- // A machine equivalent to - // coplex_model_m that also includes - // four GPUs. - //
- //
- // - // You must set this value when `scaleTier` is set to `CUSTOM`. - MasterType string `protobuf:"bytes,2,opt,name=master_type,json=masterType" json:"master_type,omitempty"` - // Optional. Specifies the type of virtual machine to use for your training - // job's worker nodes. - // - // The supported values are the same as those described in the entry for - // `masterType`. - // - // This value must be present when `scaleTier` is set to `CUSTOM` and - // `workerCount` is greater than zero. - WorkerType string `protobuf:"bytes,3,opt,name=worker_type,json=workerType" json:"worker_type,omitempty"` - // Optional. Specifies the type of virtual machine to use for your training - // job's parameter server. - // - // The supported values are the same as those described in the entry for - // `master_type`. - // - // This value must be present when `scaleTier` is set to `CUSTOM` and - // `parameter_server_count` is greater than zero. - ParameterServerType string `protobuf:"bytes,4,opt,name=parameter_server_type,json=parameterServerType" json:"parameter_server_type,omitempty"` - // Optional. The number of worker replicas to use for the training job. Each - // replica in the cluster will be of the type specified in `worker_type`. - // - // This value can only be used when `scale_tier` is set to `CUSTOM`. If you - // set this value, you must also set `worker_type`. - WorkerCount int64 `protobuf:"varint,5,opt,name=worker_count,json=workerCount" json:"worker_count,omitempty"` - // Optional. The number of parameter server replicas to use for the training - // job. Each replica in the cluster will be of the type specified in - // `parameter_server_type`. - // - // This value can only be used when `scale_tier` is set to `CUSTOM`.If you - // set this value, you must also set `parameter_server_type`. - ParameterServerCount int64 `protobuf:"varint,6,opt,name=parameter_server_count,json=parameterServerCount" json:"parameter_server_count,omitempty"` - // Required. The Google Cloud Storage location of the packages with - // the training program and any additional dependencies. - PackageUris []string `protobuf:"bytes,7,rep,name=package_uris,json=packageUris" json:"package_uris,omitempty"` - // Required. The Python module name to run after installing the packages. - PythonModule string `protobuf:"bytes,8,opt,name=python_module,json=pythonModule" json:"python_module,omitempty"` - // Optional. Command line arguments to pass to the program. - Args []string `protobuf:"bytes,10,rep,name=args" json:"args,omitempty"` - // Optional. The set of Hyperparameters to tune. - Hyperparameters *HyperparameterSpec `protobuf:"bytes,12,opt,name=hyperparameters" json:"hyperparameters,omitempty"` - // Required. The Google Compute Engine region to run the training job in. - Region string `protobuf:"bytes,14,opt,name=region" json:"region,omitempty"` - // Optional. A Google Cloud Storage path in which to store training outputs - // and other data needed for training. This path is passed to your TensorFlow - // program as the 'job_dir' command-line argument. The benefit of specifying - // this field is that Cloud ML validates the path for use in training. - JobDir string `protobuf:"bytes,16,opt,name=job_dir,json=jobDir" json:"job_dir,omitempty"` - // Optional. The Google Cloud ML runtime version to use for training. If not - // set, Google Cloud ML will choose the latest stable version. - RuntimeVersion string `protobuf:"bytes,15,opt,name=runtime_version,json=runtimeVersion" json:"runtime_version,omitempty"` -} - -func (m *TrainingInput) Reset() { *m = TrainingInput{} } -func (m *TrainingInput) String() string { return proto.CompactTextString(m) } -func (*TrainingInput) ProtoMessage() {} -func (*TrainingInput) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } - -func (m *TrainingInput) GetScaleTier() TrainingInput_ScaleTier { - if m != nil { - return m.ScaleTier - } - return TrainingInput_BASIC -} - -func (m *TrainingInput) GetMasterType() string { - if m != nil { - return m.MasterType - } - return "" -} - -func (m *TrainingInput) GetWorkerType() string { - if m != nil { - return m.WorkerType - } - return "" -} - -func (m *TrainingInput) GetParameterServerType() string { - if m != nil { - return m.ParameterServerType - } - return "" -} - -func (m *TrainingInput) GetWorkerCount() int64 { - if m != nil { - return m.WorkerCount - } - return 0 -} - -func (m *TrainingInput) GetParameterServerCount() int64 { - if m != nil { - return m.ParameterServerCount - } - return 0 -} - -func (m *TrainingInput) GetPackageUris() []string { - if m != nil { - return m.PackageUris - } - return nil -} - -func (m *TrainingInput) GetPythonModule() string { - if m != nil { - return m.PythonModule - } - return "" -} - -func (m *TrainingInput) GetArgs() []string { - if m != nil { - return m.Args - } - return nil -} - -func (m *TrainingInput) GetHyperparameters() *HyperparameterSpec { - if m != nil { - return m.Hyperparameters - } - return nil -} - -func (m *TrainingInput) GetRegion() string { - if m != nil { - return m.Region - } - return "" -} - -func (m *TrainingInput) GetJobDir() string { - if m != nil { - return m.JobDir - } - return "" -} - -func (m *TrainingInput) GetRuntimeVersion() string { - if m != nil { - return m.RuntimeVersion - } - return "" -} - -// Represents a set of hyperparameters to optimize. -type HyperparameterSpec struct { - // Required. The type of goal to use for tuning. Available types are - // `MAXIMIZE` and `MINIMIZE`. - // - // Defaults to `MAXIMIZE`. - Goal HyperparameterSpec_GoalType `protobuf:"varint,1,opt,name=goal,enum=google.cloud.ml.v1beta1.HyperparameterSpec_GoalType" json:"goal,omitempty"` - // Required. The set of parameters to tune. - Params []*ParameterSpec `protobuf:"bytes,2,rep,name=params" json:"params,omitempty"` - // Optional. How many training trials should be attempted to optimize - // the specified hyperparameters. - // - // Defaults to one. - MaxTrials int32 `protobuf:"varint,3,opt,name=max_trials,json=maxTrials" json:"max_trials,omitempty"` - // Optional. The number of training trials to run concurrently. - // You can reduce the time it takes to perform hyperparameter tuning by adding - // trials in parallel. However, each trail only benefits from the information - // gained in completed trials. That means that a trial does not get access to - // the results of trials running at the same time, which could reduce the - // quality of the overall optimization. - // - // Each trial will use the same scale tier and machine types. - // - // Defaults to one. - MaxParallelTrials int32 `protobuf:"varint,4,opt,name=max_parallel_trials,json=maxParallelTrials" json:"max_parallel_trials,omitempty"` - // Optional. The Tensorflow summary tag name to use for optimizing trials. For - // current versions of Tensorflow, this tag name should exactly match what is - // shown in Tensorboard, including all scopes. For versions of Tensorflow - // prior to 0.12, this should be only the tag passed to tf.Summary. - // By default, "training/hptuning/metric" will be used. - HyperparameterMetricTag string `protobuf:"bytes,5,opt,name=hyperparameter_metric_tag,json=hyperparameterMetricTag" json:"hyperparameter_metric_tag,omitempty"` -} - -func (m *HyperparameterSpec) Reset() { *m = HyperparameterSpec{} } -func (m *HyperparameterSpec) String() string { return proto.CompactTextString(m) } -func (*HyperparameterSpec) ProtoMessage() {} -func (*HyperparameterSpec) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } - -func (m *HyperparameterSpec) GetGoal() HyperparameterSpec_GoalType { - if m != nil { - return m.Goal - } - return HyperparameterSpec_GOAL_TYPE_UNSPECIFIED -} - -func (m *HyperparameterSpec) GetParams() []*ParameterSpec { - if m != nil { - return m.Params - } - return nil -} - -func (m *HyperparameterSpec) GetMaxTrials() int32 { - if m != nil { - return m.MaxTrials - } - return 0 -} - -func (m *HyperparameterSpec) GetMaxParallelTrials() int32 { - if m != nil { - return m.MaxParallelTrials - } - return 0 -} - -func (m *HyperparameterSpec) GetHyperparameterMetricTag() string { - if m != nil { - return m.HyperparameterMetricTag - } - return "" -} - -// Represents a single hyperparameter to optimize. -type ParameterSpec struct { - // Required. The parameter name must be unique amongst all ParameterConfigs in - // a HyperparameterSpec message. E.g., "learning_rate". - ParameterName string `protobuf:"bytes,1,opt,name=parameter_name,json=parameterName" json:"parameter_name,omitempty"` - // Required. The type of the parameter. - Type ParameterSpec_ParameterType `protobuf:"varint,4,opt,name=type,enum=google.cloud.ml.v1beta1.ParameterSpec_ParameterType" json:"type,omitempty"` - // Required if type is `DOUBLE` or `INTEGER`. This field - // should be unset if type is `CATEGORICAL`. This value should be integers if - // type is INTEGER. - MinValue float64 `protobuf:"fixed64,2,opt,name=min_value,json=minValue" json:"min_value,omitempty"` - // Required if typeis `DOUBLE` or `INTEGER`. This field - // should be unset if type is `CATEGORICAL`. This value should be integers if - // type is `INTEGER`. - MaxValue float64 `protobuf:"fixed64,3,opt,name=max_value,json=maxValue" json:"max_value,omitempty"` - // Required if type is `CATEGORICAL`. The list of possible categories. - CategoricalValues []string `protobuf:"bytes,5,rep,name=categorical_values,json=categoricalValues" json:"categorical_values,omitempty"` - // Required if type is `DISCRETE`. - // A list of feasible points. - // The list should be in strictly increasing order. For instance, this - // parameter might have possible settings of 1.5, 2.5, and 4.0. This list - // should not contain more than 1,000 values. - DiscreteValues []float64 `protobuf:"fixed64,6,rep,packed,name=discrete_values,json=discreteValues" json:"discrete_values,omitempty"` - // Optional. How the parameter should be scaled to the hypercube. - // Leave unset for categorical parameters. - // Some kind of scaling is strongly recommended for real or integral - // parameters (e.g., `UNIT_LINEAR_SCALE`). - ScaleType ParameterSpec_ScaleType `protobuf:"varint,7,opt,name=scale_type,json=scaleType,enum=google.cloud.ml.v1beta1.ParameterSpec_ScaleType" json:"scale_type,omitempty"` -} - -func (m *ParameterSpec) Reset() { *m = ParameterSpec{} } -func (m *ParameterSpec) String() string { return proto.CompactTextString(m) } -func (*ParameterSpec) ProtoMessage() {} -func (*ParameterSpec) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } - -func (m *ParameterSpec) GetParameterName() string { - if m != nil { - return m.ParameterName - } - return "" -} - -func (m *ParameterSpec) GetType() ParameterSpec_ParameterType { - if m != nil { - return m.Type - } - return ParameterSpec_PARAMETER_TYPE_UNSPECIFIED -} - -func (m *ParameterSpec) GetMinValue() float64 { - if m != nil { - return m.MinValue - } - return 0 -} - -func (m *ParameterSpec) GetMaxValue() float64 { - if m != nil { - return m.MaxValue - } - return 0 -} - -func (m *ParameterSpec) GetCategoricalValues() []string { - if m != nil { - return m.CategoricalValues - } - return nil -} - -func (m *ParameterSpec) GetDiscreteValues() []float64 { - if m != nil { - return m.DiscreteValues - } - return nil -} - -func (m *ParameterSpec) GetScaleType() ParameterSpec_ScaleType { - if m != nil { - return m.ScaleType - } - return ParameterSpec_NONE -} - -// Represents the result of a single hyperparameter tuning trial from a -// training job. The TrainingOutput object that is returned on successful -// completion of a training job with hyperparameter tuning includes a list -// of HyperparameterOutput objects, one for each successful trial. -type HyperparameterOutput struct { - // The trial id for these results. - TrialId string `protobuf:"bytes,1,opt,name=trial_id,json=trialId" json:"trial_id,omitempty"` - // The hyperparameters given to this trial. - Hyperparameters map[string]string `protobuf:"bytes,2,rep,name=hyperparameters" json:"hyperparameters,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - // The final objective metric seen for this trial. - FinalMetric *HyperparameterOutput_HyperparameterMetric `protobuf:"bytes,3,opt,name=final_metric,json=finalMetric" json:"final_metric,omitempty"` - // All recorded object metrics for this trial. - AllMetrics []*HyperparameterOutput_HyperparameterMetric `protobuf:"bytes,4,rep,name=all_metrics,json=allMetrics" json:"all_metrics,omitempty"` -} - -func (m *HyperparameterOutput) Reset() { *m = HyperparameterOutput{} } -func (m *HyperparameterOutput) String() string { return proto.CompactTextString(m) } -func (*HyperparameterOutput) ProtoMessage() {} -func (*HyperparameterOutput) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } - -func (m *HyperparameterOutput) GetTrialId() string { - if m != nil { - return m.TrialId - } - return "" -} - -func (m *HyperparameterOutput) GetHyperparameters() map[string]string { - if m != nil { - return m.Hyperparameters - } - return nil -} - -func (m *HyperparameterOutput) GetFinalMetric() *HyperparameterOutput_HyperparameterMetric { - if m != nil { - return m.FinalMetric - } - return nil -} - -func (m *HyperparameterOutput) GetAllMetrics() []*HyperparameterOutput_HyperparameterMetric { - if m != nil { - return m.AllMetrics - } - return nil -} - -// An observed value of a metric. -type HyperparameterOutput_HyperparameterMetric struct { - // The global training step for this metric. - TrainingStep int64 `protobuf:"varint,1,opt,name=training_step,json=trainingStep" json:"training_step,omitempty"` - // The objective value at this training step. - ObjectiveValue float64 `protobuf:"fixed64,2,opt,name=objective_value,json=objectiveValue" json:"objective_value,omitempty"` -} - -func (m *HyperparameterOutput_HyperparameterMetric) Reset() { - *m = HyperparameterOutput_HyperparameterMetric{} -} -func (m *HyperparameterOutput_HyperparameterMetric) String() string { return proto.CompactTextString(m) } -func (*HyperparameterOutput_HyperparameterMetric) ProtoMessage() {} -func (*HyperparameterOutput_HyperparameterMetric) Descriptor() ([]byte, []int) { - return fileDescriptor0, []int{3, 0} -} - -func (m *HyperparameterOutput_HyperparameterMetric) GetTrainingStep() int64 { - if m != nil { - return m.TrainingStep - } - return 0 -} - -func (m *HyperparameterOutput_HyperparameterMetric) GetObjectiveValue() float64 { - if m != nil { - return m.ObjectiveValue - } - return 0 -} - -// Represents results of a training job. Output only. -type TrainingOutput struct { - // The number of hyperparameter tuning trials that completed successfully. - // Only set for hyperparameter tuning jobs. - CompletedTrialCount int64 `protobuf:"varint,1,opt,name=completed_trial_count,json=completedTrialCount" json:"completed_trial_count,omitempty"` - // Results for individual Hyperparameter trials. - // Only set for hyperparameter tuning jobs. - Trials []*HyperparameterOutput `protobuf:"bytes,2,rep,name=trials" json:"trials,omitempty"` - // The amount of ML units consumed by the job. - ConsumedMlUnits float64 `protobuf:"fixed64,3,opt,name=consumed_ml_units,json=consumedMlUnits" json:"consumed_ml_units,omitempty"` - // Whether this job is a hyperparameter tuning job. - IsHyperparameterTuningJob bool `protobuf:"varint,4,opt,name=is_hyperparameter_tuning_job,json=isHyperparameterTuningJob" json:"is_hyperparameter_tuning_job,omitempty"` -} - -func (m *TrainingOutput) Reset() { *m = TrainingOutput{} } -func (m *TrainingOutput) String() string { return proto.CompactTextString(m) } -func (*TrainingOutput) ProtoMessage() {} -func (*TrainingOutput) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } - -func (m *TrainingOutput) GetCompletedTrialCount() int64 { - if m != nil { - return m.CompletedTrialCount - } - return 0 -} - -func (m *TrainingOutput) GetTrials() []*HyperparameterOutput { - if m != nil { - return m.Trials - } - return nil -} - -func (m *TrainingOutput) GetConsumedMlUnits() float64 { - if m != nil { - return m.ConsumedMlUnits - } - return 0 -} - -func (m *TrainingOutput) GetIsHyperparameterTuningJob() bool { - if m != nil { - return m.IsHyperparameterTuningJob - } - return false -} - -// Represents input parameters for a prediction job. -type PredictionInput struct { - // Required. The model or the version to use for prediction. - // - // Types that are valid to be assigned to ModelVersion: - // *PredictionInput_ModelName - // *PredictionInput_VersionName - // *PredictionInput_Uri - ModelVersion isPredictionInput_ModelVersion `protobuf_oneof:"model_version"` - // Required. The format of the input data files. - DataFormat PredictionInput_DataFormat `protobuf:"varint,3,opt,name=data_format,json=dataFormat,enum=google.cloud.ml.v1beta1.PredictionInput_DataFormat" json:"data_format,omitempty"` - // Required. The Google Cloud Storage location of the input data files. - // May contain wildcards. - InputPaths []string `protobuf:"bytes,4,rep,name=input_paths,json=inputPaths" json:"input_paths,omitempty"` - // Required. The output Google Cloud Storage location. - OutputPath string `protobuf:"bytes,5,opt,name=output_path,json=outputPath" json:"output_path,omitempty"` - // Optional. The maximum number of workers to be used for parallel processing. - // Defaults to 10 if not specified. - MaxWorkerCount int64 `protobuf:"varint,6,opt,name=max_worker_count,json=maxWorkerCount" json:"max_worker_count,omitempty"` - // Required. The Google Compute Engine region to run the prediction job in. - Region string `protobuf:"bytes,7,opt,name=region" json:"region,omitempty"` - // Optional. The Google Cloud ML runtime version to use for this batch - // prediction. If not set, Google Cloud ML will pick the runtime version used - // during the CreateVersion request for this model version, or choose the - // latest stable version when model version information is not available - // such as when the model is specified by uri. - RuntimeVersion string `protobuf:"bytes,8,opt,name=runtime_version,json=runtimeVersion" json:"runtime_version,omitempty"` -} - -func (m *PredictionInput) Reset() { *m = PredictionInput{} } -func (m *PredictionInput) String() string { return proto.CompactTextString(m) } -func (*PredictionInput) ProtoMessage() {} -func (*PredictionInput) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } - -type isPredictionInput_ModelVersion interface { - isPredictionInput_ModelVersion() -} - -type PredictionInput_ModelName struct { - ModelName string `protobuf:"bytes,1,opt,name=model_name,json=modelName,oneof"` -} -type PredictionInput_VersionName struct { - VersionName string `protobuf:"bytes,2,opt,name=version_name,json=versionName,oneof"` -} -type PredictionInput_Uri struct { - Uri string `protobuf:"bytes,9,opt,name=uri,oneof"` -} - -func (*PredictionInput_ModelName) isPredictionInput_ModelVersion() {} -func (*PredictionInput_VersionName) isPredictionInput_ModelVersion() {} -func (*PredictionInput_Uri) isPredictionInput_ModelVersion() {} - -func (m *PredictionInput) GetModelVersion() isPredictionInput_ModelVersion { - if m != nil { - return m.ModelVersion - } - return nil -} - -func (m *PredictionInput) GetModelName() string { - if x, ok := m.GetModelVersion().(*PredictionInput_ModelName); ok { - return x.ModelName - } - return "" -} - -func (m *PredictionInput) GetVersionName() string { - if x, ok := m.GetModelVersion().(*PredictionInput_VersionName); ok { - return x.VersionName - } - return "" -} - -func (m *PredictionInput) GetUri() string { - if x, ok := m.GetModelVersion().(*PredictionInput_Uri); ok { - return x.Uri - } - return "" -} - -func (m *PredictionInput) GetDataFormat() PredictionInput_DataFormat { - if m != nil { - return m.DataFormat - } - return PredictionInput_DATA_FORMAT_UNSPECIFIED -} - -func (m *PredictionInput) GetInputPaths() []string { - if m != nil { - return m.InputPaths - } - return nil -} - -func (m *PredictionInput) GetOutputPath() string { - if m != nil { - return m.OutputPath - } - return "" -} - -func (m *PredictionInput) GetMaxWorkerCount() int64 { - if m != nil { - return m.MaxWorkerCount - } - return 0 -} - -func (m *PredictionInput) GetRegion() string { - if m != nil { - return m.Region - } - return "" -} - -func (m *PredictionInput) GetRuntimeVersion() string { - if m != nil { - return m.RuntimeVersion - } - return "" -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*PredictionInput) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _PredictionInput_OneofMarshaler, _PredictionInput_OneofUnmarshaler, _PredictionInput_OneofSizer, []interface{}{ - (*PredictionInput_ModelName)(nil), - (*PredictionInput_VersionName)(nil), - (*PredictionInput_Uri)(nil), - } -} - -func _PredictionInput_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*PredictionInput) - // model_version - switch x := m.ModelVersion.(type) { - case *PredictionInput_ModelName: - b.EncodeVarint(1<<3 | proto.WireBytes) - b.EncodeStringBytes(x.ModelName) - case *PredictionInput_VersionName: - b.EncodeVarint(2<<3 | proto.WireBytes) - b.EncodeStringBytes(x.VersionName) - case *PredictionInput_Uri: - b.EncodeVarint(9<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Uri) - case nil: - default: - return fmt.Errorf("PredictionInput.ModelVersion has unexpected type %T", x) - } - return nil -} - -func _PredictionInput_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*PredictionInput) - switch tag { - case 1: // model_version.model_name - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.ModelVersion = &PredictionInput_ModelName{x} - return true, err - case 2: // model_version.version_name - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.ModelVersion = &PredictionInput_VersionName{x} - return true, err - case 9: // model_version.uri - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.ModelVersion = &PredictionInput_Uri{x} - return true, err - default: - return false, nil - } -} - -func _PredictionInput_OneofSizer(msg proto.Message) (n int) { - m := msg.(*PredictionInput) - // model_version - switch x := m.ModelVersion.(type) { - case *PredictionInput_ModelName: - n += proto.SizeVarint(1<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.ModelName))) - n += len(x.ModelName) - case *PredictionInput_VersionName: - n += proto.SizeVarint(2<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.VersionName))) - n += len(x.VersionName) - case *PredictionInput_Uri: - n += proto.SizeVarint(9<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.Uri))) - n += len(x.Uri) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -// Represents results of a prediction job. -type PredictionOutput struct { - // The output Google Cloud Storage location provided at the job creation time. - OutputPath string `protobuf:"bytes,1,opt,name=output_path,json=outputPath" json:"output_path,omitempty"` - // The number of generated predictions. - PredictionCount int64 `protobuf:"varint,2,opt,name=prediction_count,json=predictionCount" json:"prediction_count,omitempty"` - // The number of data instances which resulted in errors. - ErrorCount int64 `protobuf:"varint,3,opt,name=error_count,json=errorCount" json:"error_count,omitempty"` - // Node hours used by the batch prediction job. - NodeHours float64 `protobuf:"fixed64,4,opt,name=node_hours,json=nodeHours" json:"node_hours,omitempty"` -} - -func (m *PredictionOutput) Reset() { *m = PredictionOutput{} } -func (m *PredictionOutput) String() string { return proto.CompactTextString(m) } -func (*PredictionOutput) ProtoMessage() {} -func (*PredictionOutput) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } - -func (m *PredictionOutput) GetOutputPath() string { - if m != nil { - return m.OutputPath - } - return "" -} - -func (m *PredictionOutput) GetPredictionCount() int64 { - if m != nil { - return m.PredictionCount - } - return 0 -} - -func (m *PredictionOutput) GetErrorCount() int64 { - if m != nil { - return m.ErrorCount - } - return 0 -} - -func (m *PredictionOutput) GetNodeHours() float64 { - if m != nil { - return m.NodeHours - } - return 0 -} - -// Represents a training or prediction job. -type Job struct { - // Required. The user-specified id of the job. - JobId string `protobuf:"bytes,1,opt,name=job_id,json=jobId" json:"job_id,omitempty"` - // Required. Parameters to create a job. - // - // Types that are valid to be assigned to Input: - // *Job_TrainingInput - // *Job_PredictionInput - Input isJob_Input `protobuf_oneof:"input"` - // Output only. When the job was created. - CreateTime *google_protobuf2.Timestamp `protobuf:"bytes,4,opt,name=create_time,json=createTime" json:"create_time,omitempty"` - // Output only. When the job processing was started. - StartTime *google_protobuf2.Timestamp `protobuf:"bytes,5,opt,name=start_time,json=startTime" json:"start_time,omitempty"` - // Output only. When the job processing was completed. - EndTime *google_protobuf2.Timestamp `protobuf:"bytes,6,opt,name=end_time,json=endTime" json:"end_time,omitempty"` - // Output only. The detailed state of a job. - State Job_State `protobuf:"varint,7,opt,name=state,enum=google.cloud.ml.v1beta1.Job_State" json:"state,omitempty"` - // Output only. The details of a failure or a cancellation. - ErrorMessage string `protobuf:"bytes,8,opt,name=error_message,json=errorMessage" json:"error_message,omitempty"` - // Output only. The current result of the job. - // - // Types that are valid to be assigned to Output: - // *Job_TrainingOutput - // *Job_PredictionOutput - Output isJob_Output `protobuf_oneof:"output"` -} - -func (m *Job) Reset() { *m = Job{} } -func (m *Job) String() string { return proto.CompactTextString(m) } -func (*Job) ProtoMessage() {} -func (*Job) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } - -type isJob_Input interface { - isJob_Input() -} -type isJob_Output interface { - isJob_Output() -} - -type Job_TrainingInput struct { - TrainingInput *TrainingInput `protobuf:"bytes,2,opt,name=training_input,json=trainingInput,oneof"` -} -type Job_PredictionInput struct { - PredictionInput *PredictionInput `protobuf:"bytes,3,opt,name=prediction_input,json=predictionInput,oneof"` -} -type Job_TrainingOutput struct { - TrainingOutput *TrainingOutput `protobuf:"bytes,9,opt,name=training_output,json=trainingOutput,oneof"` -} -type Job_PredictionOutput struct { - PredictionOutput *PredictionOutput `protobuf:"bytes,10,opt,name=prediction_output,json=predictionOutput,oneof"` -} - -func (*Job_TrainingInput) isJob_Input() {} -func (*Job_PredictionInput) isJob_Input() {} -func (*Job_TrainingOutput) isJob_Output() {} -func (*Job_PredictionOutput) isJob_Output() {} - -func (m *Job) GetInput() isJob_Input { - if m != nil { - return m.Input - } - return nil -} -func (m *Job) GetOutput() isJob_Output { - if m != nil { - return m.Output - } - return nil -} - -func (m *Job) GetJobId() string { - if m != nil { - return m.JobId - } - return "" -} - -func (m *Job) GetTrainingInput() *TrainingInput { - if x, ok := m.GetInput().(*Job_TrainingInput); ok { - return x.TrainingInput - } - return nil -} - -func (m *Job) GetPredictionInput() *PredictionInput { - if x, ok := m.GetInput().(*Job_PredictionInput); ok { - return x.PredictionInput - } - return nil -} - -func (m *Job) GetCreateTime() *google_protobuf2.Timestamp { - if m != nil { - return m.CreateTime - } - return nil -} - -func (m *Job) GetStartTime() *google_protobuf2.Timestamp { - if m != nil { - return m.StartTime - } - return nil -} - -func (m *Job) GetEndTime() *google_protobuf2.Timestamp { - if m != nil { - return m.EndTime - } - return nil -} - -func (m *Job) GetState() Job_State { - if m != nil { - return m.State - } - return Job_STATE_UNSPECIFIED -} - -func (m *Job) GetErrorMessage() string { - if m != nil { - return m.ErrorMessage - } - return "" -} - -func (m *Job) GetTrainingOutput() *TrainingOutput { - if x, ok := m.GetOutput().(*Job_TrainingOutput); ok { - return x.TrainingOutput - } - return nil -} - -func (m *Job) GetPredictionOutput() *PredictionOutput { - if x, ok := m.GetOutput().(*Job_PredictionOutput); ok { - return x.PredictionOutput - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Job) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Job_OneofMarshaler, _Job_OneofUnmarshaler, _Job_OneofSizer, []interface{}{ - (*Job_TrainingInput)(nil), - (*Job_PredictionInput)(nil), - (*Job_TrainingOutput)(nil), - (*Job_PredictionOutput)(nil), - } -} - -func _Job_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Job) - // input - switch x := m.Input.(type) { - case *Job_TrainingInput: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.TrainingInput); err != nil { - return err - } - case *Job_PredictionInput: - b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.PredictionInput); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("Job.Input has unexpected type %T", x) - } - // output - switch x := m.Output.(type) { - case *Job_TrainingOutput: - b.EncodeVarint(9<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.TrainingOutput); err != nil { - return err - } - case *Job_PredictionOutput: - b.EncodeVarint(10<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.PredictionOutput); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("Job.Output has unexpected type %T", x) - } - return nil -} - -func _Job_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Job) - switch tag { - case 2: // input.training_input - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(TrainingInput) - err := b.DecodeMessage(msg) - m.Input = &Job_TrainingInput{msg} - return true, err - case 3: // input.prediction_input - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(PredictionInput) - err := b.DecodeMessage(msg) - m.Input = &Job_PredictionInput{msg} - return true, err - case 9: // output.training_output - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(TrainingOutput) - err := b.DecodeMessage(msg) - m.Output = &Job_TrainingOutput{msg} - return true, err - case 10: // output.prediction_output - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(PredictionOutput) - err := b.DecodeMessage(msg) - m.Output = &Job_PredictionOutput{msg} - return true, err - default: - return false, nil - } -} - -func _Job_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Job) - // input - switch x := m.Input.(type) { - case *Job_TrainingInput: - s := proto.Size(x.TrainingInput) - n += proto.SizeVarint(2<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case *Job_PredictionInput: - s := proto.Size(x.PredictionInput) - n += proto.SizeVarint(3<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - // output - switch x := m.Output.(type) { - case *Job_TrainingOutput: - s := proto.Size(x.TrainingOutput) - n += proto.SizeVarint(9<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case *Job_PredictionOutput: - s := proto.Size(x.PredictionOutput) - n += proto.SizeVarint(10<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -// Request message for the CreateJob method. -type CreateJobRequest struct { - // Required. The project name. - // - // Authorization: requires `Editor` role on the specified project. - Parent string `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"` - // Required. The job to create. - Job *Job `protobuf:"bytes,2,opt,name=job" json:"job,omitempty"` -} - -func (m *CreateJobRequest) Reset() { *m = CreateJobRequest{} } -func (m *CreateJobRequest) String() string { return proto.CompactTextString(m) } -func (*CreateJobRequest) ProtoMessage() {} -func (*CreateJobRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } - -func (m *CreateJobRequest) GetParent() string { - if m != nil { - return m.Parent - } - return "" -} - -func (m *CreateJobRequest) GetJob() *Job { - if m != nil { - return m.Job - } - return nil -} - -// Request message for the ListJobs method. -type ListJobsRequest struct { - // Required. The name of the project for which to list jobs. - // - // Authorization: requires `Viewer` role on the specified project. - Parent string `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"` - // Optional. Specifies the subset of jobs to retrieve. - Filter string `protobuf:"bytes,2,opt,name=filter" json:"filter,omitempty"` - // Optional. A page token to request the next page of results. - // - // You get the token from the `next_page_token` field of the response from - // the previous call. - PageToken string `protobuf:"bytes,4,opt,name=page_token,json=pageToken" json:"page_token,omitempty"` - // Optional. The number of jobs to retrieve per "page" of results. If there - // are more remaining results than this number, the response message will - // contain a valid value in the `next_page_token` field. - // - // The default value is 20, and the maximum page size is 100. - PageSize int32 `protobuf:"varint,5,opt,name=page_size,json=pageSize" json:"page_size,omitempty"` -} - -func (m *ListJobsRequest) Reset() { *m = ListJobsRequest{} } -func (m *ListJobsRequest) String() string { return proto.CompactTextString(m) } -func (*ListJobsRequest) ProtoMessage() {} -func (*ListJobsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } - -func (m *ListJobsRequest) GetParent() string { - if m != nil { - return m.Parent - } - return "" -} - -func (m *ListJobsRequest) GetFilter() string { - if m != nil { - return m.Filter - } - return "" -} - -func (m *ListJobsRequest) GetPageToken() string { - if m != nil { - return m.PageToken - } - return "" -} - -func (m *ListJobsRequest) GetPageSize() int32 { - if m != nil { - return m.PageSize - } - return 0 -} - -// Response message for the ListJobs method. -type ListJobsResponse struct { - // The list of jobs. - Jobs []*Job `protobuf:"bytes,1,rep,name=jobs" json:"jobs,omitempty"` - // Optional. Pass this token as the `page_token` field of the request for a - // subsequent call. - NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken" json:"next_page_token,omitempty"` -} - -func (m *ListJobsResponse) Reset() { *m = ListJobsResponse{} } -func (m *ListJobsResponse) String() string { return proto.CompactTextString(m) } -func (*ListJobsResponse) ProtoMessage() {} -func (*ListJobsResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } - -func (m *ListJobsResponse) GetJobs() []*Job { - if m != nil { - return m.Jobs - } - return nil -} - -func (m *ListJobsResponse) GetNextPageToken() string { - if m != nil { - return m.NextPageToken - } - return "" -} - -// Request message for the GetJob method. -type GetJobRequest struct { - // Required. The name of the job to get the description of. - // - // Authorization: requires `Viewer` role on the parent project. - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` -} - -func (m *GetJobRequest) Reset() { *m = GetJobRequest{} } -func (m *GetJobRequest) String() string { return proto.CompactTextString(m) } -func (*GetJobRequest) ProtoMessage() {} -func (*GetJobRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } - -func (m *GetJobRequest) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -// Request message for the CancelJob method. -type CancelJobRequest struct { - // Required. The name of the job to cancel. - // - // Authorization: requires `Editor` role on the parent project. - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` -} - -func (m *CancelJobRequest) Reset() { *m = CancelJobRequest{} } -func (m *CancelJobRequest) String() string { return proto.CompactTextString(m) } -func (*CancelJobRequest) ProtoMessage() {} -func (*CancelJobRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } - -func (m *CancelJobRequest) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func init() { - proto.RegisterType((*TrainingInput)(nil), "google.cloud.ml.v1beta1.TrainingInput") - proto.RegisterType((*HyperparameterSpec)(nil), "google.cloud.ml.v1beta1.HyperparameterSpec") - proto.RegisterType((*ParameterSpec)(nil), "google.cloud.ml.v1beta1.ParameterSpec") - proto.RegisterType((*HyperparameterOutput)(nil), "google.cloud.ml.v1beta1.HyperparameterOutput") - proto.RegisterType((*HyperparameterOutput_HyperparameterMetric)(nil), "google.cloud.ml.v1beta1.HyperparameterOutput.HyperparameterMetric") - proto.RegisterType((*TrainingOutput)(nil), "google.cloud.ml.v1beta1.TrainingOutput") - proto.RegisterType((*PredictionInput)(nil), "google.cloud.ml.v1beta1.PredictionInput") - proto.RegisterType((*PredictionOutput)(nil), "google.cloud.ml.v1beta1.PredictionOutput") - proto.RegisterType((*Job)(nil), "google.cloud.ml.v1beta1.Job") - proto.RegisterType((*CreateJobRequest)(nil), "google.cloud.ml.v1beta1.CreateJobRequest") - proto.RegisterType((*ListJobsRequest)(nil), "google.cloud.ml.v1beta1.ListJobsRequest") - proto.RegisterType((*ListJobsResponse)(nil), "google.cloud.ml.v1beta1.ListJobsResponse") - proto.RegisterType((*GetJobRequest)(nil), "google.cloud.ml.v1beta1.GetJobRequest") - proto.RegisterType((*CancelJobRequest)(nil), "google.cloud.ml.v1beta1.CancelJobRequest") - proto.RegisterEnum("google.cloud.ml.v1beta1.TrainingInput_ScaleTier", TrainingInput_ScaleTier_name, TrainingInput_ScaleTier_value) - proto.RegisterEnum("google.cloud.ml.v1beta1.HyperparameterSpec_GoalType", HyperparameterSpec_GoalType_name, HyperparameterSpec_GoalType_value) - proto.RegisterEnum("google.cloud.ml.v1beta1.ParameterSpec_ParameterType", ParameterSpec_ParameterType_name, ParameterSpec_ParameterType_value) - proto.RegisterEnum("google.cloud.ml.v1beta1.ParameterSpec_ScaleType", ParameterSpec_ScaleType_name, ParameterSpec_ScaleType_value) - proto.RegisterEnum("google.cloud.ml.v1beta1.PredictionInput_DataFormat", PredictionInput_DataFormat_name, PredictionInput_DataFormat_value) - proto.RegisterEnum("google.cloud.ml.v1beta1.Job_State", Job_State_name, Job_State_value) -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// Client API for JobService service - -type JobServiceClient interface { - // Creates a training or a batch prediction job. - CreateJob(ctx context.Context, in *CreateJobRequest, opts ...grpc.CallOption) (*Job, error) - // Lists the jobs in the project. - ListJobs(ctx context.Context, in *ListJobsRequest, opts ...grpc.CallOption) (*ListJobsResponse, error) - // Describes a job. - GetJob(ctx context.Context, in *GetJobRequest, opts ...grpc.CallOption) (*Job, error) - // Cancels a running job. - CancelJob(ctx context.Context, in *CancelJobRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) -} - -type jobServiceClient struct { - cc *grpc.ClientConn -} - -func NewJobServiceClient(cc *grpc.ClientConn) JobServiceClient { - return &jobServiceClient{cc} -} - -func (c *jobServiceClient) CreateJob(ctx context.Context, in *CreateJobRequest, opts ...grpc.CallOption) (*Job, error) { - out := new(Job) - err := grpc.Invoke(ctx, "/google.cloud.ml.v1beta1.JobService/CreateJob", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *jobServiceClient) ListJobs(ctx context.Context, in *ListJobsRequest, opts ...grpc.CallOption) (*ListJobsResponse, error) { - out := new(ListJobsResponse) - err := grpc.Invoke(ctx, "/google.cloud.ml.v1beta1.JobService/ListJobs", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *jobServiceClient) GetJob(ctx context.Context, in *GetJobRequest, opts ...grpc.CallOption) (*Job, error) { - out := new(Job) - err := grpc.Invoke(ctx, "/google.cloud.ml.v1beta1.JobService/GetJob", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *jobServiceClient) CancelJob(ctx context.Context, in *CancelJobRequest, opts ...grpc.CallOption) (*google_protobuf1.Empty, error) { - out := new(google_protobuf1.Empty) - err := grpc.Invoke(ctx, "/google.cloud.ml.v1beta1.JobService/CancelJob", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Server API for JobService service - -type JobServiceServer interface { - // Creates a training or a batch prediction job. - CreateJob(context.Context, *CreateJobRequest) (*Job, error) - // Lists the jobs in the project. - ListJobs(context.Context, *ListJobsRequest) (*ListJobsResponse, error) - // Describes a job. - GetJob(context.Context, *GetJobRequest) (*Job, error) - // Cancels a running job. - CancelJob(context.Context, *CancelJobRequest) (*google_protobuf1.Empty, error) -} - -func RegisterJobServiceServer(s *grpc.Server, srv JobServiceServer) { - s.RegisterService(&_JobService_serviceDesc, srv) -} - -func _JobService_CreateJob_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateJobRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(JobServiceServer).CreateJob(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/google.cloud.ml.v1beta1.JobService/CreateJob", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(JobServiceServer).CreateJob(ctx, req.(*CreateJobRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _JobService_ListJobs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListJobsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(JobServiceServer).ListJobs(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/google.cloud.ml.v1beta1.JobService/ListJobs", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(JobServiceServer).ListJobs(ctx, req.(*ListJobsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _JobService_GetJob_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetJobRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(JobServiceServer).GetJob(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/google.cloud.ml.v1beta1.JobService/GetJob", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(JobServiceServer).GetJob(ctx, req.(*GetJobRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _JobService_CancelJob_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CancelJobRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(JobServiceServer).CancelJob(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/google.cloud.ml.v1beta1.JobService/CancelJob", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(JobServiceServer).CancelJob(ctx, req.(*CancelJobRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _JobService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "google.cloud.ml.v1beta1.JobService", - HandlerType: (*JobServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateJob", - Handler: _JobService_CreateJob_Handler, - }, - { - MethodName: "ListJobs", - Handler: _JobService_ListJobs_Handler, - }, - { - MethodName: "GetJob", - Handler: _JobService_GetJob_Handler, - }, - { - MethodName: "CancelJob", - Handler: _JobService_CancelJob_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "google/cloud/ml/v1beta1/job_service.proto", -} - -func init() { proto.RegisterFile("google/cloud/ml/v1beta1/job_service.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 2082 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0x4b, 0x6f, 0x1b, 0xc9, - 0x11, 0x16, 0x9f, 0x22, 0x8b, 0x12, 0x39, 0x6e, 0x5b, 0x36, 0x2d, 0x7b, 0x63, 0x79, 0x8c, 0x78, - 0x65, 0x07, 0x26, 0xd7, 0xf2, 0x06, 0xd8, 0xf5, 0x22, 0x09, 0x28, 0x72, 0x2c, 0x51, 0x10, 0x1f, - 0x69, 0x0e, 0x1d, 0xc7, 0x08, 0x30, 0x68, 0x92, 0x6d, 0x7a, 0xe4, 0x99, 0xe9, 0xc9, 0x4c, 0xd3, - 0x91, 0x36, 0x30, 0x10, 0x24, 0x39, 0xe5, 0x90, 0x4b, 0x90, 0x1c, 0x03, 0xe4, 0x9a, 0xbf, 0x93, - 0x43, 0xfe, 0x40, 0x8e, 0xf9, 0x01, 0x39, 0x06, 0xfd, 0xe0, 0x53, 0x96, 0xe4, 0x45, 0x72, 0x63, - 0x7f, 0xf5, 0x55, 0x55, 0x77, 0x55, 0x75, 0x4d, 0x35, 0xe1, 0xd1, 0x98, 0xb1, 0xb1, 0x47, 0xab, - 0x43, 0x8f, 0x4d, 0x46, 0x55, 0xdf, 0xab, 0xbe, 0x7f, 0x3a, 0xa0, 0x9c, 0x3c, 0xad, 0x9e, 0xb0, - 0x81, 0x13, 0xd3, 0xe8, 0xbd, 0x3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bd, 0x23, 0x74, 0x06, 0x59, 0x15, 0x6f, 0x74, 0x71, 0x93, 0x5e, 0x4a, 0xc8, 0x15, 0xc1, 0xf8, - 0x88, 0x6b, 0x91, 0x8a, 0x05, 0xc7, 0xd2, 0x6f, 0xf5, 0xf1, 0x07, 0xf4, 0x3b, 0x91, 0x8e, 0x69, - 0x1a, 0x2f, 0x4b, 0xc7, 0x4a, 0xaa, 0xb7, 0x6f, 0x9e, 0x6b, 0x9a, 0x96, 0x1f, 0xf2, 0x33, 0xf3, - 0x99, 0xf4, 0xfd, 0xc4, 0xdc, 0xbd, 0xd2, 0xf7, 0xf3, 0xa1, 0xb4, 0xf9, 0x3c, 0xf1, 0x78, 0x9f, - 0xc1, 0xbd, 0x21, 0xf3, 0xcf, 0x39, 0x27, 0xa1, 0x3b, 0xdd, 0xc0, 0x7e, 0x69, 0x5e, 0x43, 0x5d, - 0xe1, 0xb1, 0x9b, 0x78, 0xfd, 0xb5, 0xe6, 0x8f, 0x99, 0x47, 0x82, 0x71, 0x85, 0x45, 0xe3, 0xea, - 0x98, 0x06, 0x72, 0x3f, 0x55, 0x25, 0x22, 0xa1, 0x1b, 0x9f, 0xfb, 0x67, 0xee, 0x1b, 0xdf, 0x1b, - 0x64, 0x25, 0xeb, 0xd9, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xaf, 0x10, 0x62, 0xa8, 0xbe, 0x13, - 0x00, 0x00, -} diff --git a/vendor/google.golang.org/genproto/googleapis/cloud/ml/v1beta1/model_service.pb.go b/vendor/google.golang.org/genproto/googleapis/cloud/ml/v1beta1/model_service.pb.go deleted file mode 100644 index 486865db6..000000000 --- a/vendor/google.golang.org/genproto/googleapis/cloud/ml/v1beta1/model_service.pb.go +++ /dev/null @@ -1,1050 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: google/cloud/ml/v1beta1/model_service.proto - -package ml - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "google.golang.org/genproto/googleapis/api/annotations" -import _ "google.golang.org/genproto/googleapis/api/serviceconfig" -import google_longrunning "google.golang.org/genproto/googleapis/longrunning" -import google_protobuf2 "github.com/golang/protobuf/ptypes/timestamp" - -import ( - context "golang.org/x/net/context" - grpc "google.golang.org/grpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// Represents a machine learning solution. -// -// A model can have multiple versions, each of which is a deployed, trained -// model ready to receive prediction requests. The model itself is just a -// container. -type Model struct { - // Required. The name specified for the model when it was created. - // - // The model name must be unique within the project it is created in. - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - // Optional. The description specified for the model when it was created. - Description string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"` - // Output only. The default version of the model. This version will be used to - // handle prediction requests that do not specify a version. - // - // You can change the default version by calling - // [projects.methods.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault). - DefaultVersion *Version `protobuf:"bytes,3,opt,name=default_version,json=defaultVersion" json:"default_version,omitempty"` - // Optional. The list of regions where the model is going to be deployed. - // Currently only one region per model is supported. - // Defaults to 'us-central1' if nothing is set. - Regions []string `protobuf:"bytes,4,rep,name=regions" json:"regions,omitempty"` - // Optional. If true, enables StackDriver Logging for online prediction. - // Default is false. - OnlinePredictionLogging bool `protobuf:"varint,5,opt,name=online_prediction_logging,json=onlinePredictionLogging" json:"online_prediction_logging,omitempty"` -} - -func (m *Model) Reset() { *m = Model{} } -func (m *Model) String() string { return proto.CompactTextString(m) } -func (*Model) ProtoMessage() {} -func (*Model) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } - -func (m *Model) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *Model) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *Model) GetDefaultVersion() *Version { - if m != nil { - return m.DefaultVersion - } - return nil -} - -func (m *Model) GetRegions() []string { - if m != nil { - return m.Regions - } - return nil -} - -func (m *Model) GetOnlinePredictionLogging() bool { - if m != nil { - return m.OnlinePredictionLogging - } - return false -} - -// Represents a version of the model. -// -// Each version is a trained model deployed in the cloud, ready to handle -// prediction requests. A model can have multiple versions. You can get -// information about all of the versions of a given model by calling -// [projects.models.versions.list](/ml/reference/rest/v1beta1/projects.models.versions/list). -type Version struct { - // Required.The name specified for the version when it was created. - // - // The version name must be unique within the model it is created in. - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - // Optional. The description specified for the version when it was created. - Description string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"` - // Output only. If true, this version will be used to handle prediction - // requests that do not specify a version. - // - // You can change the default version by calling - // [projects.methods.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault). - IsDefault bool `protobuf:"varint,3,opt,name=is_default,json=isDefault" json:"is_default,omitempty"` - // Required. The Google Cloud Storage location of the trained model used to - // create the version. See the - // [overview of model deployment](/ml/docs/concepts/deployment-overview) for - // more informaiton. - // - // When passing Version to - // [projects.models.versions.create](/ml/reference/rest/v1beta1/projects.models.versions/create) - // the model service uses the specified location as the source of the model. - // Once deployed, the model version is hosted by the prediction service, so - // this location is useful only as a historical record. - DeploymentUri string `protobuf:"bytes,4,opt,name=deployment_uri,json=deploymentUri" json:"deployment_uri,omitempty"` - // Output only. The time the version was created. - CreateTime *google_protobuf2.Timestamp `protobuf:"bytes,5,opt,name=create_time,json=createTime" json:"create_time,omitempty"` - // Output only. The time the version was last used for prediction. - LastUseTime *google_protobuf2.Timestamp `protobuf:"bytes,6,opt,name=last_use_time,json=lastUseTime" json:"last_use_time,omitempty"` - // Optional. The Google Cloud ML runtime version to use for this deployment. - // If not set, Google Cloud ML will choose a version. - RuntimeVersion string `protobuf:"bytes,8,opt,name=runtime_version,json=runtimeVersion" json:"runtime_version,omitempty"` - // Optional. Manually select the number of nodes to use for serving the - // model. If unset (i.e., by default), the number of nodes used to serve - // the model automatically scales with traffic. However, care should be - // taken to ramp up traffic according to the model's ability to scale. If - // your model needs to handle bursts of traffic beyond it's ability to - // scale, it is recommended you set this field appropriately. - ManualScaling *ManualScaling `protobuf:"bytes,9,opt,name=manual_scaling,json=manualScaling" json:"manual_scaling,omitempty"` -} - -func (m *Version) Reset() { *m = Version{} } -func (m *Version) String() string { return proto.CompactTextString(m) } -func (*Version) ProtoMessage() {} -func (*Version) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} } - -func (m *Version) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *Version) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *Version) GetIsDefault() bool { - if m != nil { - return m.IsDefault - } - return false -} - -func (m *Version) GetDeploymentUri() string { - if m != nil { - return m.DeploymentUri - } - return "" -} - -func (m *Version) GetCreateTime() *google_protobuf2.Timestamp { - if m != nil { - return m.CreateTime - } - return nil -} - -func (m *Version) GetLastUseTime() *google_protobuf2.Timestamp { - if m != nil { - return m.LastUseTime - } - return nil -} - -func (m *Version) GetRuntimeVersion() string { - if m != nil { - return m.RuntimeVersion - } - return "" -} - -func (m *Version) GetManualScaling() *ManualScaling { - if m != nil { - return m.ManualScaling - } - return nil -} - -// Options for manually scaling a model. -type ManualScaling struct { - // The number of nodes to allocate for this model. These nodes are always up, - // starting from the time the model is deployed, so the cost of operating - // this model will be proportional to nodes * number of hours since - // deployment. - Nodes int32 `protobuf:"varint,1,opt,name=nodes" json:"nodes,omitempty"` -} - -func (m *ManualScaling) Reset() { *m = ManualScaling{} } -func (m *ManualScaling) String() string { return proto.CompactTextString(m) } -func (*ManualScaling) ProtoMessage() {} -func (*ManualScaling) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{2} } - -func (m *ManualScaling) GetNodes() int32 { - if m != nil { - return m.Nodes - } - return 0 -} - -// Request message for the CreateModel method. -type CreateModelRequest struct { - // Required. The project name. - // - // Authorization: requires `Editor` role on the specified project. - Parent string `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"` - // Required. The model to create. - Model *Model `protobuf:"bytes,2,opt,name=model" json:"model,omitempty"` -} - -func (m *CreateModelRequest) Reset() { *m = CreateModelRequest{} } -func (m *CreateModelRequest) String() string { return proto.CompactTextString(m) } -func (*CreateModelRequest) ProtoMessage() {} -func (*CreateModelRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{3} } - -func (m *CreateModelRequest) GetParent() string { - if m != nil { - return m.Parent - } - return "" -} - -func (m *CreateModelRequest) GetModel() *Model { - if m != nil { - return m.Model - } - return nil -} - -// Request message for the ListModels method. -type ListModelsRequest struct { - // Required. The name of the project whose models are to be listed. - // - // Authorization: requires `Viewer` role on the specified project. - Parent string `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"` - // Optional. A page token to request the next page of results. - // - // You get the token from the `next_page_token` field of the response from - // the previous call. - PageToken string `protobuf:"bytes,4,opt,name=page_token,json=pageToken" json:"page_token,omitempty"` - // Optional. The number of models to retrieve per "page" of results. If there - // are more remaining results than this number, the response message will - // contain a valid value in the `next_page_token` field. - // - // The default value is 20, and the maximum page size is 100. - PageSize int32 `protobuf:"varint,5,opt,name=page_size,json=pageSize" json:"page_size,omitempty"` -} - -func (m *ListModelsRequest) Reset() { *m = ListModelsRequest{} } -func (m *ListModelsRequest) String() string { return proto.CompactTextString(m) } -func (*ListModelsRequest) ProtoMessage() {} -func (*ListModelsRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{4} } - -func (m *ListModelsRequest) GetParent() string { - if m != nil { - return m.Parent - } - return "" -} - -func (m *ListModelsRequest) GetPageToken() string { - if m != nil { - return m.PageToken - } - return "" -} - -func (m *ListModelsRequest) GetPageSize() int32 { - if m != nil { - return m.PageSize - } - return 0 -} - -// Response message for the ListModels method. -type ListModelsResponse struct { - // The list of models. - Models []*Model `protobuf:"bytes,1,rep,name=models" json:"models,omitempty"` - // Optional. Pass this token as the `page_token` field of the request for a - // subsequent call. - NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken" json:"next_page_token,omitempty"` -} - -func (m *ListModelsResponse) Reset() { *m = ListModelsResponse{} } -func (m *ListModelsResponse) String() string { return proto.CompactTextString(m) } -func (*ListModelsResponse) ProtoMessage() {} -func (*ListModelsResponse) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{5} } - -func (m *ListModelsResponse) GetModels() []*Model { - if m != nil { - return m.Models - } - return nil -} - -func (m *ListModelsResponse) GetNextPageToken() string { - if m != nil { - return m.NextPageToken - } - return "" -} - -// Request message for the GetModel method. -type GetModelRequest struct { - // Required. The name of the model. - // - // Authorization: requires `Viewer` role on the parent project. - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` -} - -func (m *GetModelRequest) Reset() { *m = GetModelRequest{} } -func (m *GetModelRequest) String() string { return proto.CompactTextString(m) } -func (*GetModelRequest) ProtoMessage() {} -func (*GetModelRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{6} } - -func (m *GetModelRequest) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -// Request message for the DeleteModel method. -type DeleteModelRequest struct { - // Required. The name of the model. - // - // Authorization: requires `Editor` role on the parent project. - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` -} - -func (m *DeleteModelRequest) Reset() { *m = DeleteModelRequest{} } -func (m *DeleteModelRequest) String() string { return proto.CompactTextString(m) } -func (*DeleteModelRequest) ProtoMessage() {} -func (*DeleteModelRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{7} } - -func (m *DeleteModelRequest) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -// Uploads the provided trained model version to Cloud Machine Learning. -type CreateVersionRequest struct { - // Required. The name of the model. - // - // Authorization: requires `Editor` role on the parent project. - Parent string `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"` - // Required. The version details. - Version *Version `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"` -} - -func (m *CreateVersionRequest) Reset() { *m = CreateVersionRequest{} } -func (m *CreateVersionRequest) String() string { return proto.CompactTextString(m) } -func (*CreateVersionRequest) ProtoMessage() {} -func (*CreateVersionRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{8} } - -func (m *CreateVersionRequest) GetParent() string { - if m != nil { - return m.Parent - } - return "" -} - -func (m *CreateVersionRequest) GetVersion() *Version { - if m != nil { - return m.Version - } - return nil -} - -// Request message for the ListVersions method. -type ListVersionsRequest struct { - // Required. The name of the model for which to list the version. - // - // Authorization: requires `Viewer` role on the parent project. - Parent string `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"` - // Optional. A page token to request the next page of results. - // - // You get the token from the `next_page_token` field of the response from - // the previous call. - PageToken string `protobuf:"bytes,4,opt,name=page_token,json=pageToken" json:"page_token,omitempty"` - // Optional. The number of versions to retrieve per "page" of results. If - // there are more remaining results than this number, the response message - // will contain a valid value in the `next_page_token` field. - // - // The default value is 20, and the maximum page size is 100. - PageSize int32 `protobuf:"varint,5,opt,name=page_size,json=pageSize" json:"page_size,omitempty"` -} - -func (m *ListVersionsRequest) Reset() { *m = ListVersionsRequest{} } -func (m *ListVersionsRequest) String() string { return proto.CompactTextString(m) } -func (*ListVersionsRequest) ProtoMessage() {} -func (*ListVersionsRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{9} } - -func (m *ListVersionsRequest) GetParent() string { - if m != nil { - return m.Parent - } - return "" -} - -func (m *ListVersionsRequest) GetPageToken() string { - if m != nil { - return m.PageToken - } - return "" -} - -func (m *ListVersionsRequest) GetPageSize() int32 { - if m != nil { - return m.PageSize - } - return 0 -} - -// Response message for the ListVersions method. -type ListVersionsResponse struct { - // The list of versions. - Versions []*Version `protobuf:"bytes,1,rep,name=versions" json:"versions,omitempty"` - // Optional. Pass this token as the `page_token` field of the request for a - // subsequent call. - NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken" json:"next_page_token,omitempty"` -} - -func (m *ListVersionsResponse) Reset() { *m = ListVersionsResponse{} } -func (m *ListVersionsResponse) String() string { return proto.CompactTextString(m) } -func (*ListVersionsResponse) ProtoMessage() {} -func (*ListVersionsResponse) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{10} } - -func (m *ListVersionsResponse) GetVersions() []*Version { - if m != nil { - return m.Versions - } - return nil -} - -func (m *ListVersionsResponse) GetNextPageToken() string { - if m != nil { - return m.NextPageToken - } - return "" -} - -// Request message for the GetVersion method. -type GetVersionRequest struct { - // Required. The name of the version. - // - // Authorization: requires `Viewer` role on the parent project. - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` -} - -func (m *GetVersionRequest) Reset() { *m = GetVersionRequest{} } -func (m *GetVersionRequest) String() string { return proto.CompactTextString(m) } -func (*GetVersionRequest) ProtoMessage() {} -func (*GetVersionRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{11} } - -func (m *GetVersionRequest) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -// Request message for the DeleteVerionRequest method. -type DeleteVersionRequest struct { - // Required. The name of the version. You can get the names of all the - // versions of a model by calling - // [projects.models.versions.list](/ml/reference/rest/v1beta1/projects.models.versions/list). - // - // Authorization: requires `Editor` role on the parent project. - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` -} - -func (m *DeleteVersionRequest) Reset() { *m = DeleteVersionRequest{} } -func (m *DeleteVersionRequest) String() string { return proto.CompactTextString(m) } -func (*DeleteVersionRequest) ProtoMessage() {} -func (*DeleteVersionRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{12} } - -func (m *DeleteVersionRequest) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -// Request message for the SetDefaultVersion request. -type SetDefaultVersionRequest struct { - // Required. The name of the version to make the default for the model. You - // can get the names of all the versions of a model by calling - // [projects.models.versions.list](/ml/reference/rest/v1beta1/projects.models.versions/list). - // - // Authorization: requires `Editor` role on the parent project. - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` -} - -func (m *SetDefaultVersionRequest) Reset() { *m = SetDefaultVersionRequest{} } -func (m *SetDefaultVersionRequest) String() string { return proto.CompactTextString(m) } -func (*SetDefaultVersionRequest) ProtoMessage() {} -func (*SetDefaultVersionRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{13} } - -func (m *SetDefaultVersionRequest) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func init() { - proto.RegisterType((*Model)(nil), "google.cloud.ml.v1beta1.Model") - proto.RegisterType((*Version)(nil), "google.cloud.ml.v1beta1.Version") - proto.RegisterType((*ManualScaling)(nil), "google.cloud.ml.v1beta1.ManualScaling") - proto.RegisterType((*CreateModelRequest)(nil), "google.cloud.ml.v1beta1.CreateModelRequest") - proto.RegisterType((*ListModelsRequest)(nil), "google.cloud.ml.v1beta1.ListModelsRequest") - proto.RegisterType((*ListModelsResponse)(nil), "google.cloud.ml.v1beta1.ListModelsResponse") - proto.RegisterType((*GetModelRequest)(nil), "google.cloud.ml.v1beta1.GetModelRequest") - proto.RegisterType((*DeleteModelRequest)(nil), "google.cloud.ml.v1beta1.DeleteModelRequest") - proto.RegisterType((*CreateVersionRequest)(nil), "google.cloud.ml.v1beta1.CreateVersionRequest") - proto.RegisterType((*ListVersionsRequest)(nil), "google.cloud.ml.v1beta1.ListVersionsRequest") - proto.RegisterType((*ListVersionsResponse)(nil), "google.cloud.ml.v1beta1.ListVersionsResponse") - proto.RegisterType((*GetVersionRequest)(nil), "google.cloud.ml.v1beta1.GetVersionRequest") - proto.RegisterType((*DeleteVersionRequest)(nil), "google.cloud.ml.v1beta1.DeleteVersionRequest") - proto.RegisterType((*SetDefaultVersionRequest)(nil), "google.cloud.ml.v1beta1.SetDefaultVersionRequest") -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// Client API for ModelService service - -type ModelServiceClient interface { - // Creates a model which will later contain one or more versions. - // - // You must add at least one version before you can request predictions from - // the model. Add versions by calling - // [projects.models.versions.create](/ml/reference/rest/v1beta1/projects.models.versions/create). - CreateModel(ctx context.Context, in *CreateModelRequest, opts ...grpc.CallOption) (*Model, error) - // Lists the models in a project. - // - // Each project can contain multiple models, and each model can have multiple - // versions. - ListModels(ctx context.Context, in *ListModelsRequest, opts ...grpc.CallOption) (*ListModelsResponse, error) - // Gets information about a model, including its name, the description (if - // set), and the default version (if at least one version of the model has - // been deployed). - GetModel(ctx context.Context, in *GetModelRequest, opts ...grpc.CallOption) (*Model, error) - // Deletes a model. - // - // You can only delete a model if there are no versions in it. You can delete - // versions by calling - // [projects.models.versions.delete](/ml/reference/rest/v1beta1/projects.models.versions/delete). - DeleteModel(ctx context.Context, in *DeleteModelRequest, opts ...grpc.CallOption) (*google_longrunning.Operation, error) - // Creates a new version of a model from a trained TensorFlow model. - // - // If the version created in the cloud by this call is the first deployed - // version of the specified model, it will be made the default version of the - // model. When you add a version to a model that already has one or more - // versions, the default version does not automatically change. If you want a - // new version to be the default, you must call - // [projects.models.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault). - CreateVersion(ctx context.Context, in *CreateVersionRequest, opts ...grpc.CallOption) (*google_longrunning.Operation, error) - // Gets basic information about all the versions of a model. - // - // If you expect that a model has a lot of versions, or if you need to handle - // only a limited number of results at a time, you can request that the list - // be retrieved in batches (called pages): - ListVersions(ctx context.Context, in *ListVersionsRequest, opts ...grpc.CallOption) (*ListVersionsResponse, error) - // Gets information about a model version. - // - // Models can have multiple versions. You can call - // [projects.models.versions.list](/ml/reference/rest/v1beta1/projects.models.versions/list) - // to get the same information that this method returns for all of the - // versions of a model. - GetVersion(ctx context.Context, in *GetVersionRequest, opts ...grpc.CallOption) (*Version, error) - // Deletes a model version. - // - // Each model can have multiple versions deployed and in use at any given - // time. Use this method to remove a single version. - // - // Note: You cannot delete the version that is set as the default version - // of the model unless it is the only remaining version. - DeleteVersion(ctx context.Context, in *DeleteVersionRequest, opts ...grpc.CallOption) (*google_longrunning.Operation, error) - // Designates a version to be the default for the model. - // - // The default version is used for prediction requests made against the model - // that don't specify a version. - // - // The first version to be created for a model is automatically set as the - // default. You must make any subsequent changes to the default version - // setting manually using this method. - SetDefaultVersion(ctx context.Context, in *SetDefaultVersionRequest, opts ...grpc.CallOption) (*Version, error) -} - -type modelServiceClient struct { - cc *grpc.ClientConn -} - -func NewModelServiceClient(cc *grpc.ClientConn) ModelServiceClient { - return &modelServiceClient{cc} -} - -func (c *modelServiceClient) CreateModel(ctx context.Context, in *CreateModelRequest, opts ...grpc.CallOption) (*Model, error) { - out := new(Model) - err := grpc.Invoke(ctx, "/google.cloud.ml.v1beta1.ModelService/CreateModel", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *modelServiceClient) ListModels(ctx context.Context, in *ListModelsRequest, opts ...grpc.CallOption) (*ListModelsResponse, error) { - out := new(ListModelsResponse) - err := grpc.Invoke(ctx, "/google.cloud.ml.v1beta1.ModelService/ListModels", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *modelServiceClient) GetModel(ctx context.Context, in *GetModelRequest, opts ...grpc.CallOption) (*Model, error) { - out := new(Model) - err := grpc.Invoke(ctx, "/google.cloud.ml.v1beta1.ModelService/GetModel", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *modelServiceClient) DeleteModel(ctx context.Context, in *DeleteModelRequest, opts ...grpc.CallOption) (*google_longrunning.Operation, error) { - out := new(google_longrunning.Operation) - err := grpc.Invoke(ctx, "/google.cloud.ml.v1beta1.ModelService/DeleteModel", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *modelServiceClient) CreateVersion(ctx context.Context, in *CreateVersionRequest, opts ...grpc.CallOption) (*google_longrunning.Operation, error) { - out := new(google_longrunning.Operation) - err := grpc.Invoke(ctx, "/google.cloud.ml.v1beta1.ModelService/CreateVersion", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *modelServiceClient) ListVersions(ctx context.Context, in *ListVersionsRequest, opts ...grpc.CallOption) (*ListVersionsResponse, error) { - out := new(ListVersionsResponse) - err := grpc.Invoke(ctx, "/google.cloud.ml.v1beta1.ModelService/ListVersions", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *modelServiceClient) GetVersion(ctx context.Context, in *GetVersionRequest, opts ...grpc.CallOption) (*Version, error) { - out := new(Version) - err := grpc.Invoke(ctx, "/google.cloud.ml.v1beta1.ModelService/GetVersion", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *modelServiceClient) DeleteVersion(ctx context.Context, in *DeleteVersionRequest, opts ...grpc.CallOption) (*google_longrunning.Operation, error) { - out := new(google_longrunning.Operation) - err := grpc.Invoke(ctx, "/google.cloud.ml.v1beta1.ModelService/DeleteVersion", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *modelServiceClient) SetDefaultVersion(ctx context.Context, in *SetDefaultVersionRequest, opts ...grpc.CallOption) (*Version, error) { - out := new(Version) - err := grpc.Invoke(ctx, "/google.cloud.ml.v1beta1.ModelService/SetDefaultVersion", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Server API for ModelService service - -type ModelServiceServer interface { - // Creates a model which will later contain one or more versions. - // - // You must add at least one version before you can request predictions from - // the model. Add versions by calling - // [projects.models.versions.create](/ml/reference/rest/v1beta1/projects.models.versions/create). - CreateModel(context.Context, *CreateModelRequest) (*Model, error) - // Lists the models in a project. - // - // Each project can contain multiple models, and each model can have multiple - // versions. - ListModels(context.Context, *ListModelsRequest) (*ListModelsResponse, error) - // Gets information about a model, including its name, the description (if - // set), and the default version (if at least one version of the model has - // been deployed). - GetModel(context.Context, *GetModelRequest) (*Model, error) - // Deletes a model. - // - // You can only delete a model if there are no versions in it. You can delete - // versions by calling - // [projects.models.versions.delete](/ml/reference/rest/v1beta1/projects.models.versions/delete). - DeleteModel(context.Context, *DeleteModelRequest) (*google_longrunning.Operation, error) - // Creates a new version of a model from a trained TensorFlow model. - // - // If the version created in the cloud by this call is the first deployed - // version of the specified model, it will be made the default version of the - // model. When you add a version to a model that already has one or more - // versions, the default version does not automatically change. If you want a - // new version to be the default, you must call - // [projects.models.versions.setDefault](/ml/reference/rest/v1beta1/projects.models.versions/setDefault). - CreateVersion(context.Context, *CreateVersionRequest) (*google_longrunning.Operation, error) - // Gets basic information about all the versions of a model. - // - // If you expect that a model has a lot of versions, or if you need to handle - // only a limited number of results at a time, you can request that the list - // be retrieved in batches (called pages): - ListVersions(context.Context, *ListVersionsRequest) (*ListVersionsResponse, error) - // Gets information about a model version. - // - // Models can have multiple versions. You can call - // [projects.models.versions.list](/ml/reference/rest/v1beta1/projects.models.versions/list) - // to get the same information that this method returns for all of the - // versions of a model. - GetVersion(context.Context, *GetVersionRequest) (*Version, error) - // Deletes a model version. - // - // Each model can have multiple versions deployed and in use at any given - // time. Use this method to remove a single version. - // - // Note: You cannot delete the version that is set as the default version - // of the model unless it is the only remaining version. - DeleteVersion(context.Context, *DeleteVersionRequest) (*google_longrunning.Operation, error) - // Designates a version to be the default for the model. - // - // The default version is used for prediction requests made against the model - // that don't specify a version. - // - // The first version to be created for a model is automatically set as the - // default. You must make any subsequent changes to the default version - // setting manually using this method. - SetDefaultVersion(context.Context, *SetDefaultVersionRequest) (*Version, error) -} - -func RegisterModelServiceServer(s *grpc.Server, srv ModelServiceServer) { - s.RegisterService(&_ModelService_serviceDesc, srv) -} - -func _ModelService_CreateModel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateModelRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ModelServiceServer).CreateModel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/google.cloud.ml.v1beta1.ModelService/CreateModel", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ModelServiceServer).CreateModel(ctx, req.(*CreateModelRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ModelService_ListModels_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListModelsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ModelServiceServer).ListModels(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/google.cloud.ml.v1beta1.ModelService/ListModels", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ModelServiceServer).ListModels(ctx, req.(*ListModelsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ModelService_GetModel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetModelRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ModelServiceServer).GetModel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/google.cloud.ml.v1beta1.ModelService/GetModel", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ModelServiceServer).GetModel(ctx, req.(*GetModelRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ModelService_DeleteModel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteModelRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ModelServiceServer).DeleteModel(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/google.cloud.ml.v1beta1.ModelService/DeleteModel", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ModelServiceServer).DeleteModel(ctx, req.(*DeleteModelRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ModelService_CreateVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateVersionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ModelServiceServer).CreateVersion(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/google.cloud.ml.v1beta1.ModelService/CreateVersion", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ModelServiceServer).CreateVersion(ctx, req.(*CreateVersionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ModelService_ListVersions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListVersionsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ModelServiceServer).ListVersions(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/google.cloud.ml.v1beta1.ModelService/ListVersions", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ModelServiceServer).ListVersions(ctx, req.(*ListVersionsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ModelService_GetVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetVersionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ModelServiceServer).GetVersion(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/google.cloud.ml.v1beta1.ModelService/GetVersion", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ModelServiceServer).GetVersion(ctx, req.(*GetVersionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ModelService_DeleteVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteVersionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ModelServiceServer).DeleteVersion(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/google.cloud.ml.v1beta1.ModelService/DeleteVersion", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ModelServiceServer).DeleteVersion(ctx, req.(*DeleteVersionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ModelService_SetDefaultVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SetDefaultVersionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ModelServiceServer).SetDefaultVersion(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/google.cloud.ml.v1beta1.ModelService/SetDefaultVersion", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ModelServiceServer).SetDefaultVersion(ctx, req.(*SetDefaultVersionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _ModelService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "google.cloud.ml.v1beta1.ModelService", - HandlerType: (*ModelServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateModel", - Handler: _ModelService_CreateModel_Handler, - }, - { - MethodName: "ListModels", - Handler: _ModelService_ListModels_Handler, - }, - { - MethodName: "GetModel", - Handler: _ModelService_GetModel_Handler, - }, - { - MethodName: "DeleteModel", - Handler: _ModelService_DeleteModel_Handler, - }, - { - MethodName: "CreateVersion", - Handler: _ModelService_CreateVersion_Handler, - }, - { - MethodName: "ListVersions", - Handler: _ModelService_ListVersions_Handler, - }, - { - MethodName: "GetVersion", - Handler: _ModelService_GetVersion_Handler, - }, - { - MethodName: "DeleteVersion", - Handler: _ModelService_DeleteVersion_Handler, - }, - { - MethodName: "SetDefaultVersion", - Handler: _ModelService_SetDefaultVersion_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "google/cloud/ml/v1beta1/model_service.proto", -} - -func init() { proto.RegisterFile("google/cloud/ml/v1beta1/model_service.proto", fileDescriptor1) } - -var fileDescriptor1 = []byte{ - // 1013 bytes of a gzipped FileDescriptorProto - 0x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61, 0x40, 0x6a, 0x75, 0x96, 0x3d, 0x73, 0x05, - 0x89, 0x31, 0x17, 0x41, 0x9c, 0x68, 0x80, 0xfd, 0xa7, 0x05, 0xb5, 0x63, 0xc9, 0x15, 0x21, 0x58, - 0xa3, 0x41, 0x8c, 0xdb, 0x56, 0xd7, 0xea, 0x35, 0x3c, 0xf5, 0x1b, 0x75, 0xa1, 0x39, 0xc6, 0x7c, - 0x94, 0x92, 0x44, 0x1e, 0xda, 0x5e, 0x51, 0x5b, 0x45, 0x13, 0xfa, 0x04, 0xb6, 0xc6, 0xf8, 0x59, - 0x90, 0x45, 0xc2, 0x3f, 0xc7, 0x29, 0x97, 0xa8, 0xd5, 0xae, 0xd5, 0x6b, 0x0e, 0xba, 0xce, 0x82, - 0xdb, 0x3a, 0x9f, 0x69, 0x9c, 0xb7, 0x69, 0x1c, 0xcd, 0x1a, 0xb5, 0x61, 0x23, 0xc5, 0xa1, 0x24, - 0xdf, 0x5e, 0xeb, 0xae, 0xf6, 0x1a, 0x5e, 0xbe, 0x44, 0x43, 0x78, 0x93, 0xd1, 0x88, 0x50, 0xec, - 0x27, 0x29, 0x1e, 0x93, 0x91, 0x8c, 0xec, 0x47, 0x2c, 0x0c, 0x09, 0x0d, 0xdb, 0xb5, 0xae, 0xd5, - 0xab, 0x7b, 0xd7, 0x35, 0xe0, 0x64, 0xb2, 0xff, 0x58, 0x6f, 0xdb, 0xff, 0xac, 0xc0, 0x46, 0x1e, - 0xe1, 0xbf, 0x5d, 0x71, 0x17, 0x80, 0x70, 0xdf, 0x90, 0x55, 0xb7, 0xab, 0x7b, 0x0d, 0xc2, 0x8f, - 0xb4, 0x01, 0xed, 0xc1, 0xe6, 0x18, 0x27, 0x11, 0xfb, 0x3a, 0xc6, 0x54, 0xf8, 0x59, 0x4a, 0xda, - 0x6b, 0xea, 0x8c, 0xd6, 0x85, 0xf5, 0x69, 0x4a, 0xd0, 0x7d, 0x68, 0x8e, 0x52, 0x1c, 0x08, 0xec, - 0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, - 0xab, 0x7f, 0x55, 0x5e, 0xbf, 0x5b, 0xb0, 0x3d, 0x33, 0xe8, 0xd0, 0xc1, 0x42, 0x6e, 0x8b, 0x86, - 0x62, 0x85, 0xd4, 0x1d, 0x29, 0x8a, 0x0f, 0xec, 0xc3, 0xab, 0x51, 0x1c, 0xf2, 0x49, 0xc8, 0xa1, - 0xd5, 0x7f, 0xf8, 0x02, 0x6e, 0x8c, 0x58, 0x3c, 0x13, 0x2c, 0x48, 0x48, 0x1e, 0xf0, 0xe1, 0x76, - 0x71, 0x10, 0x9f, 0xc8, 0x57, 0xdc, 0x89, 0xf5, 0xf9, 0xa1, 0xf1, 0x08, 0x59, 0x14, 0xd0, 0xd0, - 0x61, 0x69, 0xe8, 0x86, 0x98, 0xaa, 0x37, 0x9e, 0xab, 0xb7, 0x82, 0x84, 0xf0, 0x99, 0xff, 0x1c, - 0xf7, 0xe3, 0xe8, 0x6c, 0x5d, 0xa1, 0xde, 0xfb, 0x37, 0x00, 0x00, 0xff, 0xff, 0x04, 0x39, 0xff, - 0x08, 0x98, 0x0c, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/genproto/googleapis/cloud/ml/v1beta1/operation_metadata.pb.go b/vendor/google.golang.org/genproto/googleapis/cloud/ml/v1beta1/operation_metadata.pb.go deleted file mode 100644 index 293077731..000000000 --- a/vendor/google.golang.org/genproto/googleapis/cloud/ml/v1beta1/operation_metadata.pb.go +++ /dev/null @@ -1,161 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: google/cloud/ml/v1beta1/operation_metadata.proto - -package ml - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "google.golang.org/genproto/googleapis/api/annotations" -import google_protobuf2 "github.com/golang/protobuf/ptypes/timestamp" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// The operation type. -type OperationMetadata_OperationType int32 - -const ( - // Unspecified operation type. - OperationMetadata_OPERATION_TYPE_UNSPECIFIED OperationMetadata_OperationType = 0 - // An operation to create a new version. - OperationMetadata_CREATE_VERSION OperationMetadata_OperationType = 1 - // An operation to delete an existing version. - OperationMetadata_DELETE_VERSION OperationMetadata_OperationType = 2 - // An operation to delete an existing model. - OperationMetadata_DELETE_MODEL OperationMetadata_OperationType = 3 -) - -var OperationMetadata_OperationType_name = map[int32]string{ - 0: "OPERATION_TYPE_UNSPECIFIED", - 1: "CREATE_VERSION", - 2: "DELETE_VERSION", - 3: "DELETE_MODEL", -} -var OperationMetadata_OperationType_value = map[string]int32{ - "OPERATION_TYPE_UNSPECIFIED": 0, - "CREATE_VERSION": 1, - "DELETE_VERSION": 2, - "DELETE_MODEL": 3, -} - -func (x OperationMetadata_OperationType) String() string { - return proto.EnumName(OperationMetadata_OperationType_name, int32(x)) -} -func (OperationMetadata_OperationType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor2, []int{0, 0} -} - -// Represents the metadata of the long-running operation. -type OperationMetadata struct { - // The time the operation was submitted. - CreateTime *google_protobuf2.Timestamp `protobuf:"bytes,1,opt,name=create_time,json=createTime" json:"create_time,omitempty"` - // The time operation processing started. - StartTime *google_protobuf2.Timestamp `protobuf:"bytes,2,opt,name=start_time,json=startTime" json:"start_time,omitempty"` - // The time operation processing completed. - EndTime *google_protobuf2.Timestamp `protobuf:"bytes,3,opt,name=end_time,json=endTime" json:"end_time,omitempty"` - // Indicates whether a request to cancel this operation has been made. - IsCancellationRequested bool `protobuf:"varint,4,opt,name=is_cancellation_requested,json=isCancellationRequested" json:"is_cancellation_requested,omitempty"` - // The operation type. - OperationType OperationMetadata_OperationType `protobuf:"varint,5,opt,name=operation_type,json=operationType,enum=google.cloud.ml.v1beta1.OperationMetadata_OperationType" json:"operation_type,omitempty"` - // Contains the name of the model associated with the operation. - ModelName string `protobuf:"bytes,6,opt,name=model_name,json=modelName" json:"model_name,omitempty"` - // Contains the version associated with the operation. - Version *Version `protobuf:"bytes,7,opt,name=version" json:"version,omitempty"` -} - -func (m *OperationMetadata) Reset() { *m = OperationMetadata{} } -func (m *OperationMetadata) String() string { return proto.CompactTextString(m) } -func (*OperationMetadata) ProtoMessage() {} -func (*OperationMetadata) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} } - -func (m *OperationMetadata) GetCreateTime() *google_protobuf2.Timestamp { - if m != nil { - return m.CreateTime - } - return nil -} - -func (m *OperationMetadata) GetStartTime() *google_protobuf2.Timestamp { - if m != nil { - return m.StartTime - } - return nil -} - -func (m *OperationMetadata) GetEndTime() *google_protobuf2.Timestamp { - if m != nil { - return m.EndTime - } - return nil -} - -func (m *OperationMetadata) GetIsCancellationRequested() bool { - if m != nil { - return m.IsCancellationRequested - } - return false -} - -func (m *OperationMetadata) GetOperationType() OperationMetadata_OperationType { - if m != nil { - return m.OperationType - } - return OperationMetadata_OPERATION_TYPE_UNSPECIFIED -} - -func (m *OperationMetadata) GetModelName() string { - if m != nil { - return m.ModelName - } - return "" -} - -func (m *OperationMetadata) GetVersion() *Version { - if m != nil { - return m.Version - } - return nil -} - -func init() { - proto.RegisterType((*OperationMetadata)(nil), "google.cloud.ml.v1beta1.OperationMetadata") - proto.RegisterEnum("google.cloud.ml.v1beta1.OperationMetadata_OperationType", OperationMetadata_OperationType_name, OperationMetadata_OperationType_value) -} - -func init() { proto.RegisterFile("google/cloud/ml/v1beta1/operation_metadata.proto", fileDescriptor2) } - -var fileDescriptor2 = []byte{ - // 457 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0x5f, 0x6b, 0xdb, 0x30, - 0x14, 0xc5, 0xe7, 0xb6, 0x6b, 0x1b, 0x75, 0x0d, 0x99, 0x1f, 0x56, 0x2f, 0x6c, 0xab, 0xe9, 0x53, - 0x60, 0x60, 0xaf, 0x1d, 0x83, 0x75, 0x7d, 0x6a, 0x13, 0x0d, 0x02, 0x6d, 0x6c, 0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0x66, 0xa9, 0xf7, 0xeb, 0xb2, - 0xc5, 0x2a, 0xc5, 0xa9, 0xac, 0x22, 0xd5, 0x54, 0x71, 0x05, 0xd2, 0x5e, 0x34, 0x76, 0x25, 0x5a, - 0x33, 0xbd, 0xf1, 0x47, 0x5f, 0x09, 0x3e, 0xdf, 0xb7, 0xae, 0xcf, 0xff, 0x02, 0x00, 0x00, 0xff, - 0xff, 0x89, 0xf8, 0x21, 0xa7, 0x5f, 0x03, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/genproto/googleapis/cloud/ml/v1beta1/prediction_service.pb.go b/vendor/google.golang.org/genproto/googleapis/cloud/ml/v1beta1/prediction_service.pb.go deleted file mode 100644 index 7d6a8ada9..000000000 --- a/vendor/google.golang.org/genproto/googleapis/cloud/ml/v1beta1/prediction_service.pb.go +++ /dev/null @@ -1,343 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: google/cloud/ml/v1beta1/prediction_service.proto - -package ml - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "google.golang.org/genproto/googleapis/api/annotations" -import google_api3 "google.golang.org/genproto/googleapis/api/httpbody" - -import ( - context "golang.org/x/net/context" - grpc "google.golang.org/grpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// Request for predictions to be issued against a trained model. -// -// The body of the request is a single JSON object with a single top-level -// field: -// -//
-//
instances
-//
A JSON array containing values representing the instances to use for -// prediction.
-//
-// -// The structure of each element of the instances list is determined by your -// model's input definition. Instances can include named inputs or can contain -// only unlabeled values. -// -// Not all data includes named inputs. Some instances will be simple -// JSON values (boolean, number, or string). However, instances are often lists -// of simple values, or complex nested lists. Here are some examples of request -// bodies: -// -// CSV data with each row encoded as a string value: -//
-// {"instances": ["1.0,true,\\"x\\"", "-2.0,false,\\"y\\""]}
-// 
-// Plain text: -//
-// {"instances": ["the quick brown fox", "la bruja le dio"]}
-// 
-// Sentences encoded as lists of words (vectors of strings): -//
-// {
-//   "instances": [
-//     ["the","quick","brown"],
-//     ["la","bruja","le"],
-//     ...
-//   ]
-// }
-// 
-// Floating point scalar values: -//
-// {"instances": [0.0, 1.1, 2.2]}
-// 
-// Vectors of integers: -//
-// {
-//   "instances": [
-//     [0, 1, 2],
-//     [3, 4, 5],
-//     ...
-//   ]
-// }
-// 
-// Tensors (in this case, two-dimensional tensors): -//
-// {
-//   "instances": [
-//     [
-//       [0, 1, 2],
-//       [3, 4, 5]
-//     ],
-//     ...
-//   ]
-// }
-// 
-// Images can be represented different ways. In this encoding scheme the first -// two dimensions represent the rows and columns of the image, and the third -// contains lists (vectors) of the R, G, and B values for each pixel. -//
-// {
-//   "instances": [
-//     [
-//       [
-//         [138, 30, 66],
-//         [130, 20, 56],
-//         ...
-//       ],
-//       [
-//         [126, 38, 61],
-//         [122, 24, 57],
-//         ...
-//       ],
-//       ...
-//     ],
-//     ...
-//   ]
-// }
-// 
-// JSON strings must be encoded as UTF-8. To send binary data, you must -// base64-encode the data and mark it as binary. To mark a JSON string -// as binary, replace it with a JSON object with a single attribute named `b64`: -//
{"b64": "..."} 
-// For example: -// -// Two Serialized tf.Examples (fake data, for illustrative purposes only): -//
-// {"instances": [{"b64": "X5ad6u"}, {"b64": "IA9j4nx"}]}
-// 
-// Two JPEG image byte strings (fake data, for illustrative purposes only): -//
-// {"instances": [{"b64": "ASa8asdf"}, {"b64": "JLK7ljk3"}]}
-// 
-// If your data includes named references, format each instance as a JSON object -// with the named references as the keys: -// -// JSON input data to be preprocessed: -//
-// {
-//   "instances": [
-//     {
-//       "a": 1.0,
-//       "b": true,
-//       "c": "x"
-//     },
-//     {
-//       "a": -2.0,
-//       "b": false,
-//       "c": "y"
-//     }
-//   ]
-// }
-// 
-// Some models have an underlying TensorFlow graph that accepts multiple input -// tensors. In this case, you should use the names of JSON name/value pairs to -// identify the input tensors, as shown in the following exmaples: -// -// For a graph with input tensor aliases "tag" (string) and "image" -// (base64-encoded string): -//
-// {
-//   "instances": [
-//     {
-//       "tag": "beach",
-//       "image": {"b64": "ASa8asdf"}
-//     },
-//     {
-//       "tag": "car",
-//       "image": {"b64": "JLK7ljk3"}
-//     }
-//   ]
-// }
-// 
-// For a graph with input tensor aliases "tag" (string) and "image" -// (3-dimensional array of 8-bit ints): -//
-// {
-//   "instances": [
-//     {
-//       "tag": "beach",
-//       "image": [
-//         [
-//           [138, 30, 66],
-//           [130, 20, 56],
-//           ...
-//         ],
-//         [
-//           [126, 38, 61],
-//           [122, 24, 57],
-//           ...
-//         ],
-//         ...
-//       ]
-//     },
-//     {
-//       "tag": "car",
-//       "image": [
-//         [
-//           [255, 0, 102],
-//           [255, 0, 97],
-//           ...
-//         ],
-//         [
-//           [254, 1, 101],
-//           [254, 2, 93],
-//           ...
-//         ],
-//         ...
-//       ]
-//     },
-//     ...
-//   ]
-// }
-// 
-// If the call is successful, the response body will contain one prediction -// entry per instance in the request body. If prediction fails for any -// instance, the response body will contain no predictions and will contian -// a single error entry instead. -type PredictRequest struct { - // Required. The resource name of a model or a version. - // - // Authorization: requires `Viewer` role on the parent project. - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - // - // Required. The prediction request body. - HttpBody *google_api3.HttpBody `protobuf:"bytes,2,opt,name=http_body,json=httpBody" json:"http_body,omitempty"` -} - -func (m *PredictRequest) Reset() { *m = PredictRequest{} } -func (m *PredictRequest) String() string { return proto.CompactTextString(m) } -func (*PredictRequest) ProtoMessage() {} -func (*PredictRequest) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{0} } - -func (m *PredictRequest) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *PredictRequest) GetHttpBody() *google_api3.HttpBody { - if m != nil { - return m.HttpBody - } - return nil -} - -func init() { - proto.RegisterType((*PredictRequest)(nil), "google.cloud.ml.v1beta1.PredictRequest") -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// Client API for OnlinePredictionService service - -type OnlinePredictionServiceClient interface { - // Performs prediction on the data in the request. - // - // **** REMOVE FROM GENERATED DOCUMENTATION - Predict(ctx context.Context, in *PredictRequest, opts ...grpc.CallOption) (*google_api3.HttpBody, error) -} - -type onlinePredictionServiceClient struct { - cc *grpc.ClientConn -} - -func NewOnlinePredictionServiceClient(cc *grpc.ClientConn) OnlinePredictionServiceClient { - return &onlinePredictionServiceClient{cc} -} - -func (c *onlinePredictionServiceClient) Predict(ctx context.Context, in *PredictRequest, opts ...grpc.CallOption) (*google_api3.HttpBody, error) { - out := new(google_api3.HttpBody) - err := grpc.Invoke(ctx, "/google.cloud.ml.v1beta1.OnlinePredictionService/Predict", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Server API for OnlinePredictionService service - -type OnlinePredictionServiceServer interface { - // Performs prediction on the data in the request. - // - // **** REMOVE FROM GENERATED DOCUMENTATION - Predict(context.Context, *PredictRequest) (*google_api3.HttpBody, error) -} - -func RegisterOnlinePredictionServiceServer(s *grpc.Server, srv OnlinePredictionServiceServer) { - s.RegisterService(&_OnlinePredictionService_serviceDesc, srv) -} - -func _OnlinePredictionService_Predict_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PredictRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(OnlinePredictionServiceServer).Predict(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/google.cloud.ml.v1beta1.OnlinePredictionService/Predict", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(OnlinePredictionServiceServer).Predict(ctx, req.(*PredictRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _OnlinePredictionService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "google.cloud.ml.v1beta1.OnlinePredictionService", - HandlerType: (*OnlinePredictionServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Predict", - Handler: _OnlinePredictionService_Predict_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "google/cloud/ml/v1beta1/prediction_service.proto", -} - -func init() { proto.RegisterFile("google/cloud/ml/v1beta1/prediction_service.proto", fileDescriptor3) } - -var fileDescriptor3 = []byte{ - // 312 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0x4d, 0x4a, 0x03, 0x31, - 0x14, 0xc7, 0x49, 0x11, 0xb5, 0x11, 0x5c, 0x04, 0xb1, 0xb5, 0x08, 0x96, 0xba, 0xb0, 0x74, 0x91, - 0xd8, 0xba, 0xb2, 0xe2, 0xa6, 0x2b, 0x77, 0x0e, 0x75, 0x21, 0xb8, 0x29, 0xe9, 0x4c, 0x48, 0x23, - 0x99, 0xbc, 0x38, 0x93, 0x16, 0x8b, 0xb8, 0xf1, 0x0a, 0x3d, 0x9a, 0x57, 0xf0, 0x20, 0x92, 0x49, - 0x28, 0xca, 0xe8, 0xee, 0x31, 0x6f, 0x7e, 0xef, 0xff, 0x11, 0x7c, 0x29, 0x01, 0xa4, 0x16, 0x2c, - 0xd5, 0xb0, 0xcc, 0x58, 0xae, 0xd9, 0x6a, 0x38, 0x17, 0x8e, 0x0f, 0x99, 0x2d, 0x44, 0xa6, 0x52, - 0xa7, 0xc0, 0xcc, 0x4a, 0x51, 0xac, 0x54, 0x2a, 0xa8, 0x2d, 0xc0, 0x01, 0x69, 0x05, 0x82, 0x56, - 0x04, 0xcd, 0x35, 0x8d, 0x44, 0xe7, 0x34, 0x9e, 0xe2, 0x56, 0x31, 0x6e, 0x0c, 0x38, 0xee, 0xe9, - 0x32, 0x60, 0x9d, 0x93, 0x1f, 0xdb, 0x85, 0x73, 0x76, 0x0e, 0xd9, 0x3a, 0xac, 0x7a, 0x8f, 0xf8, - 0x30, 0x09, 0x6a, 0x53, 0xf1, 0xb2, 0x14, 0xa5, 0x23, 0x04, 0xef, 0x18, 0x9e, 0x8b, 0x36, 0xea, - 0xa2, 0x7e, 0x73, 0x5a, 0xcd, 0x64, 0x88, 0x9b, 0x9e, 0x9b, 0x79, 0xb0, 0xdd, 0xe8, 0xa2, 0xfe, - 0xc1, 0xe8, 0x88, 0x46, 0x2f, 0xdc, 0x2a, 0x7a, 0xe7, 0x9c, 0x9d, 0x40, 0xb6, 0x9e, 0xee, 0x2f, - 0xe2, 0x34, 0xda, 0x20, 0xdc, 0xba, 0x37, 0x5a, 0x19, 0x91, 0x6c, 0xd3, 0x3c, 0x84, 0x30, 0xe4, - 0x15, 0xef, 0xc5, 0x8f, 0xe4, 0x82, 0xfe, 0x13, 0x89, 0xfe, 0xb6, 0xd5, 0xf9, 0x53, 0xaf, 0x47, - 0x3f, 0x3e, 0xbf, 0x36, 0x8d, 0x7e, 0xef, 0x7c, 0xdb, 0xdd, 0x9b, 0x37, 0x7c, 0x6b, 0x0b, 0x78, - 0x16, 0xa9, 0x2b, 0xd9, 0x60, 0xf0, 0x3e, 0x8e, 0x75, 0x8e, 0xd1, 0x60, 0xb2, 0xc2, 0x67, 0x29, - 0xe4, 0x35, 0x4d, 0x7f, 0x33, 0x1e, 0x98, 0x1c, 0xd7, 0xfc, 0x26, 0xbe, 0xa9, 0x04, 0x3d, 0x5d, - 0x47, 0x4c, 0x82, 0xe6, 0x46, 0x52, 0x28, 0x24, 0x93, 0xc2, 0x54, 0x3d, 0xb2, 0xb0, 0xe2, 0x56, - 0x95, 0xb5, 0xe7, 0xbc, 0xc9, 0xf5, 0x7c, 0xb7, 0xfa, 0xeb, 0xea, 0x3b, 0x00, 0x00, 0xff, 0xff, - 0x00, 0x26, 0x25, 0x67, 0xf3, 0x01, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/genproto/googleapis/cloud/ml/v1beta1/project_service.pb.go b/vendor/google.golang.org/genproto/googleapis/cloud/ml/v1beta1/project_service.pb.go deleted file mode 100644 index cdf5bbc57..000000000 --- a/vendor/google.golang.org/genproto/googleapis/cloud/ml/v1beta1/project_service.pb.go +++ /dev/null @@ -1,178 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: google/cloud/ml/v1beta1/project_service.proto - -package ml - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "google.golang.org/genproto/googleapis/api/annotations" - -import ( - context "golang.org/x/net/context" - grpc "google.golang.org/grpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// Requests service account information associated with a project. -type GetConfigRequest struct { - // Required. The project name. - // - // Authorization: requires `Viewer` role on the specified project. - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` -} - -func (m *GetConfigRequest) Reset() { *m = GetConfigRequest{} } -func (m *GetConfigRequest) String() string { return proto.CompactTextString(m) } -func (*GetConfigRequest) ProtoMessage() {} -func (*GetConfigRequest) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{0} } - -func (m *GetConfigRequest) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -// Returns service account information associated with a project. -type GetConfigResponse struct { - // The service account Cloud ML uses to access resources in the project. - ServiceAccount string `protobuf:"bytes,1,opt,name=service_account,json=serviceAccount" json:"service_account,omitempty"` - // The project number for `service_account`. - ServiceAccountProject int64 `protobuf:"varint,2,opt,name=service_account_project,json=serviceAccountProject" json:"service_account_project,omitempty"` -} - -func (m *GetConfigResponse) Reset() { *m = GetConfigResponse{} } -func (m *GetConfigResponse) String() string { return proto.CompactTextString(m) } -func (*GetConfigResponse) ProtoMessage() {} -func (*GetConfigResponse) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{1} } - -func (m *GetConfigResponse) GetServiceAccount() string { - if m != nil { - return m.ServiceAccount - } - return "" -} - -func (m *GetConfigResponse) GetServiceAccountProject() int64 { - if m != nil { - return m.ServiceAccountProject - } - return 0 -} - -func init() { - proto.RegisterType((*GetConfigRequest)(nil), "google.cloud.ml.v1beta1.GetConfigRequest") - proto.RegisterType((*GetConfigResponse)(nil), "google.cloud.ml.v1beta1.GetConfigResponse") -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// Client API for ProjectManagementService service - -type ProjectManagementServiceClient interface { - // Get the service account information associated with your project. You need - // this information in order to grant the service account persmissions for - // the Google Cloud Storage location where you put your model training code - // for training the model with Google Cloud Machine Learning. - GetConfig(ctx context.Context, in *GetConfigRequest, opts ...grpc.CallOption) (*GetConfigResponse, error) -} - -type projectManagementServiceClient struct { - cc *grpc.ClientConn -} - -func NewProjectManagementServiceClient(cc *grpc.ClientConn) ProjectManagementServiceClient { - return &projectManagementServiceClient{cc} -} - -func (c *projectManagementServiceClient) GetConfig(ctx context.Context, in *GetConfigRequest, opts ...grpc.CallOption) (*GetConfigResponse, error) { - out := new(GetConfigResponse) - err := grpc.Invoke(ctx, "/google.cloud.ml.v1beta1.ProjectManagementService/GetConfig", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Server API for ProjectManagementService service - -type ProjectManagementServiceServer interface { - // Get the service account information associated with your project. You need - // this information in order to grant the service account persmissions for - // the Google Cloud Storage location where you put your model training code - // for training the model with Google Cloud Machine Learning. - GetConfig(context.Context, *GetConfigRequest) (*GetConfigResponse, error) -} - -func RegisterProjectManagementServiceServer(s *grpc.Server, srv ProjectManagementServiceServer) { - s.RegisterService(&_ProjectManagementService_serviceDesc, srv) -} - -func _ProjectManagementService_GetConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetConfigRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProjectManagementServiceServer).GetConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/google.cloud.ml.v1beta1.ProjectManagementService/GetConfig", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProjectManagementServiceServer).GetConfig(ctx, req.(*GetConfigRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _ProjectManagementService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "google.cloud.ml.v1beta1.ProjectManagementService", - HandlerType: (*ProjectManagementServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetConfig", - Handler: _ProjectManagementService_GetConfig_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "google/cloud/ml/v1beta1/project_service.proto", -} - -func init() { proto.RegisterFile("google/cloud/ml/v1beta1/project_service.proto", fileDescriptor4) } - -var fileDescriptor4 = []byte{ - // 327 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4f, 0x4a, 0x43, 0x31, - 0x10, 0xc6, 0x79, 0x55, 0x84, 0x66, 0xe1, 0x9f, 0x88, 0xb4, 0x14, 0xc1, 0x52, 0xa4, 0xd6, 0xa2, - 0x09, 0x55, 0x10, 0x54, 0x5c, 0x58, 0x17, 0xae, 0x84, 0x52, 0x77, 0x6e, 0x4a, 0xfa, 0x1c, 0xc3, - 0x93, 0x24, 0x13, 0x5f, 0xd2, 0x6e, 0xc4, 0x8d, 0x27, 0x10, 0x3c, 0x87, 0xa7, 0xf1, 0x0a, 0x1e, - 0x44, 0xfa, 0x92, 0x16, 0x6d, 0x11, 0xdc, 0x0d, 0x33, 0xbf, 0x6f, 0x32, 0xdf, 0x4c, 0xc8, 0xa1, - 0x44, 0x94, 0x0a, 0x78, 0xaa, 0x70, 0x74, 0xcf, 0xb5, 0xe2, 0xe3, 0xce, 0x10, 0xbc, 0xe8, 0x70, - 0x9b, 0xe3, 0x23, 0xa4, 0x7e, 0xe0, 0x20, 0x1f,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0x69, 0xd4, - 0x48, 0x54, 0xc2, 0x48, 0x86, 0xb9, 0xe4, 0x12, 0x4c, 0x71, 0x23, 0x1e, 0x4a, 0xc2, 0x66, 0x6e, - 0xe1, 0x33, 0x9c, 0x6b, 0x35, 0x5c, 0x29, 0xa8, 0xe3, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x76, - 0x59, 0xc4, 0x91, 0x31, 0x02, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1/cloud_speech.pb.go b/vendor/google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1/cloud_speech.pb.go index 1a65d2eb4..7b82cffab 100644 --- a/vendor/google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1/cloud_speech.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1/cloud_speech.pb.go @@ -1,11 +1,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: google/cloud/speech/v1_1beta1/cloud_speech.proto +// source: google/cloud/speech/v1p1beta1/cloud_speech.proto /* Package speech is a generated protocol buffer package. It is generated from these files: - google/cloud/speech/v1_1beta1/cloud_speech.proto + google/cloud/speech/v1p1beta1/cloud_speech.proto It has these top-level messages: RecognizeRequest @@ -13,7 +13,6 @@ It has these top-level messages: StreamingRecognizeRequest StreamingRecognitionConfig RecognitionConfig - RecognitionMetadata SpeechContext RecognitionAudio RecognizeResponse @@ -32,6 +31,7 @@ import fmt "fmt" import math "math" import _ "google.golang.org/genproto/googleapis/api/annotations" import google_longrunning "google.golang.org/genproto/googleapis/longrunning" +import _ "github.com/golang/protobuf/ptypes/any" import google_protobuf3 "github.com/golang/protobuf/ptypes/duration" import google_protobuf4 "github.com/golang/protobuf/ptypes/timestamp" import google_rpc "google.golang.org/genproto/googleapis/rpc/status" @@ -52,20 +52,29 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package -// Audio encoding of the data sent in the audio message. All encodings support -// only 1 channel (mono) audio. Only `FLAC` includes a header that describes -// the bytes of audio that follow the header. The other encodings are raw -// audio bytes with no header. +// The encoding of the audio data sent in the request. +// +// All encodings support only 1 channel (mono) audio. +// +// If you send a `FLAC` or `WAV` audio file format in the request, +// then if you specify an encoding in `AudioEncoding`, it must match the +// encoding described in the audio header. If it does not match, then the +// request returns an +// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] error code. You can request +// recognition for `WAV` files that contain either `LINEAR16` or `MULAW` +// encoded audio. +// For audio file formats other than `FLAC` or `WAV`, you must +// specify the audio encoding in your `RecognitionConfig`. // // For best results, the audio source should be captured and transmitted using -// a lossless encoding (`FLAC` or `LINEAR16`). Recognition accuracy may be -// reduced if lossy codecs, which include the other codecs listed in -// this section, are used to capture or transmit the audio, particularly if -// background noise is present. +// a lossless encoding (`FLAC` or `LINEAR16`). The accuracy of the speech +// recognition can be reduced if lossy codecs, which include the other codecs +// listed in this section, are used to capture or transmit the audio, +// particularly if background noise is present. type RecognitionConfig_AudioEncoding int32 const ( - // Not specified. Will return result [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. + // Not specified. RecognitionConfig_ENCODING_UNSPECIFIED RecognitionConfig_AudioEncoding = 0 // Uncompressed 16-bit signed little-endian samples (Linear PCM). RecognitionConfig_LINEAR16 RecognitionConfig_AudioEncoding = 1 @@ -84,7 +93,7 @@ const ( RecognitionConfig_AMR_WB RecognitionConfig_AudioEncoding = 5 // Opus encoded audio frames in Ogg container // ([OggOpus](https://wiki.xiph.org/OggOpus)). - // `sample_rate_hertz` must be 16000. + // `sample_rate_hertz` must be one of 8000, 12000, 16000, 24000, or 48000. RecognitionConfig_OGG_OPUS RecognitionConfig_AudioEncoding = 6 // Although the use of lossy encodings is not recommended, if a very low // bitrate encoding is required, `OGG_OPUS` is highly preferred over @@ -130,215 +139,6 @@ func (RecognitionConfig_AudioEncoding) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{4, 0} } -// Use case categories that the audio recognition request can be described -// by. -type RecognitionMetadata_InteractionType int32 - -const ( - // Use case is either unknown or is something other than one of the other - // values below. - RecognitionMetadata_INTERACTION_TYPE_UNSPECIFIED RecognitionMetadata_InteractionType = 0 - // Multiple people in a conversation or discussion. For example in a - // meeting with two or more people actively participating. Typically - // all the primary people speaking would be in the same room (if not, - // see PHONE_CALL) - RecognitionMetadata_DISCUSSION RecognitionMetadata_InteractionType = 1 - // One or more persons lecturing or presenting to others, mostly - // uninterrupted. - RecognitionMetadata_PRESENTATION RecognitionMetadata_InteractionType = 2 - // A phone-call or video-conference in which two or more people, who are - // not in the same room, are actively participating. - RecognitionMetadata_PHONE_CALL RecognitionMetadata_InteractionType = 3 - // A recorded message intended for another person to listen to. - RecognitionMetadata_VOICEMAIL RecognitionMetadata_InteractionType = 4 - // Professionally produced audio (eg. TV Show, Podcast). - RecognitionMetadata_PROFESSIONALLY_PRODUCED RecognitionMetadata_InteractionType = 5 - // Transcribe spoken questions and queries into text. - RecognitionMetadata_VOICE_SEARCH RecognitionMetadata_InteractionType = 6 - // Transcribe voice commands, such as for controlling a device. - RecognitionMetadata_VOICE_COMMAND RecognitionMetadata_InteractionType = 7 - // Transcribe speech to text to create a written document, such as a - // text-message, email or report. - RecognitionMetadata_DICTATION RecognitionMetadata_InteractionType = 8 -) - -var RecognitionMetadata_InteractionType_name = map[int32]string{ - 0: "INTERACTION_TYPE_UNSPECIFIED", - 1: "DISCUSSION", - 2: "PRESENTATION", - 3: "PHONE_CALL", - 4: "VOICEMAIL", - 5: "PROFESSIONALLY_PRODUCED", - 6: "VOICE_SEARCH", - 7: "VOICE_COMMAND", - 8: "DICTATION", -} -var RecognitionMetadata_InteractionType_value = map[string]int32{ - "INTERACTION_TYPE_UNSPECIFIED": 0, - "DISCUSSION": 1, - "PRESENTATION": 2, - "PHONE_CALL": 3, - "VOICEMAIL": 4, - "PROFESSIONALLY_PRODUCED": 5, - "VOICE_SEARCH": 6, - "VOICE_COMMAND": 7, - "DICTATION": 8, -} - -func (x RecognitionMetadata_InteractionType) String() string { - return proto.EnumName(RecognitionMetadata_InteractionType_name, int32(x)) -} -func (RecognitionMetadata_InteractionType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor0, []int{5, 0} -} - -// Enumerates the types of capture settings describing an audio file. -type RecognitionMetadata_MicrophoneDistance int32 - -const ( - // Audio type is not known. - RecognitionMetadata_MICROPHONE_DISTANCE_UNSPECIFIED RecognitionMetadata_MicrophoneDistance = 0 - // The audio was captured from a closely placed microphone. Eg. phone, - // dictaphone, or handheld microphone. Generally if there speaker is within - // 1 meter of the microphone. - RecognitionMetadata_NEARFIELD RecognitionMetadata_MicrophoneDistance = 1 - // The speaker if within 3 meters of the microphone. - RecognitionMetadata_MIDFIELD RecognitionMetadata_MicrophoneDistance = 2 - // The speaker is more than 3 meters away from the microphone. - RecognitionMetadata_FARFIELD RecognitionMetadata_MicrophoneDistance = 3 -) - -var RecognitionMetadata_MicrophoneDistance_name = map[int32]string{ - 0: "MICROPHONE_DISTANCE_UNSPECIFIED", - 1: "NEARFIELD", - 2: "MIDFIELD", - 3: "FARFIELD", -} -var RecognitionMetadata_MicrophoneDistance_value = map[string]int32{ - "MICROPHONE_DISTANCE_UNSPECIFIED": 0, - "NEARFIELD": 1, - "MIDFIELD": 2, - "FARFIELD": 3, -} - -func (x RecognitionMetadata_MicrophoneDistance) String() string { - return proto.EnumName(RecognitionMetadata_MicrophoneDistance_name, int32(x)) -} -func (RecognitionMetadata_MicrophoneDistance) EnumDescriptor() ([]byte, []int) { - return fileDescriptor0, []int{5, 1} -} - -// The original media the speech was recorded on. -type RecognitionMetadata_OriginalMediaType int32 - -const ( - // Unknown original media type. - RecognitionMetadata_ORIGINAL_MEDIA_TYPE_UNSPECIFIED RecognitionMetadata_OriginalMediaType = 0 - // The speech data is an audio recording. - RecognitionMetadata_AUDIO RecognitionMetadata_OriginalMediaType = 1 - // The speech data originally recorded on a video. - RecognitionMetadata_VIDEO RecognitionMetadata_OriginalMediaType = 2 -) - -var RecognitionMetadata_OriginalMediaType_name = map[int32]string{ - 0: "ORIGINAL_MEDIA_TYPE_UNSPECIFIED", - 1: "AUDIO", - 2: "VIDEO", -} -var RecognitionMetadata_OriginalMediaType_value = map[string]int32{ - "ORIGINAL_MEDIA_TYPE_UNSPECIFIED": 0, - "AUDIO": 1, - "VIDEO": 2, -} - -func (x RecognitionMetadata_OriginalMediaType) String() string { - return proto.EnumName(RecognitionMetadata_OriginalMediaType_name, int32(x)) -} -func (RecognitionMetadata_OriginalMediaType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor0, []int{5, 2} -} - -// How many speakers expected in the speech to be recognized. -type RecognitionMetadata_NumberOfSpeakers int32 - -const ( - // Unknown number of persons speaking. - RecognitionMetadata_NUMBER_OF_SPEAKERS_UNSPECIFIED RecognitionMetadata_NumberOfSpeakers = 0 - // Only one person is the prominent speaker (ignore background voices). - RecognitionMetadata_ONE_SPEAKER RecognitionMetadata_NumberOfSpeakers = 1 - // Two people are the prominent speakers (transcript should focus - // on the two most prominent speakers). - RecognitionMetadata_TWO_SPEAKERS RecognitionMetadata_NumberOfSpeakers = 2 - // Transcribe all voices. - RecognitionMetadata_MULTIPLE_SPEAKERS RecognitionMetadata_NumberOfSpeakers = 3 -) - -var RecognitionMetadata_NumberOfSpeakers_name = map[int32]string{ - 0: "NUMBER_OF_SPEAKERS_UNSPECIFIED", - 1: "ONE_SPEAKER", - 2: "TWO_SPEAKERS", - 3: "MULTIPLE_SPEAKERS", -} -var RecognitionMetadata_NumberOfSpeakers_value = map[string]int32{ - "NUMBER_OF_SPEAKERS_UNSPECIFIED": 0, - "ONE_SPEAKER": 1, - "TWO_SPEAKERS": 2, - "MULTIPLE_SPEAKERS": 3, -} - -func (x RecognitionMetadata_NumberOfSpeakers) String() string { - return proto.EnumName(RecognitionMetadata_NumberOfSpeakers_name, int32(x)) -} -func (RecognitionMetadata_NumberOfSpeakers) EnumDescriptor() ([]byte, []int) { - return fileDescriptor0, []int{5, 3} -} - -// The type of device the speech was recorded with. -type RecognitionMetadata_RecordingDeviceType int32 - -const ( - // The recording device is unknown. - RecognitionMetadata_RECORDING_DEVICE_TYPE_UNSPECIFIED RecognitionMetadata_RecordingDeviceType = 0 - // Speech was recorded on a smartphone. - RecognitionMetadata_SMARTPHONE RecognitionMetadata_RecordingDeviceType = 1 - // Speech was recorded using a personal computer or tablet. - RecognitionMetadata_PC RecognitionMetadata_RecordingDeviceType = 2 - // Speech was recorded over a phone line. - RecognitionMetadata_PHONE_LINE RecognitionMetadata_RecordingDeviceType = 3 - // Speech was recorded in a vehicle. - RecognitionMetadata_VEHICLE RecognitionMetadata_RecordingDeviceType = 4 - // Speech was recorded outdoors. - RecognitionMetadata_OTHER_OUTDOOR_DEVICE RecognitionMetadata_RecordingDeviceType = 5 - // Speech was recorded indoors. - RecognitionMetadata_OTHER_INDOOR_DEVICE RecognitionMetadata_RecordingDeviceType = 6 -) - -var RecognitionMetadata_RecordingDeviceType_name = map[int32]string{ - 0: "RECORDING_DEVICE_TYPE_UNSPECIFIED", - 1: "SMARTPHONE", - 2: "PC", - 3: "PHONE_LINE", - 4: "VEHICLE", - 5: "OTHER_OUTDOOR_DEVICE", - 6: "OTHER_INDOOR_DEVICE", -} -var RecognitionMetadata_RecordingDeviceType_value = map[string]int32{ - "RECORDING_DEVICE_TYPE_UNSPECIFIED": 0, - "SMARTPHONE": 1, - "PC": 2, - "PHONE_LINE": 3, - "VEHICLE": 4, - "OTHER_OUTDOOR_DEVICE": 5, - "OTHER_INDOOR_DEVICE": 6, -} - -func (x RecognitionMetadata_RecordingDeviceType) String() string { - return proto.EnumName(RecognitionMetadata_RecordingDeviceType_name, int32(x)) -} -func (RecognitionMetadata_RecordingDeviceType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor0, []int{5, 4} -} - // Indicates the type of speech event. type StreamingRecognizeResponse_SpeechEventType int32 @@ -368,7 +168,7 @@ func (x StreamingRecognizeResponse_SpeechEventType) String() string { return proto.EnumName(StreamingRecognizeResponse_SpeechEventType_name, int32(x)) } func (StreamingRecognizeResponse_SpeechEventType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor0, []int{11, 0} + return fileDescriptor0, []int{10, 0} } // The top-level message sent by the client for the `Recognize` method. @@ -639,16 +439,11 @@ type RecognitionConfig struct { // `false`, no word-level time offset information is returned. The default is // `false`. EnableWordTimeOffsets bool `protobuf:"varint,8,opt,name=enable_word_time_offsets,json=enableWordTimeOffsets" json:"enable_word_time_offsets,omitempty"` - // *Optional* If 'true', adds punctuation to recognition result hypotheses. - // This feature is only available in select languages. Setting this for - // requests in other languages has no effect at all. - // The default 'false' value does not add punctuation to result hypotheses. - // NOTE: "This is currently offered as an experimental service, complimentary - // to all users. In the future this may be exclusively available as a - // premium feature." - EnableAutomaticPunctuation bool `protobuf:"varint,11,opt,name=enable_automatic_punctuation,json=enableAutomaticPunctuation" json:"enable_automatic_punctuation,omitempty"` - // *Optional* Metadata regarding this request. - Metadata *RecognitionMetadata `protobuf:"bytes,9,opt,name=metadata" json:"metadata,omitempty"` + // *Optional* Which model to select for the given request. Select the model + // best suited to your domain to get best results. If a model is not + // explicitly specified, then we auto-select a model based on the parameters + // in the RecognitionConfig. + Model string `protobuf:"bytes,13,opt,name=model" json:"model,omitempty"` } func (m *RecognitionConfig) Reset() { *m = RecognitionConfig{} } @@ -705,126 +500,9 @@ func (m *RecognitionConfig) GetEnableWordTimeOffsets() bool { return false } -func (m *RecognitionConfig) GetEnableAutomaticPunctuation() bool { +func (m *RecognitionConfig) GetModel() string { if m != nil { - return m.EnableAutomaticPunctuation - } - return false -} - -func (m *RecognitionConfig) GetMetadata() *RecognitionMetadata { - if m != nil { - return m.Metadata - } - return nil -} - -// Description of audio data to be recognized. -type RecognitionMetadata struct { - // The use case most closely describing the audio content to be recognized. - InteractionType RecognitionMetadata_InteractionType `protobuf:"varint,1,opt,name=interaction_type,json=interactionType,enum=google.cloud.speech.v1p1beta1.RecognitionMetadata_InteractionType" json:"interaction_type,omitempty"` - // The industry vertical to which this speech recognition request most - // closely applies. This is most indicative of the topics contained - // in the audio. Use the 6-digit NAICS code to identify the industry - // vertical - see https://www.naics.com/search/. - IndustryNaicsCodeOfAudio uint32 `protobuf:"varint,3,opt,name=industry_naics_code_of_audio,json=industryNaicsCodeOfAudio" json:"industry_naics_code_of_audio,omitempty"` - // The audio type that most closely describes the audio being recognized. - MicrophoneDistance RecognitionMetadata_MicrophoneDistance `protobuf:"varint,4,opt,name=microphone_distance,json=microphoneDistance,enum=google.cloud.speech.v1p1beta1.RecognitionMetadata_MicrophoneDistance" json:"microphone_distance,omitempty"` - // The original media the speech was recorded on. - OriginalMediaType RecognitionMetadata_OriginalMediaType `protobuf:"varint,5,opt,name=original_media_type,json=originalMediaType,enum=google.cloud.speech.v1p1beta1.RecognitionMetadata_OriginalMediaType" json:"original_media_type,omitempty"` - // How many people are speaking prominently in the audio and expected to be - // recognized. - NumberOfSpeakers RecognitionMetadata_NumberOfSpeakers `protobuf:"varint,6,opt,name=number_of_speakers,json=numberOfSpeakers,enum=google.cloud.speech.v1p1beta1.RecognitionMetadata_NumberOfSpeakers" json:"number_of_speakers,omitempty"` - // The type of device the speech was recorded with. - RecordingDeviceType RecognitionMetadata_RecordingDeviceType `protobuf:"varint,7,opt,name=recording_device_type,json=recordingDeviceType,enum=google.cloud.speech.v1p1beta1.RecognitionMetadata_RecordingDeviceType" json:"recording_device_type,omitempty"` - // The device used to make the recording. Examples 'Nexus 5X' or - // 'Polycom SoundStation IP 6000' or 'POTS' or 'VoIP' or - // 'Cardioid Microphone'. - RecordingDeviceName string `protobuf:"bytes,8,opt,name=recording_device_name,json=recordingDeviceName" json:"recording_device_name,omitempty"` - // Mime type of the original audio file. For example `audio/m4a`, - // `audio/x-alaw-basic`, `audio/mp3`, `audio/3gpp`. - // A list of possible audio mime types is maintained at - // http://www.iana.org/assignments/media-types/media-types.xhtml#audio - OriginalMimeType string `protobuf:"bytes,9,opt,name=original_mime_type,json=originalMimeType" json:"original_mime_type,omitempty"` - // Obfuscated (privacy-protected) ID of the user, to identify number of - // unique users using the service. - ObfuscatedId int64 `protobuf:"varint,10,opt,name=obfuscated_id,json=obfuscatedId" json:"obfuscated_id,omitempty"` - // Description of the content. Eg. "Recordings of federal supreme court - // hearings from 2012". - AudioTopic string `protobuf:"bytes,11,opt,name=audio_topic,json=audioTopic" json:"audio_topic,omitempty"` -} - -func (m *RecognitionMetadata) Reset() { *m = RecognitionMetadata{} } -func (m *RecognitionMetadata) String() string { return proto.CompactTextString(m) } -func (*RecognitionMetadata) ProtoMessage() {} -func (*RecognitionMetadata) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } - -func (m *RecognitionMetadata) GetInteractionType() RecognitionMetadata_InteractionType { - if m != nil { - return m.InteractionType - } - return RecognitionMetadata_INTERACTION_TYPE_UNSPECIFIED -} - -func (m *RecognitionMetadata) GetIndustryNaicsCodeOfAudio() uint32 { - if m != nil { - return m.IndustryNaicsCodeOfAudio - } - return 0 -} - -func (m *RecognitionMetadata) GetMicrophoneDistance() RecognitionMetadata_MicrophoneDistance { - if m != nil { - return m.MicrophoneDistance - } - return RecognitionMetadata_MICROPHONE_DISTANCE_UNSPECIFIED -} - -func (m *RecognitionMetadata) GetOriginalMediaType() RecognitionMetadata_OriginalMediaType { - if m != nil { - return m.OriginalMediaType - } - return RecognitionMetadata_ORIGINAL_MEDIA_TYPE_UNSPECIFIED -} - -func (m *RecognitionMetadata) GetNumberOfSpeakers() RecognitionMetadata_NumberOfSpeakers { - if m != nil { - return m.NumberOfSpeakers - } - return RecognitionMetadata_NUMBER_OF_SPEAKERS_UNSPECIFIED -} - -func (m *RecognitionMetadata) GetRecordingDeviceType() RecognitionMetadata_RecordingDeviceType { - if m != nil { - return m.RecordingDeviceType - } - return RecognitionMetadata_RECORDING_DEVICE_TYPE_UNSPECIFIED -} - -func (m *RecognitionMetadata) GetRecordingDeviceName() string { - if m != nil { - return m.RecordingDeviceName - } - return "" -} - -func (m *RecognitionMetadata) GetOriginalMimeType() string { - if m != nil { - return m.OriginalMimeType - } - return "" -} - -func (m *RecognitionMetadata) GetObfuscatedId() int64 { - if m != nil { - return m.ObfuscatedId - } - return 0 -} - -func (m *RecognitionMetadata) GetAudioTopic() string { - if m != nil { - return m.AudioTopic + return m.Model } return "" } @@ -844,7 +522,7 @@ type SpeechContext struct { func (m *SpeechContext) Reset() { *m = SpeechContext{} } func (m *SpeechContext) String() string { return proto.CompactTextString(m) } func (*SpeechContext) ProtoMessage() {} -func (*SpeechContext) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } +func (*SpeechContext) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } func (m *SpeechContext) GetPhrases() []string { if m != nil { @@ -858,7 +536,8 @@ func (m *SpeechContext) GetPhrases() []string { // returns [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. See // [audio limits](https://cloud.google.com/speech/limits#content). type RecognitionAudio struct { - // The audio source, which is either inline content or a GCS uri. + // The audio source, which is either inline content or a Google Cloud + // Storage uri. // // Types that are valid to be assigned to AudioSource: // *RecognitionAudio_Content @@ -869,7 +548,7 @@ type RecognitionAudio struct { func (m *RecognitionAudio) Reset() { *m = RecognitionAudio{} } func (m *RecognitionAudio) String() string { return proto.CompactTextString(m) } func (*RecognitionAudio) ProtoMessage() {} -func (*RecognitionAudio) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } +func (*RecognitionAudio) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } type isRecognitionAudio_AudioSource interface { isRecognitionAudio_AudioSource() @@ -984,7 +663,7 @@ type RecognizeResponse struct { func (m *RecognizeResponse) Reset() { *m = RecognizeResponse{} } func (m *RecognizeResponse) String() string { return proto.CompactTextString(m) } func (*RecognizeResponse) ProtoMessage() {} -func (*RecognizeResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } +func (*RecognizeResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } func (m *RecognizeResponse) GetResults() []*SpeechRecognitionResult { if m != nil { @@ -1007,7 +686,7 @@ type LongRunningRecognizeResponse struct { func (m *LongRunningRecognizeResponse) Reset() { *m = LongRunningRecognizeResponse{} } func (m *LongRunningRecognizeResponse) String() string { return proto.CompactTextString(m) } func (*LongRunningRecognizeResponse) ProtoMessage() {} -func (*LongRunningRecognizeResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } +func (*LongRunningRecognizeResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } func (m *LongRunningRecognizeResponse) GetResults() []*SpeechRecognitionResult { if m != nil { @@ -1032,7 +711,7 @@ type LongRunningRecognizeMetadata struct { func (m *LongRunningRecognizeMetadata) Reset() { *m = LongRunningRecognizeMetadata{} } func (m *LongRunningRecognizeMetadata) String() string { return proto.CompactTextString(m) } func (*LongRunningRecognizeMetadata) ProtoMessage() {} -func (*LongRunningRecognizeMetadata) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } +func (*LongRunningRecognizeMetadata) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } func (m *LongRunningRecognizeMetadata) GetProgressPercent() int32 { if m != nil { @@ -1110,8 +789,8 @@ type StreamingRecognizeResponse struct { Error *google_rpc.Status `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"` // *Output-only* This repeated list contains zero or more results that // correspond to consecutive portions of the audio currently being processed. - // It contains zero or more `is_final=false` results followed by zero or one - // `is_final=true` result (the newly settled portion). + // It contains zero or one `is_final=true` result (the newly settled portion), + // followed by zero or more `is_final=false` results (the interim results). Results []*StreamingRecognitionResult `protobuf:"bytes,2,rep,name=results" json:"results,omitempty"` // *Output-only* Indicates the type of speech event. SpeechEventType StreamingRecognizeResponse_SpeechEventType `protobuf:"varint,4,opt,name=speech_event_type,json=speechEventType,enum=google.cloud.speech.v1p1beta1.StreamingRecognizeResponse_SpeechEventType" json:"speech_event_type,omitempty"` @@ -1120,7 +799,7 @@ type StreamingRecognizeResponse struct { func (m *StreamingRecognizeResponse) Reset() { *m = StreamingRecognizeResponse{} } func (m *StreamingRecognizeResponse) String() string { return proto.CompactTextString(m) } func (*StreamingRecognizeResponse) ProtoMessage() {} -func (*StreamingRecognizeResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } +func (*StreamingRecognizeResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } func (m *StreamingRecognizeResponse) GetError() *google_rpc.Status { if m != nil { @@ -1148,6 +827,8 @@ func (m *StreamingRecognizeResponse) GetSpeechEventType() StreamingRecognizeResp type StreamingRecognitionResult struct { // *Output-only* May contain one or more recognition hypotheses (up to the // maximum specified in `max_alternatives`). + // These alternatives are ordered in terms of accuracy, with the top (first) + // alternative being the most probable, as ranked by the recognizer. Alternatives []*SpeechRecognitionAlternative `protobuf:"bytes,1,rep,name=alternatives" json:"alternatives,omitempty"` // *Output-only* If `false`, this `StreamingRecognitionResult` represents an // interim result that may change. If `true`, this is the final time the @@ -1166,7 +847,7 @@ type StreamingRecognitionResult struct { func (m *StreamingRecognitionResult) Reset() { *m = StreamingRecognitionResult{} } func (m *StreamingRecognitionResult) String() string { return proto.CompactTextString(m) } func (*StreamingRecognitionResult) ProtoMessage() {} -func (*StreamingRecognitionResult) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } +func (*StreamingRecognitionResult) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } func (m *StreamingRecognitionResult) GetAlternatives() []*SpeechRecognitionAlternative { if m != nil { @@ -1201,7 +882,7 @@ type SpeechRecognitionResult struct { func (m *SpeechRecognitionResult) Reset() { *m = SpeechRecognitionResult{} } func (m *SpeechRecognitionResult) String() string { return proto.CompactTextString(m) } func (*SpeechRecognitionResult) ProtoMessage() {} -func (*SpeechRecognitionResult) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } +func (*SpeechRecognitionResult) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } func (m *SpeechRecognitionResult) GetAlternatives() []*SpeechRecognitionAlternative { if m != nil { @@ -1216,10 +897,10 @@ type SpeechRecognitionAlternative struct { Transcript string `protobuf:"bytes,1,opt,name=transcript" json:"transcript,omitempty"` // *Output-only* The confidence estimate between 0.0 and 1.0. A higher number // indicates an estimated greater likelihood that the recognized words are - // correct. This field is typically provided only for the top hypothesis, and - // only for `is_final=true` results. Clients should not rely on the - // `confidence` field as it is not guaranteed to be accurate, or even set, in - // any of the results. + // correct. This field is set only for the top alternative of a non-streaming + // result or, of a streaming result where `is_final=true`. + // This field is not guaranteed to be accurate and users should not rely on it + // to be always provided. // The default of 0.0 is a sentinel value indicating `confidence` was not set. Confidence float32 `protobuf:"fixed32,2,opt,name=confidence" json:"confidence,omitempty"` // *Output-only* A list of word-specific information for each recognized word. @@ -1229,7 +910,7 @@ type SpeechRecognitionAlternative struct { func (m *SpeechRecognitionAlternative) Reset() { *m = SpeechRecognitionAlternative{} } func (m *SpeechRecognitionAlternative) String() string { return proto.CompactTextString(m) } func (*SpeechRecognitionAlternative) ProtoMessage() {} -func (*SpeechRecognitionAlternative) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } +func (*SpeechRecognitionAlternative) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } func (m *SpeechRecognitionAlternative) GetTranscript() string { if m != nil { @@ -1252,9 +933,7 @@ func (m *SpeechRecognitionAlternative) GetWords() []*WordInfo { return nil } -// Word-specific information for recognized words. Word information is only -// included in the response when certain request parameters are set, such -// as `enable_word_time_offsets`. +// Word-specific information for recognized words. type WordInfo struct { // *Output-only* Time offset relative to the beginning of the audio, // and corresponding to the start of the spoken word. @@ -1277,7 +956,7 @@ type WordInfo struct { func (m *WordInfo) Reset() { *m = WordInfo{} } func (m *WordInfo) String() string { return proto.CompactTextString(m) } func (*WordInfo) ProtoMessage() {} -func (*WordInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } +func (*WordInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } func (m *WordInfo) GetStartTime() *google_protobuf3.Duration { if m != nil { @@ -1306,7 +985,6 @@ func init() { proto.RegisterType((*StreamingRecognizeRequest)(nil), "google.cloud.speech.v1p1beta1.StreamingRecognizeRequest") proto.RegisterType((*StreamingRecognitionConfig)(nil), "google.cloud.speech.v1p1beta1.StreamingRecognitionConfig") proto.RegisterType((*RecognitionConfig)(nil), "google.cloud.speech.v1p1beta1.RecognitionConfig") - proto.RegisterType((*RecognitionMetadata)(nil), "google.cloud.speech.v1p1beta1.RecognitionMetadata") proto.RegisterType((*SpeechContext)(nil), "google.cloud.speech.v1p1beta1.SpeechContext") proto.RegisterType((*RecognitionAudio)(nil), "google.cloud.speech.v1p1beta1.RecognitionAudio") proto.RegisterType((*RecognizeResponse)(nil), "google.cloud.speech.v1p1beta1.RecognizeResponse") @@ -1318,11 +996,6 @@ func init() { proto.RegisterType((*SpeechRecognitionAlternative)(nil), "google.cloud.speech.v1p1beta1.SpeechRecognitionAlternative") proto.RegisterType((*WordInfo)(nil), "google.cloud.speech.v1p1beta1.WordInfo") proto.RegisterEnum("google.cloud.speech.v1p1beta1.RecognitionConfig_AudioEncoding", RecognitionConfig_AudioEncoding_name, RecognitionConfig_AudioEncoding_value) - proto.RegisterEnum("google.cloud.speech.v1p1beta1.RecognitionMetadata_InteractionType", RecognitionMetadata_InteractionType_name, RecognitionMetadata_InteractionType_value) - proto.RegisterEnum("google.cloud.speech.v1p1beta1.RecognitionMetadata_MicrophoneDistance", RecognitionMetadata_MicrophoneDistance_name, RecognitionMetadata_MicrophoneDistance_value) - proto.RegisterEnum("google.cloud.speech.v1p1beta1.RecognitionMetadata_OriginalMediaType", RecognitionMetadata_OriginalMediaType_name, RecognitionMetadata_OriginalMediaType_value) - proto.RegisterEnum("google.cloud.speech.v1p1beta1.RecognitionMetadata_NumberOfSpeakers", RecognitionMetadata_NumberOfSpeakers_name, RecognitionMetadata_NumberOfSpeakers_value) - proto.RegisterEnum("google.cloud.speech.v1p1beta1.RecognitionMetadata_RecordingDeviceType", RecognitionMetadata_RecordingDeviceType_name, RecognitionMetadata_RecordingDeviceType_value) proto.RegisterEnum("google.cloud.speech.v1p1beta1.StreamingRecognizeResponse_SpeechEventType", StreamingRecognizeResponse_SpeechEventType_name, StreamingRecognizeResponse_SpeechEventType_value) } @@ -1510,137 +1183,95 @@ var _Speech_serviceDesc = grpc.ServiceDesc{ ClientStreams: true, }, }, - Metadata: "google/cloud/speech/v1_1beta1/cloud_speech.proto", + Metadata: "google/cloud/speech/v1p1beta1/cloud_speech.proto", } -func init() { proto.RegisterFile("google/cloud/speech/v1_1beta1/cloud_speech.proto", fileDescriptor0) } +func init() { proto.RegisterFile("google/cloud/speech/v1p1beta1/cloud_speech.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 2005 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0xbf, 0x73, 0xdb, 0xc8, - 0xf5, 0x37, 0x48, 0x51, 0x12, 0x9f, 0x7e, 0x41, 0xab, 0xf3, 0xd7, 0xb4, 0xac, 0xb3, 0x75, 0xf0, - 0xdc, 0x9d, 0xee, 0xbe, 0x37, 0xa4, 0xa5, 0x64, 0x2e, 0x67, 0xdf, 0xe4, 0x26, 0x10, 0x00, 0x99, - 0x98, 0x90, 0x00, 0x67, 0x49, 0xda, 0xf1, 0x35, 0x3b, 0x10, 0xb8, 0xa4, 0x31, 0x21, 0x01, 0x1c, - 0xb0, 0x50, 0x6c, 0x97, 0x69, 0x33, 0x49, 0x93, 0x99, 0x74, 0xa9, 0x72, 0x75, 0xca, 0x14, 0x69, - 0x52, 0x25, 0x45, 0xda, 0x34, 0x29, 0xaf, 0xc8, 0x1f, 0x91, 0x32, 0xb3, 0xbb, 0x00, 0x45, 0x91, - 0xb2, 0x2d, 0x6b, 0x72, 0x33, 0xe9, 0x88, 0xcf, 0xbe, 0xf7, 0x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, 0xc3, 0x45, 0x78, 0x16, 0xbb, 0x43, 0x11, 0x4a, 0x74, 0x06, 0x3b, 0x93, 0xc0, 0x4f, - 0xa2, 0xf8, 0x79, 0x14, 0x52, 0x32, 0x08, 0x52, 0x26, 0xae, 0xf9, 0x92, 0xf0, 0xd8, 0xba, 0x86, - 0xc7, 0xed, 0x29, 0x9b, 0x99, 0x93, 0x61, 0x34, 0x59, 0xc0, 0x10, 0x83, 0x9d, 0x28, 0x09, 0x46, - 0x41, 0xe8, 0x8d, 0xc9, 0x84, 0x0e, 0x02, 0x4f, 0x46, 0xaa, 0x22, 0xec, 0x9a, 0xd7, 0xb0, 0xeb, - 0xe6, 0x6c, 0x6d, 0x4e, 0x26, 0x62, 0xb5, 0x1d, 0xcd, 0x43, 0xe8, 0x1b, 0x40, 0x61, 0x36, 0x39, - 0xa5, 0x09, 0x0f, 0x50, 0x1a, 0x53, 0xef, 0xe7, 0x34, 0xe1, 0xf7, 0x8c, 0x1b, 0x35, 0xae, 0x61, - 0xd4, 0x11, 0x64, 0xee, 0xb0, 0x9b, 0x53, 0x61, 0x35, 0x9c, 0x43, 0xd0, 0x2b, 0xb8, 0x99, 0x50, - 0x3f, 0x4a, 0x78, 0xc2, 0x92, 0x01, 0x3d, 0x0b, 0x7c, 0x2a, 0xb7, 0xba, 0x22, 0xac, 0x9e, 0x5c, - 0xc3, 0x2a, 0x2e, 0xf8, 0x4c, 0x41, 0x27, 0x36, 0xbb, 0x93, 0x2c, 0x82, 0xe8, 0xe8, 0x12, 0xdb, - 0xa1, 0x37, 0xa1, 0xe2, 0xe6, 0x57, 0x17, 0x74, 0x1c, 0x6f, 0x42, 0xd1, 0x67, 0x80, 0xce, 0x0f, - 0x86, 0x57, 0x0b, 0xe1, 0x6c, 0x55, 0x28, 0xa8, 0xd3, 0x88, 0x06, 0x13, 0x69, 0xe1, 0x3e, 0x6c, - 0x44, 0xa7, 0xc3, 0x2c, 0xf5, 0x3d, 0x46, 0x07, 0x24, 0x18, 0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xba, 0xf8, 0xf0, 0xda, 0xb5, 0xea, 0x40, 0x79, 0xa0, - 0x1c, 0xbf, 0x82, 0x0f, 0xfc, 0x68, 0xf2, 0x66, 0x8e, 0xe3, 0x35, 0x79, 0xf8, 0x1d, 0x9e, 0x35, - 0x1d, 0xe5, 0x6b, 0x23, 0x97, 0x1e, 0x45, 0x7c, 0xf8, 0xaf, 0x47, 0xc9, 0xa8, 0x31, 0xa2, 0xa1, - 0xc8, 0xa9, 0x86, 0x5c, 0xf2, 0xe2, 0x20, 0x9d, 0x7f, 0x8b, 0xcc, 0xc9, 0xbe, 0x94, 0xc0, 0xbf, - 0x15, 0xe5, 0x74, 0x59, 0xa8, 0xfc, 0xe0, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xdf, 0x32, 0x25, - 0x1e, 0xbd, 0x14, 0x00, 0x00, + // 1343 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0xbb, 0x6f, 0x5b, 0xb7, + 0x1a, 0xf7, 0xb1, 0x2c, 0x3f, 0xbe, 0xf8, 0x21, 0xf3, 0xe6, 0xde, 0xc8, 0x8a, 0x93, 0xeb, 0x7b, + 0x82, 0x9b, 0x38, 0x69, 0x21, 0xd9, 0x6e, 0x91, 0xe6, 0x81, 0x16, 0x90, 0xe5, 0x63, 0x4b, 0x80, + 0x2d, 0x1b, 0xb4, 0x5c, 0xb7, 0x59, 0x08, 0x5a, 0xa2, 0x94, 0x03, 0x48, 0xe4, 0x29, 0x49, 0xa5, + 0xb1, 0xc7, 0xae, 0x45, 0xbb, 0x14, 0xe8, 0xd6, 0xa9, 0x9d, 0x3b, 0x76, 0xe8, 0xd2, 0x3d, 0x6b, + 0x97, 0x8e, 0x1d, 0xfa, 0x47, 0x74, 0x2c, 0x48, 0x9e, 0x23, 0x4b, 0x7e, 0x27, 0x68, 0x80, 0x6e, + 0x87, 0xbf, 0xef, 0x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 0xfe, 0xdd, 0x2f, 0x7e, + 0xfd, 0xe3, 0x9b, 0xe1, 0x05, 0xff, 0x66, 0xdf, 0xaf, 0x88, 0x33, 0x7b, 0x22, 0x13, 0xe5, 0x27, + 0xde, 0x03, 0xf4, 0x83, 0x07, 0xd7, 0xcf, 0xea, 0x9c, 0xe8, 0xc9, 0x25, 0x5b, 0x5e, 0xf0, 0x86, + 0xce, 0xdd, 0x4a, 0x6c, 0xfb, 0x7e, 0x52, 0xf2, 0xdb, 0xc9, 0x4f, 0x8a, 0xbf, 0x6c, 0xb9, 0xbd, + 0xe3, 0xdf, 0x3d, 0xcd, 0xad, 0xcf, 0x60, 0x80, 0xe6, 0x57, 0x1e, 0xa0, 0xd3, 0xed, 0x03, 0x3d, + 0x7a, 0x83, 0x8e, 0xe3, 0x28, 0x3e, 0x7e, 0xe3, 0x5e, 0xb5, 0xe8, 0x2d, 0x79, 0xab, 0x47, 0xf0, + 0xbf, 0xba, 0xe8, 0x5c, 0xec, 0x63, 0xf5, 0x9a, 0xbb, 0xfc, 0x1d, 0x93, 0x35, 0x3b, 0xde, 0xb3, + 0x52, 0xac, 0xdd, 0x12, 0xe6, 0x75, 0x96, 0x17, 0xb2, 0x55, 0x68, 0x31, 0x6e, 0x73, 0xaa, 0xe0, + 0x44, 0x34, 0x0a, 0xd5, 0x39, 0xff, 0x91, 0x4f, 0x1d, 0xf0, 0xa7, 0xe7, 0x1d, 0x8c, 0x5a, 0x93, + 0xf7, 0xfe, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x2f, 0x7b, 0x24, 0x37, 0x79, 0x0e, 0x00, 0x00, } diff --git a/vendor/google.golang.org/genproto/googleapis/devtools/cloudbuild/v1/cloudbuild.pb.go b/vendor/google.golang.org/genproto/googleapis/devtools/cloudbuild/v1/cloudbuild.pb.go index 0b62fd0d8..5f0a7ad72 100644 --- a/vendor/google.golang.org/genproto/googleapis/devtools/cloudbuild/v1/cloudbuild.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/devtools/cloudbuild/v1/cloudbuild.pb.go @@ -66,25 +66,25 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package -// Possible status of a build. +// Possible status of a build or build step. type Build_Status int32 const ( // Status of the build is unknown. Build_STATUS_UNKNOWN Build_Status = 0 - // Build is queued; work has not yet begun. + // Build or step is queued; work has not yet begun. Build_QUEUED Build_Status = 1 - // Build is being executed. + // Build or step is being executed. Build_WORKING Build_Status = 2 - // Build finished successfully. + // Build or step finished successfully. Build_SUCCESS Build_Status = 3 - // Build failed to complete successfully. + // Build or step failed to complete successfully. Build_FAILURE Build_Status = 4 - // Build failed due to an internal cause. + // Build or step failed due to an internal cause. Build_INTERNAL_ERROR Build_Status = 5 - // Build took longer than was allowed. + // Build or step took longer than was allowed. Build_TIMEOUT Build_Status = 6 - // Build was canceled by a user. + // Build or step was canceled by a user. Build_CANCELLED Build_Status = 7 ) @@ -374,6 +374,9 @@ type RepoSource struct { // *RepoSource_CommitSha Revision isRepoSource_Revision `protobuf_oneof:"revision"` // Directory, relative to the source root, in which to run the build. + // + // This must be a relative path. If a step's dir is specified and is an + // absolute path, this value is ignored for that step's execution. Dir string `protobuf:"bytes,7,opt,name=dir" json:"dir,omitempty"` } @@ -663,6 +666,7 @@ type BuiltImage struct { // Docker Registry 2.0 digest. Digest string `protobuf:"bytes,3,opt,name=digest" json:"digest,omitempty"` // Stores timing information for pushing the specified image. + // @OutputOnly PushTiming *TimeSpan `protobuf:"bytes,4,opt,name=push_timing,json=pushTiming" json:"push_timing,omitempty"` } @@ -723,8 +727,16 @@ type BuildStep struct { // an entrypoint, the first element in args will be used as the entrypoint, // and the remainder will be used as arguments. Args []string `protobuf:"bytes,3,rep,name=args" json:"args,omitempty"` - // Working directory (relative to project source root) to use when running - // this operation's container. + // Working directory to use when running this step's container. + // + // If this value is a relative path, it is relative to the build's working + // directory. If this value is absolute, it may be outside the build's working + // directory, in which case the contents of the path may not be persisted + // across build step executions, unless a volume for that path is specified. + // + // If the build specifies a RepoSource with dir and a step with a dir which + // specifies an absolute path, the RepoSource dir is ignored for the step's + // execution. Dir string `protobuf:"bytes,4,opt,name=dir" json:"dir,omitempty"` // Optional unique identifier for this build step, used in wait_for to // reference this build step as a dependency. @@ -751,7 +763,17 @@ type BuildStep struct { // of a mis-configured build request. Volumes []*Volume `protobuf:"bytes,9,rep,name=volumes" json:"volumes,omitempty"` // Stores timing information for executing this build step. + // @OutputOnly Timing *TimeSpan `protobuf:"bytes,10,opt,name=timing" json:"timing,omitempty"` + // Time limit for executing this build step. If not defined, the step has no + // time limit and will be allowed to continue to run until either it completes + // or the build itself times out. + Timeout *google_protobuf4.Duration `protobuf:"bytes,11,opt,name=timeout" json:"timeout,omitempty"` + // Status of the build step. At this time, build step status is only updated + // on build completion; step status is not updated in real-time as the build + // progresses. + // @OutputOnly + Status Build_Status `protobuf:"varint,12,opt,name=status,enum=google.devtools.cloudbuild.v1.Build_Status" json:"status,omitempty"` } func (m *BuildStep) Reset() { *m = BuildStep{} } @@ -829,6 +851,20 @@ func (m *BuildStep) GetTiming() *TimeSpan { return nil } +func (m *BuildStep) GetTimeout() *google_protobuf4.Duration { + if m != nil { + return m.Timeout + } + return nil +} + +func (m *BuildStep) GetStatus() Build_Status { + if m != nil { + return m.Status + } + return Build_STATUS_UNKNOWN +} + // Volume describes a Docker container volume which is mounted into build steps // in order to persist files across build step execution. type Volume struct { @@ -969,7 +1005,7 @@ type Build struct { BuildTriggerId string `protobuf:"bytes,22,opt,name=build_trigger_id,json=buildTriggerId" json:"build_trigger_id,omitempty"` // Special options for this build. Options *BuildOptions `protobuf:"bytes,23,opt,name=options" json:"options,omitempty"` - // URL to logs for this build in Google Cloud Logging. + // URL to logs for this build in Google Cloud Console. // @OutputOnly LogUrl string `protobuf:"bytes,25,opt,name=log_url,json=logUrl" json:"log_url,omitempty"` // Substitutions data for Build resource. @@ -978,13 +1014,15 @@ type Build struct { Tags []string `protobuf:"bytes,31,rep,name=tags" json:"tags,omitempty"` // Secrets to decrypt using Cloud KMS. Secrets []*Secret `protobuf:"bytes,32,rep,name=secrets" json:"secrets,omitempty"` - // Stores timing information for phases of the build. - // Valid keys are: - // - BUILD: time to execute all build steps - // - PUSH: time to push all specified images. - // - FETCHSOURCE: time to fetch source. + // Stores timing information for phases of the build. Valid keys are: + // + // * BUILD: time to execute all build steps + // * PUSH: time to push all specified images. + // * FETCHSOURCE: time to fetch source. + // // If the build does not specify source, or does not specify images, // these keys will not be included. + // @OutputOnly Timing map[string]*TimeSpan `protobuf:"bytes,33,rep,name=timing" json:"timing,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` } @@ -1807,7 +1845,7 @@ type BuildOptions struct { SourceProvenanceHash []Hash_HashType `protobuf:"varint,1,rep,packed,name=source_provenance_hash,json=sourceProvenanceHash,enum=google.devtools.cloudbuild.v1.Hash_HashType" json:"source_provenance_hash,omitempty"` // Requested verifiability options. RequestedVerifyOption BuildOptions_VerifyOption `protobuf:"varint,2,opt,name=requested_verify_option,json=requestedVerifyOption,enum=google.devtools.cloudbuild.v1.BuildOptions_VerifyOption" json:"requested_verify_option,omitempty"` - // GCE VM size to run the build on. + // Compute Engine machine type on which to run the build. MachineType BuildOptions_MachineType `protobuf:"varint,3,opt,name=machine_type,json=machineType,enum=google.devtools.cloudbuild.v1.BuildOptions_MachineType" json:"machine_type,omitempty"` // Requested disk size for the VM that runs the build. Note that this is *NOT* // "disk free"; some of the space will be used by the operating system and @@ -2427,166 +2465,167 @@ var _CloudBuild_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("google/devtools/cloudbuild/v1/cloudbuild.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 2567 bytes of a gzipped FileDescriptorProto + // 2585 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x5a, 0x5b, 0x73, 0xdb, 0xc6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, 0x10, 0x5d, 0x87, 0x4b, 0x6c, 0x5a, 0x0f, - 0x09, 0xf6, 0x75, 0xa1, 0x8d, 0x87, 0x67, 0xb5, 0x1b, 0x45, 0x97, 0x41, 0x42, 0xf5, 0x17, 0x65, - 0x58, 0x64, 0x11, 0x17, 0x11, 0x92, 0x46, 0x11, 0x9a, 0xec, 0x02, 0xf2, 0x74, 0x17, 0xa8, 0x43, - 0x3e, 0x24, 0x06, 0x19, 0x84, 0xec, 0x20, 0x2b, 0xdb, 0x6f, 0xcc, 0x61, 0xa7, 0x59, 0x6d, 0x31, - 0x88, 0x26, 0xa0, 0xe8, 0x25, 0x58, 0xe6, 0x9f, 0x74, 0x13, 0x13, 0xc3, 0x76, 0x14, 0x85, 0x6d, - 0xb3, 0xc4, 0x85, 0xfb, 0x4c, 0x86, 0x3e, 0x98, 0xea, 0xa0, 0x49, 0xf1, 0x9c, 0xec, 0x9e, 0xe8, - 0x43, 0x58, 0xa4, 0x7e, 0x08, 0x95, 0x32, 0xf3, 0xe7, 0xe6, 0x3c, 0x76, 0x52, 0x07, 0x69, 0x1c, - 0x86, 0xee, 0x42, 0x21, 0xe0, 0xb1, 0x11, 0xf9, 0xf0, 0x6a, 0x62, 0xb1, 0xb3, 0xd5, 0x5a, 0x04, - 0x43, 0xef, 0x41, 0xb9, 0x17, 0x60, 0x83, 0x60, 0x5a, 0xa1, 0x58, 0xc9, 0x33, 0x2d, 0x95, 0x48, - 0x4b, 0x74, 0xad, 0xb1, 0x3c, 0x62, 0xd7, 0x9a, 0x06, 0x7c, 0x39, 0x15, 0xa0, 0x77, 0x01, 0x42, - 0x62, 0x04, 0x84, 0x63, 0x0b, 0x89, 0xd8, 0x12, 0x5b, 0xcd, 0xa0, 0xef, 0x41, 0xf9, 0xa1, 0xed, - 0xda, 0xbc, 0x33, 0x60, 0xa5, 0x98, 0xbc, 0x2f, 0x5f, 0xce, 0xc0, 0x37, 0xa0, 0x40, 0x51, 0xde, - 0x80, 0x28, 0x4b, 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, 0x36, 0xb6, 0xf6, 0xf9, 0x98, 0x03, 0x3c, 0x42, 0x7f, 0x89, 0xbf, 0xbc, 0x22, - 0x46, 0x84, 0x6e, 0xcd, 0x5b, 0x10, 0x53, 0xf4, 0xab, 0x72, 0x3b, 0x3d, 0x50, 0x14, 0xd4, 0x75, - 0x76, 0x82, 0x97, 0xd1, 0x1c, 0xee, 0xa6, 0x25, 0x85, 0x66, 0x09, 0x56, 0x62, 0x62, 0x3c, 0x91, - 0x93, 0x55, 0xd6, 0x66, 0xde, 0x0a, 0x8d, 0xbe, 0x4f, 0x2e, 0x22, 0xb7, 0x5e, 0x4f, 0xed, 0xd6, - 0x2f, 0x25, 0x40, 0xb3, 0x34, 0x2d, 0xd1, 0xc2, 0x27, 0x32, 0xbb, 0x74, 0xd9, 0x70, 0x97, 0x99, - 0xbd, 0xb3, 0x9d, 0xd6, 0xec, 0x71, 0x1e, 0xff, 0x51, 0x82, 0xd5, 0xa9, 0x9f, 0xb6, 0x13, 0xf3, - 0xf8, 0xf1, 0x3f, 0x85, 0x27, 0x35, 0x87, 0x3a, 0xb3, 0xf5, 0x03, 0xf5, 0x46, 0x5a, 0x5b, 0x83, - 0x81, 0xbb, 0x23, 0x7e, 0xaf, 0xd9, 0x3b, 0x07, 0xa5, 0xe7, 0xf5, 0xa3, 0x8d, 0x26, 0xcc, 0xba, - 0x2f, 0x7d, 0x72, 0x28, 0xe4, 0x96, 0xe7, 0x18, 0xae, 0x55, 0xf5, 0x02, 0xab, 0x66, 0x61, 0x97, - 0x85, 0xba, 0xc6, 0xa7, 0x0c, 0xdf, 0x0e, 0x9f, 0xf0, 0xdf, 0x23, 0xde, 0x1b, 0x8f, 0xfe, 0x90, - 0xc9, 0x1e, 0xd6, 0xf7, 0xba, 0x79, 0x86, 0xbc, 0xf1, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x17, - 0x08, 0x55, 0x51, 0x57, 0x21, 0x00, 0x00, + 0xf5, 0x17, 0x48, 0x8a, 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0x34, 0xe9, 0x7f, 0x1b, + 0x8a, 0xd8, 0x35, 0x39, 0x63, 0x26, 0x91, 0xb1, 0x80, 0x5d, 0x93, 0x8e, 0xd4, 0x36, 0xac, 0x89, + 0xa0, 0x16, 0xc0, 0xf4, 0x01, 0x26, 0x86, 0x69, 0x10, 0x03, 0xed, 0xc0, 0x22, 0x33, 0x9c, 0x50, + 0xe3, 0xe5, 0x79, 0xe2, 0x40, 0xe3, 0x2c, 0xea, 0xef, 0xb3, 0x20, 0x4f, 0x67, 0x2a, 0x32, 0xe1, + 0xb9, 0x00, 0x87, 0x9e, 0x33, 0xc4, 0xf4, 0xae, 0x9a, 0x40, 0x89, 0xd9, 0xf4, 0x28, 0x51, 0x7b, + 0x36, 0x12, 0x36, 0x89, 0xd3, 0xbf, 0x09, 0x57, 0x47, 0xbb, 0xc4, 0x41, 0x63, 0x3e, 0x6d, 0x27, + 0x80, 0x22, 0x31, 0x31, 0x94, 0xfe, 0x1d, 0x5a, 0x63, 0x1d, 0xac, 0x9f, 0x19, 0xe1, 0x19, 0x0e, + 0x95, 0x1c, 0xcb, 0x90, 0x7b, 0x29, 0x4b, 0x56, 0xf5, 0xc0, 0x76, 0xf0, 0x11, 0x93, 0xc0, 0x13, + 0x06, 0x1e, 0x8f, 0x08, 0x95, 0x33, 0x58, 0x9d, 0x9a, 0xbe, 0x24, 0xec, 0xef, 0x4d, 0x86, 0x7d, + 0xd2, 0xa1, 0xc6, 0x02, 0xe3, 0x81, 0xdf, 0x04, 0x18, 0x4f, 0xa0, 0xfb, 0x50, 0x1a, 0x9d, 0x4c, + 0x91, 0xd8, 0xb9, 0x5e, 0x4a, 0x10, 0x4b, 0x39, 0xb5, 0x62, 0xa4, 0xbb, 0xfa, 0x23, 0x09, 0x72, + 0xf4, 0x01, 0xdd, 0x87, 0x1c, 0xb9, 0xf0, 0x79, 0xf8, 0xae, 0x24, 0x3a, 0x95, 0xb2, 0xb0, 0x9f, + 0xf6, 0x85, 0x8f, 0x35, 0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, 0x79, 0xc6, 0x79, 0xeb, 0xdf, 0x01, 0x00, 0x00, 0xff, + 0xff, 0x8d, 0x04, 0xdb, 0x30, 0xd1, 0x21, 0x00, 0x00, } diff --git a/vendor/google.golang.org/genproto/googleapis/privacy/dlp/v2beta2/dlp.pb.go b/vendor/google.golang.org/genproto/googleapis/privacy/dlp/v2beta2/dlp.pb.go index 5a89152f2..fe6e1f454 100644 --- a/vendor/google.golang.org/genproto/googleapis/privacy/dlp/v2beta2/dlp.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/privacy/dlp/v2beta2/dlp.pb.go @@ -40,6 +40,8 @@ It has these top-level messages: AnalyzeDataSourceRiskDetails ValueFrequency Value + QuoteInfo + DateTime DeidentifyConfig PrimitiveTransformation TimePartConfig @@ -56,6 +58,7 @@ It has these top-level messages: TransientCryptoKey UnwrappedCryptoKey KmsWrappedCryptoKey + DateShiftConfig InfoTypeTransformations FieldTransformation RecordTransformations @@ -63,14 +66,23 @@ It has these top-level messages: RecordCondition TransformationOverview TransformationSummary + Schedule InspectTemplate DeidentifyTemplate + JobTrigger + Action CreateInspectTemplateRequest UpdateInspectTemplateRequest GetInspectTemplateRequest ListInspectTemplatesRequest ListInspectTemplatesResponse DeleteInspectTemplateRequest + CreateJobTriggerRequest + UpdateJobTriggerRequest + GetJobTriggerRequest + ListJobTriggersRequest + ListJobTriggersResponse + DeleteJobTriggerRequest InspectJobConfig DlpJob GetDlpJobRequest @@ -93,6 +105,7 @@ It has these top-level messages: CloudStorageOptions BigQueryOptions StorageConfig + BigQueryKey CloudStorageKey DatastoreKey Key @@ -106,13 +119,13 @@ import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" import _ "google.golang.org/genproto/googleapis/api/annotations" -import _ "github.com/golang/protobuf/ptypes/duration" +import google_protobuf2 "github.com/golang/protobuf/ptypes/duration" import google_protobuf3 "github.com/golang/protobuf/ptypes/empty" import google_protobuf4 "google.golang.org/genproto/protobuf/field_mask" import google_protobuf1 "github.com/golang/protobuf/ptypes/timestamp" import google_rpc "google.golang.org/genproto/googleapis/rpc/status" import google_type "google.golang.org/genproto/googleapis/type/date" -import _ "google.golang.org/genproto/googleapis/type/dayofweek" +import google_type1 "google.golang.org/genproto/googleapis/type/dayofweek" import google_type2 "google.golang.org/genproto/googleapis/type/timeofday" import ( @@ -232,6 +245,48 @@ func (x DlpJobType) String() string { } func (DlpJobType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } +// Predefined schemas for storing findings. +type OutputStorageConfig_OutputSchema int32 + +const ( + OutputStorageConfig_OUTPUT_SCHEMA_UNSPECIFIED OutputStorageConfig_OutputSchema = 0 + // Basic schema including only `info_type`, `quote`, `certainty`, and + // `timestamp`. + OutputStorageConfig_BASIC_COLUMNS OutputStorageConfig_OutputSchema = 1 + // Schema tailored to findings from scanning Google Cloud Storage. + OutputStorageConfig_GCS_COLUMNS OutputStorageConfig_OutputSchema = 2 + // Schema tailored to findings from scanning Google Datastore. + OutputStorageConfig_DATASTORE_COLUMNS OutputStorageConfig_OutputSchema = 3 + // Schema tailored to findings from scanning Google BigQuery. + OutputStorageConfig_BIG_QUERY_COLUMNS OutputStorageConfig_OutputSchema = 4 + // Schema containing all columns. + OutputStorageConfig_ALL_COLUMNS OutputStorageConfig_OutputSchema = 5 +) + +var OutputStorageConfig_OutputSchema_name = map[int32]string{ + 0: "OUTPUT_SCHEMA_UNSPECIFIED", + 1: "BASIC_COLUMNS", + 2: "GCS_COLUMNS", + 3: "DATASTORE_COLUMNS", + 4: "BIG_QUERY_COLUMNS", + 5: "ALL_COLUMNS", +} +var OutputStorageConfig_OutputSchema_value = map[string]int32{ + "OUTPUT_SCHEMA_UNSPECIFIED": 0, + "BASIC_COLUMNS": 1, + "GCS_COLUMNS": 2, + "DATASTORE_COLUMNS": 3, + "BIG_QUERY_COLUMNS": 4, + "ALL_COLUMNS": 5, +} + +func (x OutputStorageConfig_OutputSchema) String() string { + return proto.EnumName(OutputStorageConfig_OutputSchema_name, int32(x)) +} +func (OutputStorageConfig_OutputSchema) EnumDescriptor() ([]byte, []int) { + return fileDescriptor0, []int{19, 0} +} + type TimePartConfig_TimePart int32 const ( @@ -272,7 +327,7 @@ var TimePartConfig_TimePart_value = map[string]int32{ func (x TimePartConfig_TimePart) String() string { return proto.EnumName(TimePartConfig_TimePart_name, int32(x)) } -func (TimePartConfig_TimePart) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{33, 0} } +func (TimePartConfig_TimePart) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{35, 0} } type CharsToIgnore_CommonCharsToIgnore int32 @@ -311,7 +366,7 @@ func (x CharsToIgnore_CommonCharsToIgnore) String() string { return proto.EnumName(CharsToIgnore_CommonCharsToIgnore_name, int32(x)) } func (CharsToIgnore_CommonCharsToIgnore) EnumDescriptor() ([]byte, []int) { - return fileDescriptor0, []int{38, 0} + return fileDescriptor0, []int{40, 0} } // These are commonly used subsets of the alphabet that the FFX mode @@ -350,7 +405,7 @@ func (x CryptoReplaceFfxFpeConfig_FfxCommonNativeAlphabet) String() string { return proto.EnumName(CryptoReplaceFfxFpeConfig_FfxCommonNativeAlphabet_name, int32(x)) } func (CryptoReplaceFfxFpeConfig_FfxCommonNativeAlphabet) EnumDescriptor() ([]byte, []int) { - return fileDescriptor0, []int{42, 0} + return fileDescriptor0, []int{44, 0} } type RecordCondition_Expressions_LogicalOperator int32 @@ -373,7 +428,7 @@ func (x RecordCondition_Expressions_LogicalOperator) String() string { return proto.EnumName(RecordCondition_Expressions_LogicalOperator_name, int32(x)) } func (RecordCondition_Expressions_LogicalOperator) EnumDescriptor() ([]byte, []int) { - return fileDescriptor0, []int{51, 2, 0} + return fileDescriptor0, []int{54, 2, 0} } // Possible outcomes of transformations. @@ -400,8 +455,42 @@ func (x TransformationSummary_TransformationResultCode) String() string { return proto.EnumName(TransformationSummary_TransformationResultCode_name, int32(x)) } func (TransformationSummary_TransformationResultCode) EnumDescriptor() ([]byte, []int) { - return fileDescriptor0, []int{53, 0} + return fileDescriptor0, []int{56, 0} +} + +// Whether the trigger is currently active. If PAUSED or CANCELLED, no jobs +// will be created with this configuration. The service may automatically +// pause triggers experiencing frequent errors. To restart a job, set the +// status to HEALTHY after correcting user errors. +type JobTrigger_Status int32 + +const ( + JobTrigger_STATUS_UNSPECIFIED JobTrigger_Status = 0 + // Trigger is healthy. + JobTrigger_HEALTHY JobTrigger_Status = 1 + // Trigger is temporarily paused. + JobTrigger_PAUSED JobTrigger_Status = 2 + // Trigger is cancelled and can not be resumed. + JobTrigger_CANCELLED JobTrigger_Status = 3 +) + +var JobTrigger_Status_name = map[int32]string{ + 0: "STATUS_UNSPECIFIED", + 1: "HEALTHY", + 2: "PAUSED", + 3: "CANCELLED", } +var JobTrigger_Status_value = map[string]int32{ + "STATUS_UNSPECIFIED": 0, + "HEALTHY": 1, + "PAUSED": 2, + "CANCELLED": 3, +} + +func (x JobTrigger_Status) String() string { + return proto.EnumName(JobTrigger_Status_name, int32(x)) +} +func (JobTrigger_Status) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{60, 0} } type DlpJob_JobState int32 @@ -439,7 +528,7 @@ var DlpJob_JobState_value = map[string]int32{ func (x DlpJob_JobState) String() string { return proto.EnumName(DlpJob_JobState_name, int32(x)) } -func (DlpJob_JobState) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{63, 0} } +func (DlpJob_JobState) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{75, 0} } // Configuration description of the scanning process. // When used with redactContent only info_types and min_likelihood are currently @@ -814,7 +903,9 @@ func (m *InspectResult) GetFindingsTruncated() bool { type Finding struct { // The content that was found. Even if the content is not textual, it // may be converted to a textual representation here. - // Provided if requested by the `InspectConfig`. + // Provided if requested by the `InspectConfig` and the finding is + // less than or equal to 4096 bytes long. If the finding exceeds 4096 bytes + // in length, the quote may be omitted. Quote string `protobuf:"bytes,1,opt,name=quote" json:"quote,omitempty"` // The type of content that might have been found. // Provided if requested by the `InspectConfig`. @@ -825,6 +916,8 @@ type Finding struct { Location *Location `protobuf:"bytes,4,opt,name=location" json:"location,omitempty"` // Timestamp when finding was detected. CreateTime *google_protobuf1.Timestamp `protobuf:"bytes,6,opt,name=create_time,json=createTime" json:"create_time,omitempty"` + // InfoType-dependent details parsed from quote. + QuoteInfo *QuoteInfo `protobuf:"bytes,7,opt,name=quote_info,json=quoteInfo" json:"quote_info,omitempty"` } func (m *Finding) Reset() { *m = Finding{} } @@ -867,6 +960,13 @@ func (m *Finding) GetCreateTime() *google_protobuf1.Timestamp { return nil } +func (m *Finding) GetQuoteInfo() *QuoteInfo { + if m != nil { + return m.QuoteInfo + } + return nil +} + // Specifies the location of the finding. type Location struct { // Zero-based byte offsets delimiting the finding. @@ -1577,6 +1677,12 @@ type InspectDataSourceRequest struct { Parent string `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"` // A configuration for the job. JobConfig *InspectJobConfig `protobuf:"bytes,2,opt,name=job_config,json=jobConfig" json:"job_config,omitempty"` + // Optional job ID to use for the created job. If not provided, a job ID will + // automatically be generated. Must be unique within the project. The job ID + // can contain uppercase and lowercase letters, numbers, and hyphens; that is, + // it must match the regular expression: `[a-zA-Z\\d-]+`. The maximum length + // is 100 characters. Can be empty to allow the system to generate one. + JobId string `protobuf:"bytes,3,opt,name=job_id,json=jobId" json:"job_id,omitempty"` } func (m *InspectDataSourceRequest) Reset() { *m = InspectDataSourceRequest{} } @@ -1598,11 +1704,26 @@ func (m *InspectDataSourceRequest) GetJobConfig() *InspectJobConfig { return nil } +func (m *InspectDataSourceRequest) GetJobId() string { + if m != nil { + return m.JobId + } + return "" +} + // Cloud repository for storing output. type OutputStorageConfig struct { // Types that are valid to be assigned to Type: // *OutputStorageConfig_Table Type isOutputStorageConfig_Type `protobuf_oneof:"type"` + // Schema used for writing the findings. Columns are derived from the + // `Finding` object. If appending to an existing table, any columns from the + // predefined schema that are missing will be added. No columns in the + // existing table will be deleted. + // + // If unspecified, then all available columns will be used for a new table, + // and no changes will be made to an existing table. + OutputSchema OutputStorageConfig_OutputSchema `protobuf:"varint,3,opt,name=output_schema,json=outputSchema,enum=google.privacy.dlp.v2beta2.OutputStorageConfig_OutputSchema" json:"output_schema,omitempty"` } func (m *OutputStorageConfig) Reset() { *m = OutputStorageConfig{} } @@ -1634,6 +1755,13 @@ func (m *OutputStorageConfig) GetTable() *BigQueryTable { return nil } +func (m *OutputStorageConfig) GetOutputSchema() OutputStorageConfig_OutputSchema { + if m != nil { + return m.OutputSchema + } + return OutputStorageConfig_OUTPUT_SCHEMA_UNSPECIFIED +} + // XXX_OneofFuncs is for the internal use of the proto package. func (*OutputStorageConfig) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { return _OutputStorageConfig_OneofMarshaler, _OutputStorageConfig_OneofUnmarshaler, _OutputStorageConfig_OneofSizer, []interface{}{ @@ -1901,6 +2029,12 @@ type AnalyzeDataSourceRiskRequest struct { Parent string `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"` // Configuration for this risk analysis job. JobConfig *RiskAnalysisJobConfig `protobuf:"bytes,2,opt,name=job_config,json=jobConfig" json:"job_config,omitempty"` + // Optional job ID to use for the created job. If not provided, a job ID will + // automatically be generated. Must be unique within the project. The job ID + // can contain uppercase and lowercase letters, numbers, and hyphens; that is, + // it must match the regular expression: `[a-zA-Z\\d-]+`. The maximum length + // is 100 characters. Can be empty to allow the system to generate one. + JobId string `protobuf:"bytes,3,opt,name=job_id,json=jobId" json:"job_id,omitempty"` } func (m *AnalyzeDataSourceRiskRequest) Reset() { *m = AnalyzeDataSourceRiskRequest{} } @@ -1922,12 +2056,22 @@ func (m *AnalyzeDataSourceRiskRequest) GetJobConfig() *RiskAnalysisJobConfig { return nil } +func (m *AnalyzeDataSourceRiskRequest) GetJobId() string { + if m != nil { + return m.JobId + } + return "" +} + // Configuration for a risk analysis job. type RiskAnalysisJobConfig struct { // Privacy metric to compute. PrivacyMetric *PrivacyMetric `protobuf:"bytes,1,opt,name=privacy_metric,json=privacyMetric" json:"privacy_metric,omitempty"` // Input dataset to compute metrics over. SourceTable *BigQueryTable `protobuf:"bytes,2,opt,name=source_table,json=sourceTable" json:"source_table,omitempty"` + // Actions to execute at the completion of the job. Are executed in the order + // provided. + Actions []*Action `protobuf:"bytes,3,rep,name=actions" json:"actions,omitempty"` } func (m *RiskAnalysisJobConfig) Reset() { *m = RiskAnalysisJobConfig{} } @@ -1949,6 +2093,13 @@ func (m *RiskAnalysisJobConfig) GetSourceTable() *BigQueryTable { return nil } +func (m *RiskAnalysisJobConfig) GetActions() []*Action { + if m != nil { + return m.Actions + } + return nil +} + // Privacy metric to compute for reidentification risk analysis. type PrivacyMetric struct { // Types that are valid to be assigned to Type: @@ -3346,6 +3497,7 @@ type Value struct { // *Value_TimestampValue // *Value_TimeValue // *Value_DateValue + // *Value_DayOfWeekValue Type isValue_Type `protobuf_oneof:"type"` } @@ -3379,6 +3531,9 @@ type Value_TimeValue struct { type Value_DateValue struct { DateValue *google_type.Date `protobuf:"bytes,7,opt,name=date_value,json=dateValue,oneof"` } +type Value_DayOfWeekValue struct { + DayOfWeekValue google_type1.DayOfWeek `protobuf:"varint,8,opt,name=day_of_week_value,json=dayOfWeekValue,enum=google.type.DayOfWeek,oneof"` +} func (*Value_IntegerValue) isValue_Type() {} func (*Value_FloatValue) isValue_Type() {} @@ -3387,6 +3542,7 @@ func (*Value_BooleanValue) isValue_Type() {} func (*Value_TimestampValue) isValue_Type() {} func (*Value_TimeValue) isValue_Type() {} func (*Value_DateValue) isValue_Type() {} +func (*Value_DayOfWeekValue) isValue_Type() {} func (m *Value) GetType() isValue_Type { if m != nil { @@ -3444,6 +3600,13 @@ func (m *Value) GetDateValue() *google_type.Date { return nil } +func (m *Value) GetDayOfWeekValue() google_type1.DayOfWeek { + if x, ok := m.GetType().(*Value_DayOfWeekValue); ok { + return x.DayOfWeekValue + } + return google_type1.DayOfWeek_DAY_OF_WEEK_UNSPECIFIED +} + // XXX_OneofFuncs is for the internal use of the proto package. func (*Value) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { return _Value_OneofMarshaler, _Value_OneofUnmarshaler, _Value_OneofSizer, []interface{}{ @@ -3454,6 +3617,7 @@ func (*Value) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, (*Value_TimestampValue)(nil), (*Value_TimeValue)(nil), (*Value_DateValue)(nil), + (*Value_DayOfWeekValue)(nil), } } @@ -3492,6 +3656,9 @@ func _Value_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { if err := b.EncodeMessage(x.DateValue); err != nil { return err } + case *Value_DayOfWeekValue: + b.EncodeVarint(8<<3 | proto.WireVarint) + b.EncodeVarint(uint64(x.DayOfWeekValue)) case nil: default: return fmt.Errorf("Value.Type has unexpected type %T", x) @@ -3554,6 +3721,13 @@ func _Value_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) err := b.DecodeMessage(msg) m.Type = &Value_DateValue{msg} return true, err + case 8: // type.day_of_week_value + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Type = &Value_DayOfWeekValue{google_type1.DayOfWeek(x)} + return true, err default: return false, nil } @@ -3591,6 +3765,102 @@ func _Value_OneofSizer(msg proto.Message) (n int) { n += proto.SizeVarint(7<<3 | proto.WireBytes) n += proto.SizeVarint(uint64(s)) n += s + case *Value_DayOfWeekValue: + n += proto.SizeVarint(8<<3 | proto.WireVarint) + n += proto.SizeVarint(uint64(x.DayOfWeekValue)) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// Message for infoType-dependent details parsed from quote. +type QuoteInfo struct { + // Object representation of the quote. + // + // Types that are valid to be assigned to ParsedQuote: + // *QuoteInfo_DateTime + ParsedQuote isQuoteInfo_ParsedQuote `protobuf_oneof:"parsed_quote"` +} + +func (m *QuoteInfo) Reset() { *m = QuoteInfo{} } +func (m *QuoteInfo) String() string { return proto.CompactTextString(m) } +func (*QuoteInfo) ProtoMessage() {} +func (*QuoteInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{31} } + +type isQuoteInfo_ParsedQuote interface { + isQuoteInfo_ParsedQuote() +} + +type QuoteInfo_DateTime struct { + DateTime *DateTime `protobuf:"bytes,2,opt,name=date_time,json=dateTime,oneof"` +} + +func (*QuoteInfo_DateTime) isQuoteInfo_ParsedQuote() {} + +func (m *QuoteInfo) GetParsedQuote() isQuoteInfo_ParsedQuote { + if m != nil { + return m.ParsedQuote + } + return nil +} + +func (m *QuoteInfo) GetDateTime() *DateTime { + if x, ok := m.GetParsedQuote().(*QuoteInfo_DateTime); ok { + return x.DateTime + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*QuoteInfo) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _QuoteInfo_OneofMarshaler, _QuoteInfo_OneofUnmarshaler, _QuoteInfo_OneofSizer, []interface{}{ + (*QuoteInfo_DateTime)(nil), + } +} + +func _QuoteInfo_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*QuoteInfo) + // parsed_quote + switch x := m.ParsedQuote.(type) { + case *QuoteInfo_DateTime: + b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.DateTime); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("QuoteInfo.ParsedQuote has unexpected type %T", x) + } + return nil +} + +func _QuoteInfo_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*QuoteInfo) + switch tag { + case 2: // parsed_quote.date_time + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(DateTime) + err := b.DecodeMessage(msg) + m.ParsedQuote = &QuoteInfo_DateTime{msg} + return true, err + default: + return false, nil + } +} + +func _QuoteInfo_OneofSizer(msg proto.Message) (n int) { + m := msg.(*QuoteInfo) + // parsed_quote + switch x := m.ParsedQuote.(type) { + case *QuoteInfo_DateTime: + s := proto.Size(x.DateTime) + n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s case nil: default: panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) @@ -3598,6 +3868,67 @@ func _Value_OneofSizer(msg proto.Message) (n int) { return n } +// Message for a date time object. +type DateTime struct { + // One or more of the following must be set. All fields are optional, but + // when set must be valid date or time values. + Date *google_type.Date `protobuf:"bytes,1,opt,name=date" json:"date,omitempty"` + DayOfWeek google_type1.DayOfWeek `protobuf:"varint,2,opt,name=day_of_week,json=dayOfWeek,enum=google.type.DayOfWeek" json:"day_of_week,omitempty"` + Time *google_type2.TimeOfDay `protobuf:"bytes,3,opt,name=time" json:"time,omitempty"` + TimeZone *DateTime_TimeZone `protobuf:"bytes,4,opt,name=time_zone,json=timeZone" json:"time_zone,omitempty"` +} + +func (m *DateTime) Reset() { *m = DateTime{} } +func (m *DateTime) String() string { return proto.CompactTextString(m) } +func (*DateTime) ProtoMessage() {} +func (*DateTime) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{32} } + +func (m *DateTime) GetDate() *google_type.Date { + if m != nil { + return m.Date + } + return nil +} + +func (m *DateTime) GetDayOfWeek() google_type1.DayOfWeek { + if m != nil { + return m.DayOfWeek + } + return google_type1.DayOfWeek_DAY_OF_WEEK_UNSPECIFIED +} + +func (m *DateTime) GetTime() *google_type2.TimeOfDay { + if m != nil { + return m.Time + } + return nil +} + +func (m *DateTime) GetTimeZone() *DateTime_TimeZone { + if m != nil { + return m.TimeZone + } + return nil +} + +type DateTime_TimeZone struct { + // Set only if the offset can be determined. Positive for time ahead of UTC. + // E.g. For "UTC-9", this value is -540. + OffsetMinutes int32 `protobuf:"varint,1,opt,name=offset_minutes,json=offsetMinutes" json:"offset_minutes,omitempty"` +} + +func (m *DateTime_TimeZone) Reset() { *m = DateTime_TimeZone{} } +func (m *DateTime_TimeZone) String() string { return proto.CompactTextString(m) } +func (*DateTime_TimeZone) ProtoMessage() {} +func (*DateTime_TimeZone) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{32, 0} } + +func (m *DateTime_TimeZone) GetOffsetMinutes() int32 { + if m != nil { + return m.OffsetMinutes + } + return 0 +} + // The configuration that controls how the data will change. type DeidentifyConfig struct { // Types that are valid to be assigned to Transformation: @@ -3609,7 +3940,7 @@ type DeidentifyConfig struct { func (m *DeidentifyConfig) Reset() { *m = DeidentifyConfig{} } func (m *DeidentifyConfig) String() string { return proto.CompactTextString(m) } func (*DeidentifyConfig) ProtoMessage() {} -func (*DeidentifyConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{31} } +func (*DeidentifyConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{33} } type isDeidentifyConfig_Transformation interface { isDeidentifyConfig_Transformation() @@ -3732,13 +4063,14 @@ type PrimitiveTransformation struct { // *PrimitiveTransformation_ReplaceWithInfoTypeConfig // *PrimitiveTransformation_TimePartConfig // *PrimitiveTransformation_CryptoHashConfig + // *PrimitiveTransformation_DateShiftConfig Transformation isPrimitiveTransformation_Transformation `protobuf_oneof:"transformation"` } func (m *PrimitiveTransformation) Reset() { *m = PrimitiveTransformation{} } func (m *PrimitiveTransformation) String() string { return proto.CompactTextString(m) } func (*PrimitiveTransformation) ProtoMessage() {} -func (*PrimitiveTransformation) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{32} } +func (*PrimitiveTransformation) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{34} } type isPrimitiveTransformation_Transformation interface { isPrimitiveTransformation_Transformation() @@ -3771,6 +4103,9 @@ type PrimitiveTransformation_TimePartConfig struct { type PrimitiveTransformation_CryptoHashConfig struct { CryptoHashConfig *CryptoHashConfig `protobuf:"bytes,9,opt,name=crypto_hash_config,json=cryptoHashConfig,oneof"` } +type PrimitiveTransformation_DateShiftConfig struct { + DateShiftConfig *DateShiftConfig `protobuf:"bytes,11,opt,name=date_shift_config,json=dateShiftConfig,oneof"` +} func (*PrimitiveTransformation_ReplaceConfig) isPrimitiveTransformation_Transformation() {} func (*PrimitiveTransformation_RedactConfig) isPrimitiveTransformation_Transformation() {} @@ -3781,6 +4116,7 @@ func (*PrimitiveTransformation_BucketingConfig) isPrimitiveTransformation_Transf func (*PrimitiveTransformation_ReplaceWithInfoTypeConfig) isPrimitiveTransformation_Transformation() {} func (*PrimitiveTransformation_TimePartConfig) isPrimitiveTransformation_Transformation() {} func (*PrimitiveTransformation_CryptoHashConfig) isPrimitiveTransformation_Transformation() {} +func (*PrimitiveTransformation_DateShiftConfig) isPrimitiveTransformation_Transformation() {} func (m *PrimitiveTransformation) GetTransformation() isPrimitiveTransformation_Transformation { if m != nil { @@ -3852,6 +4188,13 @@ func (m *PrimitiveTransformation) GetCryptoHashConfig() *CryptoHashConfig { return nil } +func (m *PrimitiveTransformation) GetDateShiftConfig() *DateShiftConfig { + if x, ok := m.GetTransformation().(*PrimitiveTransformation_DateShiftConfig); ok { + return x.DateShiftConfig + } + return nil +} + // XXX_OneofFuncs is for the internal use of the proto package. func (*PrimitiveTransformation) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { return _PrimitiveTransformation_OneofMarshaler, _PrimitiveTransformation_OneofUnmarshaler, _PrimitiveTransformation_OneofSizer, []interface{}{ @@ -3864,6 +4207,7 @@ func (*PrimitiveTransformation) XXX_OneofFuncs() (func(msg proto.Message, b *pro (*PrimitiveTransformation_ReplaceWithInfoTypeConfig)(nil), (*PrimitiveTransformation_TimePartConfig)(nil), (*PrimitiveTransformation_CryptoHashConfig)(nil), + (*PrimitiveTransformation_DateShiftConfig)(nil), } } @@ -3916,6 +4260,11 @@ func _PrimitiveTransformation_OneofMarshaler(msg proto.Message, b *proto.Buffer) if err := b.EncodeMessage(x.CryptoHashConfig); err != nil { return err } + case *PrimitiveTransformation_DateShiftConfig: + b.EncodeVarint(11<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.DateShiftConfig); err != nil { + return err + } case nil: default: return fmt.Errorf("PrimitiveTransformation.Transformation has unexpected type %T", x) @@ -3998,6 +4347,14 @@ func _PrimitiveTransformation_OneofUnmarshaler(msg proto.Message, tag, wire int, err := b.DecodeMessage(msg) m.Transformation = &PrimitiveTransformation_CryptoHashConfig{msg} return true, err + case 11: // transformation.date_shift_config + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(DateShiftConfig) + err := b.DecodeMessage(msg) + m.Transformation = &PrimitiveTransformation_DateShiftConfig{msg} + return true, err default: return false, nil } @@ -4052,6 +4409,11 @@ func _PrimitiveTransformation_OneofSizer(msg proto.Message) (n int) { n += proto.SizeVarint(9<<3 | proto.WireBytes) n += proto.SizeVarint(uint64(s)) n += s + case *PrimitiveTransformation_DateShiftConfig: + s := proto.Size(x.DateShiftConfig) + n += proto.SizeVarint(11<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s case nil: default: panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) @@ -4068,7 +4430,7 @@ type TimePartConfig struct { func (m *TimePartConfig) Reset() { *m = TimePartConfig{} } func (m *TimePartConfig) String() string { return proto.CompactTextString(m) } func (*TimePartConfig) ProtoMessage() {} -func (*TimePartConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{33} } +func (*TimePartConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{35} } func (m *TimePartConfig) GetPartToExtract() TimePartConfig_TimePart { if m != nil { @@ -4091,7 +4453,7 @@ type CryptoHashConfig struct { func (m *CryptoHashConfig) Reset() { *m = CryptoHashConfig{} } func (m *CryptoHashConfig) String() string { return proto.CompactTextString(m) } func (*CryptoHashConfig) ProtoMessage() {} -func (*CryptoHashConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{34} } +func (*CryptoHashConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{36} } func (m *CryptoHashConfig) GetCryptoKey() *CryptoKey { if m != nil { @@ -4109,7 +4471,7 @@ type ReplaceValueConfig struct { func (m *ReplaceValueConfig) Reset() { *m = ReplaceValueConfig{} } func (m *ReplaceValueConfig) String() string { return proto.CompactTextString(m) } func (*ReplaceValueConfig) ProtoMessage() {} -func (*ReplaceValueConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{35} } +func (*ReplaceValueConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{37} } func (m *ReplaceValueConfig) GetNewValue() *Value { if m != nil { @@ -4125,7 +4487,7 @@ type ReplaceWithInfoTypeConfig struct { func (m *ReplaceWithInfoTypeConfig) Reset() { *m = ReplaceWithInfoTypeConfig{} } func (m *ReplaceWithInfoTypeConfig) String() string { return proto.CompactTextString(m) } func (*ReplaceWithInfoTypeConfig) ProtoMessage() {} -func (*ReplaceWithInfoTypeConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{36} } +func (*ReplaceWithInfoTypeConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{38} } // Redact a given value. For example, if used with an `InfoTypeTransformation` // transforming PHONE_NUMBER, and input 'My phone number is 206-555-0123', the @@ -4136,7 +4498,7 @@ type RedactConfig struct { func (m *RedactConfig) Reset() { *m = RedactConfig{} } func (m *RedactConfig) String() string { return proto.CompactTextString(m) } func (*RedactConfig) ProtoMessage() {} -func (*RedactConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{37} } +func (*RedactConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{39} } // Characters to skip when doing deidentification of a value. These will be left // alone and skipped. @@ -4150,7 +4512,7 @@ type CharsToIgnore struct { func (m *CharsToIgnore) Reset() { *m = CharsToIgnore{} } func (m *CharsToIgnore) String() string { return proto.CompactTextString(m) } func (*CharsToIgnore) ProtoMessage() {} -func (*CharsToIgnore) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{38} } +func (*CharsToIgnore) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{40} } type isCharsToIgnore_Characters interface { isCharsToIgnore_Characters() @@ -4282,7 +4644,7 @@ type CharacterMaskConfig struct { func (m *CharacterMaskConfig) Reset() { *m = CharacterMaskConfig{} } func (m *CharacterMaskConfig) String() string { return proto.CompactTextString(m) } func (*CharacterMaskConfig) ProtoMessage() {} -func (*CharacterMaskConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{39} } +func (*CharacterMaskConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{41} } func (m *CharacterMaskConfig) GetMaskingCharacter() string { if m != nil { @@ -4346,7 +4708,7 @@ type FixedSizeBucketingConfig struct { func (m *FixedSizeBucketingConfig) Reset() { *m = FixedSizeBucketingConfig{} } func (m *FixedSizeBucketingConfig) String() string { return proto.CompactTextString(m) } func (*FixedSizeBucketingConfig) ProtoMessage() {} -func (*FixedSizeBucketingConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{40} } +func (*FixedSizeBucketingConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{42} } func (m *FixedSizeBucketingConfig) GetLowerBound() *Value { if m != nil { @@ -4385,7 +4747,7 @@ type BucketingConfig struct { func (m *BucketingConfig) Reset() { *m = BucketingConfig{} } func (m *BucketingConfig) String() string { return proto.CompactTextString(m) } func (*BucketingConfig) ProtoMessage() {} -func (*BucketingConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{41} } +func (*BucketingConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{43} } func (m *BucketingConfig) GetBuckets() []*BucketingConfig_Bucket { if m != nil { @@ -4409,7 +4771,7 @@ type BucketingConfig_Bucket struct { func (m *BucketingConfig_Bucket) Reset() { *m = BucketingConfig_Bucket{} } func (m *BucketingConfig_Bucket) String() string { return proto.CompactTextString(m) } func (*BucketingConfig_Bucket) ProtoMessage() {} -func (*BucketingConfig_Bucket) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{41, 0} } +func (*BucketingConfig_Bucket) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{43, 0} } func (m *BucketingConfig_Bucket) GetMin() *Value { if m != nil { @@ -4502,7 +4864,7 @@ type CryptoReplaceFfxFpeConfig struct { func (m *CryptoReplaceFfxFpeConfig) Reset() { *m = CryptoReplaceFfxFpeConfig{} } func (m *CryptoReplaceFfxFpeConfig) String() string { return proto.CompactTextString(m) } func (*CryptoReplaceFfxFpeConfig) ProtoMessage() {} -func (*CryptoReplaceFfxFpeConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{42} } +func (*CryptoReplaceFfxFpeConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{44} } type isCryptoReplaceFfxFpeConfig_Alphabet interface { isCryptoReplaceFfxFpeConfig_Alphabet() @@ -4666,7 +5028,7 @@ type CryptoKey struct { func (m *CryptoKey) Reset() { *m = CryptoKey{} } func (m *CryptoKey) String() string { return proto.CompactTextString(m) } func (*CryptoKey) ProtoMessage() {} -func (*CryptoKey) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{43} } +func (*CryptoKey) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{45} } type isCryptoKey_Source interface { isCryptoKey_Source() @@ -4822,7 +5184,7 @@ type TransientCryptoKey struct { func (m *TransientCryptoKey) Reset() { *m = TransientCryptoKey{} } func (m *TransientCryptoKey) String() string { return proto.CompactTextString(m) } func (*TransientCryptoKey) ProtoMessage() {} -func (*TransientCryptoKey) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{44} } +func (*TransientCryptoKey) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{46} } func (m *TransientCryptoKey) GetName() string { if m != nil { @@ -4841,7 +5203,7 @@ type UnwrappedCryptoKey struct { func (m *UnwrappedCryptoKey) Reset() { *m = UnwrappedCryptoKey{} } func (m *UnwrappedCryptoKey) String() string { return proto.CompactTextString(m) } func (*UnwrappedCryptoKey) ProtoMessage() {} -func (*UnwrappedCryptoKey) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{45} } +func (*UnwrappedCryptoKey) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{47} } func (m *UnwrappedCryptoKey) GetKey() []byte { if m != nil { @@ -4864,7 +5226,7 @@ type KmsWrappedCryptoKey struct { func (m *KmsWrappedCryptoKey) Reset() { *m = KmsWrappedCryptoKey{} } func (m *KmsWrappedCryptoKey) String() string { return proto.CompactTextString(m) } func (*KmsWrappedCryptoKey) ProtoMessage() {} -func (*KmsWrappedCryptoKey) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{46} } +func (*KmsWrappedCryptoKey) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{48} } func (m *KmsWrappedCryptoKey) GetWrappedKey() []byte { if m != nil { @@ -4880,6 +5242,136 @@ func (m *KmsWrappedCryptoKey) GetCryptoKeyName() string { return "" } +// Shifts dates by random number of days, with option to be consistent for the +// same context. +type DateShiftConfig struct { + // Range of shift in days. Actual shift will be selected at random within this + // range (inclusive ends). Negative means shift to earlier in time. Must not + // be more than 365250 days (1000 years) each direction. + // + // For example, 3 means shift date to at most 3 days into the future. + // [Required] + UpperBoundDays int32 `protobuf:"varint,1,opt,name=upper_bound_days,json=upperBoundDays" json:"upper_bound_days,omitempty"` + // For example, -5 means shift date to at most 5 days back in the past. + // [Required] + LowerBoundDays int32 `protobuf:"varint,2,opt,name=lower_bound_days,json=lowerBoundDays" json:"lower_bound_days,omitempty"` + // Points to the field that contains the context, for example, an entity id. + // If set, must also set method. If set, shift will be consistent for the + // given context. + Context *FieldId `protobuf:"bytes,3,opt,name=context" json:"context,omitempty"` + // Method for calculating shift that takes context into consideration. If + // set, must also set context. Can only be applied to table items. + // + // Types that are valid to be assigned to Method: + // *DateShiftConfig_CryptoKey + Method isDateShiftConfig_Method `protobuf_oneof:"method"` +} + +func (m *DateShiftConfig) Reset() { *m = DateShiftConfig{} } +func (m *DateShiftConfig) String() string { return proto.CompactTextString(m) } +func (*DateShiftConfig) ProtoMessage() {} +func (*DateShiftConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{49} } + +type isDateShiftConfig_Method interface { + isDateShiftConfig_Method() +} + +type DateShiftConfig_CryptoKey struct { + CryptoKey *CryptoKey `protobuf:"bytes,4,opt,name=crypto_key,json=cryptoKey,oneof"` +} + +func (*DateShiftConfig_CryptoKey) isDateShiftConfig_Method() {} + +func (m *DateShiftConfig) GetMethod() isDateShiftConfig_Method { + if m != nil { + return m.Method + } + return nil +} + +func (m *DateShiftConfig) GetUpperBoundDays() int32 { + if m != nil { + return m.UpperBoundDays + } + return 0 +} + +func (m *DateShiftConfig) GetLowerBoundDays() int32 { + if m != nil { + return m.LowerBoundDays + } + return 0 +} + +func (m *DateShiftConfig) GetContext() *FieldId { + if m != nil { + return m.Context + } + return nil +} + +func (m *DateShiftConfig) GetCryptoKey() *CryptoKey { + if x, ok := m.GetMethod().(*DateShiftConfig_CryptoKey); ok { + return x.CryptoKey + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*DateShiftConfig) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _DateShiftConfig_OneofMarshaler, _DateShiftConfig_OneofUnmarshaler, _DateShiftConfig_OneofSizer, []interface{}{ + (*DateShiftConfig_CryptoKey)(nil), + } +} + +func _DateShiftConfig_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*DateShiftConfig) + // method + switch x := m.Method.(type) { + case *DateShiftConfig_CryptoKey: + b.EncodeVarint(4<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.CryptoKey); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("DateShiftConfig.Method has unexpected type %T", x) + } + return nil +} + +func _DateShiftConfig_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*DateShiftConfig) + switch tag { + case 4: // method.crypto_key + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(CryptoKey) + err := b.DecodeMessage(msg) + m.Method = &DateShiftConfig_CryptoKey{msg} + return true, err + default: + return false, nil + } +} + +func _DateShiftConfig_OneofSizer(msg proto.Message) (n int) { + m := msg.(*DateShiftConfig) + // method + switch x := m.Method.(type) { + case *DateShiftConfig_CryptoKey: + s := proto.Size(x.CryptoKey) + n += proto.SizeVarint(4<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + // A type of transformation that will scan unstructured text and // apply various `PrimitiveTransformation`s to each finding, where the // transformation is applied to only values that were identified as a specific @@ -4893,7 +5385,7 @@ type InfoTypeTransformations struct { func (m *InfoTypeTransformations) Reset() { *m = InfoTypeTransformations{} } func (m *InfoTypeTransformations) String() string { return proto.CompactTextString(m) } func (*InfoTypeTransformations) ProtoMessage() {} -func (*InfoTypeTransformations) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{47} } +func (*InfoTypeTransformations) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{50} } func (m *InfoTypeTransformations) GetTransformations() []*InfoTypeTransformations_InfoTypeTransformation { if m != nil { @@ -4920,7 +5412,7 @@ func (m *InfoTypeTransformations_InfoTypeTransformation) String() string { } func (*InfoTypeTransformations_InfoTypeTransformation) ProtoMessage() {} func (*InfoTypeTransformations_InfoTypeTransformation) Descriptor() ([]byte, []int) { - return fileDescriptor0, []int{47, 0} + return fileDescriptor0, []int{50, 0} } func (m *InfoTypeTransformations_InfoTypeTransformation) GetInfoTypes() []*InfoType { @@ -4962,7 +5454,7 @@ type FieldTransformation struct { func (m *FieldTransformation) Reset() { *m = FieldTransformation{} } func (m *FieldTransformation) String() string { return proto.CompactTextString(m) } func (*FieldTransformation) ProtoMessage() {} -func (*FieldTransformation) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{48} } +func (*FieldTransformation) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{51} } type isFieldTransformation_Transformation interface { isFieldTransformation_Transformation() @@ -5100,7 +5592,7 @@ type RecordTransformations struct { func (m *RecordTransformations) Reset() { *m = RecordTransformations{} } func (m *RecordTransformations) String() string { return proto.CompactTextString(m) } func (*RecordTransformations) ProtoMessage() {} -func (*RecordTransformations) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{49} } +func (*RecordTransformations) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{52} } func (m *RecordTransformations) GetFieldTransformations() []*FieldTransformation { if m != nil { @@ -5127,7 +5619,7 @@ type RecordSuppression struct { func (m *RecordSuppression) Reset() { *m = RecordSuppression{} } func (m *RecordSuppression) String() string { return proto.CompactTextString(m) } func (*RecordSuppression) ProtoMessage() {} -func (*RecordSuppression) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{50} } +func (*RecordSuppression) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{53} } func (m *RecordSuppression) GetCondition() *RecordCondition { if m != nil { @@ -5146,7 +5638,7 @@ type RecordCondition struct { func (m *RecordCondition) Reset() { *m = RecordCondition{} } func (m *RecordCondition) String() string { return proto.CompactTextString(m) } func (*RecordCondition) ProtoMessage() {} -func (*RecordCondition) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{51} } +func (*RecordCondition) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{54} } func (m *RecordCondition) GetExpressions() *RecordCondition_Expressions { if m != nil { @@ -5185,7 +5677,7 @@ type RecordCondition_Condition struct { func (m *RecordCondition_Condition) Reset() { *m = RecordCondition_Condition{} } func (m *RecordCondition_Condition) String() string { return proto.CompactTextString(m) } func (*RecordCondition_Condition) ProtoMessage() {} -func (*RecordCondition_Condition) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{51, 0} } +func (*RecordCondition_Condition) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{54, 0} } func (m *RecordCondition_Condition) GetField() *FieldId { if m != nil { @@ -5216,7 +5708,7 @@ type RecordCondition_Conditions struct { func (m *RecordCondition_Conditions) Reset() { *m = RecordCondition_Conditions{} } func (m *RecordCondition_Conditions) String() string { return proto.CompactTextString(m) } func (*RecordCondition_Conditions) ProtoMessage() {} -func (*RecordCondition_Conditions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{51, 1} } +func (*RecordCondition_Conditions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{54, 1} } func (m *RecordCondition_Conditions) GetConditions() []*RecordCondition_Condition { if m != nil { @@ -5238,7 +5730,7 @@ type RecordCondition_Expressions struct { func (m *RecordCondition_Expressions) Reset() { *m = RecordCondition_Expressions{} } func (m *RecordCondition_Expressions) String() string { return proto.CompactTextString(m) } func (*RecordCondition_Expressions) ProtoMessage() {} -func (*RecordCondition_Expressions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{51, 2} } +func (*RecordCondition_Expressions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{54, 2} } type isRecordCondition_Expressions_Type interface { isRecordCondition_Expressions_Type() @@ -5337,7 +5829,7 @@ type TransformationOverview struct { func (m *TransformationOverview) Reset() { *m = TransformationOverview{} } func (m *TransformationOverview) String() string { return proto.CompactTextString(m) } func (*TransformationOverview) ProtoMessage() {} -func (*TransformationOverview) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{52} } +func (*TransformationOverview) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{55} } func (m *TransformationOverview) GetTransformedBytes() int64 { if m != nil { @@ -5377,7 +5869,7 @@ type TransformationSummary struct { func (m *TransformationSummary) Reset() { *m = TransformationSummary{} } func (m *TransformationSummary) String() string { return proto.CompactTextString(m) } func (*TransformationSummary) ProtoMessage() {} -func (*TransformationSummary) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{53} } +func (*TransformationSummary) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{56} } func (m *TransformationSummary) GetInfoType() *InfoType { if m != nil { @@ -5442,7 +5934,7 @@ func (m *TransformationSummary_SummaryResult) Reset() { *m = Transformat func (m *TransformationSummary_SummaryResult) String() string { return proto.CompactTextString(m) } func (*TransformationSummary_SummaryResult) ProtoMessage() {} func (*TransformationSummary_SummaryResult) Descriptor() ([]byte, []int) { - return fileDescriptor0, []int{53, 0} + return fileDescriptor0, []int{56, 0} } func (m *TransformationSummary_SummaryResult) GetCount() int64 { @@ -5466,45 +5958,136 @@ func (m *TransformationSummary_SummaryResult) GetDetails() string { return "" } -// The inspectTemplate contains a configuration (set of types of sensitive data -// to be detected) to be used anywhere you otherwise would normally specify -// InspectConfig. -type InspectTemplate struct { - // The template name. Output only. - // - // The template will have one of the following formats: - // `projects/PROJECT_ID/inspectTemplates/TEMPLATE_ID` OR - // `organizations/ORGANIZATION_ID/inspectTemplates/TEMPLATE_ID` - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - // Display name (max 256 chars). - DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName" json:"display_name,omitempty"` - // Short description (max 256 chars). - Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` - // The creation timestamp of a inspectTemplate, output only field. - CreateTime *google_protobuf1.Timestamp `protobuf:"bytes,4,opt,name=create_time,json=createTime" json:"create_time,omitempty"` - // The last update timestamp of a inspectTemplate, output only field. - UpdateTime *google_protobuf1.Timestamp `protobuf:"bytes,5,opt,name=update_time,json=updateTime" json:"update_time,omitempty"` - // The core content of the template. Configuration of the scanning process. - InspectConfig *InspectConfig `protobuf:"bytes,6,opt,name=inspect_config,json=inspectConfig" json:"inspect_config,omitempty"` +// Schedule for triggeredJobs. +type Schedule struct { + // Types that are valid to be assigned to Option: + // *Schedule_ReccurrencePeriodDuration + Option isSchedule_Option `protobuf_oneof:"option"` } -func (m *InspectTemplate) Reset() { *m = InspectTemplate{} } -func (m *InspectTemplate) String() string { return proto.CompactTextString(m) } -func (*InspectTemplate) ProtoMessage() {} -func (*InspectTemplate) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{54} } +func (m *Schedule) Reset() { *m = Schedule{} } +func (m *Schedule) String() string { return proto.CompactTextString(m) } +func (*Schedule) ProtoMessage() {} +func (*Schedule) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{57} } -func (m *InspectTemplate) GetName() string { +type isSchedule_Option interface { + isSchedule_Option() +} + +type Schedule_ReccurrencePeriodDuration struct { + ReccurrencePeriodDuration *google_protobuf2.Duration `protobuf:"bytes,1,opt,name=reccurrence_period_duration,json=reccurrencePeriodDuration,oneof"` +} + +func (*Schedule_ReccurrencePeriodDuration) isSchedule_Option() {} + +func (m *Schedule) GetOption() isSchedule_Option { if m != nil { - return m.Name + return m.Option } - return "" + return nil } -func (m *InspectTemplate) GetDisplayName() string { - if m != nil { - return m.DisplayName +func (m *Schedule) GetReccurrencePeriodDuration() *google_protobuf2.Duration { + if x, ok := m.GetOption().(*Schedule_ReccurrencePeriodDuration); ok { + return x.ReccurrencePeriodDuration } - return "" + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*Schedule) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _Schedule_OneofMarshaler, _Schedule_OneofUnmarshaler, _Schedule_OneofSizer, []interface{}{ + (*Schedule_ReccurrencePeriodDuration)(nil), + } +} + +func _Schedule_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*Schedule) + // option + switch x := m.Option.(type) { + case *Schedule_ReccurrencePeriodDuration: + b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.ReccurrencePeriodDuration); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("Schedule.Option has unexpected type %T", x) + } + return nil +} + +func _Schedule_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*Schedule) + switch tag { + case 1: // option.reccurrence_period_duration + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(google_protobuf2.Duration) + err := b.DecodeMessage(msg) + m.Option = &Schedule_ReccurrencePeriodDuration{msg} + return true, err + default: + return false, nil + } +} + +func _Schedule_OneofSizer(msg proto.Message) (n int) { + m := msg.(*Schedule) + // option + switch x := m.Option.(type) { + case *Schedule_ReccurrencePeriodDuration: + s := proto.Size(x.ReccurrencePeriodDuration) + n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// The inspectTemplate contains a configuration (set of types of sensitive data +// to be detected) to be used anywhere you otherwise would normally specify +// InspectConfig. +type InspectTemplate struct { + // The template name. Output only. + // + // The template will have one of the following formats: + // `projects/PROJECT_ID/inspectTemplates/TEMPLATE_ID` OR + // `organizations/ORGANIZATION_ID/inspectTemplates/TEMPLATE_ID` + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // Display name (max 256 chars). + DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName" json:"display_name,omitempty"` + // Short description (max 256 chars). + Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` + // The creation timestamp of a inspectTemplate, output only field. + CreateTime *google_protobuf1.Timestamp `protobuf:"bytes,4,opt,name=create_time,json=createTime" json:"create_time,omitempty"` + // The last update timestamp of a inspectTemplate, output only field. + UpdateTime *google_protobuf1.Timestamp `protobuf:"bytes,5,opt,name=update_time,json=updateTime" json:"update_time,omitempty"` + // The core content of the template. Configuration of the scanning process. + InspectConfig *InspectConfig `protobuf:"bytes,6,opt,name=inspect_config,json=inspectConfig" json:"inspect_config,omitempty"` +} + +func (m *InspectTemplate) Reset() { *m = InspectTemplate{} } +func (m *InspectTemplate) String() string { return proto.CompactTextString(m) } +func (*InspectTemplate) ProtoMessage() {} +func (*InspectTemplate) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{58} } + +func (m *InspectTemplate) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *InspectTemplate) GetDisplayName() string { + if m != nil { + return m.DisplayName + } + return "" } func (m *InspectTemplate) GetDescription() string { @@ -5558,7 +6141,7 @@ type DeidentifyTemplate struct { func (m *DeidentifyTemplate) Reset() { *m = DeidentifyTemplate{} } func (m *DeidentifyTemplate) String() string { return proto.CompactTextString(m) } func (*DeidentifyTemplate) ProtoMessage() {} -func (*DeidentifyTemplate) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{55} } +func (*DeidentifyTemplate) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{59} } func (m *DeidentifyTemplate) GetName() string { if m != nil { @@ -5571,35 +6154,495 @@ func (m *DeidentifyTemplate) GetDisplayName() string { if m != nil { return m.DisplayName } - return "" + return "" +} + +func (m *DeidentifyTemplate) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *DeidentifyTemplate) GetCreateTime() *google_protobuf1.Timestamp { + if m != nil { + return m.CreateTime + } + return nil +} + +func (m *DeidentifyTemplate) GetUpdateTime() *google_protobuf1.Timestamp { + if m != nil { + return m.UpdateTime + } + return nil +} + +func (m *DeidentifyTemplate) GetDeidentifyConfig() *DeidentifyConfig { + if m != nil { + return m.DeidentifyConfig + } + return nil +} + +// Contains a configuration to make dlp api calls on a repeating basis. +type JobTrigger struct { + // Unique resource name for the triggeredJob, assigned by the service when the + // triggeredJob is created, for example + // `projects/dlp-test-project/triggeredJobs/53234423`. + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // Display name (max 100 chars) + DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName" json:"display_name,omitempty"` + // User provided description (max 256 chars) + Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` + // The configuration details for the specific type of job to run. + // + // Types that are valid to be assigned to Job: + // *JobTrigger_InspectJob + Job isJobTrigger_Job `protobuf_oneof:"job"` + // A list of triggers which will be OR'ed together. Only one in the list + // needs to trigger for a job to be started. The list may contain only + // a single Schedule trigger and must have at least one object. + Triggers []*JobTrigger_Trigger `protobuf:"bytes,5,rep,name=triggers" json:"triggers,omitempty"` + // A stream of errors encountered when the trigger was activated. Repeated + // errors may result in the JobTrigger automaticaly being paused. + // Will return the last 100 errors. Whenever the JobTrigger is modified + // this list will be cleared. Output only field. + Errors []*JobTrigger_Error `protobuf:"bytes,6,rep,name=errors" json:"errors,omitempty"` + // The creation timestamp of a triggeredJob, output only field. + CreateTime *google_protobuf1.Timestamp `protobuf:"bytes,7,opt,name=create_time,json=createTime" json:"create_time,omitempty"` + // The last update timestamp of a triggeredJob, output only field. + UpdateTime *google_protobuf1.Timestamp `protobuf:"bytes,8,opt,name=update_time,json=updateTime" json:"update_time,omitempty"` + // The timestamp of the last time this trigger executed. + LastRunTime *google_protobuf1.Timestamp `protobuf:"bytes,9,opt,name=last_run_time,json=lastRunTime" json:"last_run_time,omitempty"` + // A status for this trigger. [required] + Status JobTrigger_Status `protobuf:"varint,10,opt,name=status,enum=google.privacy.dlp.v2beta2.JobTrigger_Status" json:"status,omitempty"` +} + +func (m *JobTrigger) Reset() { *m = JobTrigger{} } +func (m *JobTrigger) String() string { return proto.CompactTextString(m) } +func (*JobTrigger) ProtoMessage() {} +func (*JobTrigger) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{60} } + +type isJobTrigger_Job interface { + isJobTrigger_Job() +} + +type JobTrigger_InspectJob struct { + InspectJob *InspectJobConfig `protobuf:"bytes,4,opt,name=inspect_job,json=inspectJob,oneof"` +} + +func (*JobTrigger_InspectJob) isJobTrigger_Job() {} + +func (m *JobTrigger) GetJob() isJobTrigger_Job { + if m != nil { + return m.Job + } + return nil +} + +func (m *JobTrigger) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *JobTrigger) GetDisplayName() string { + if m != nil { + return m.DisplayName + } + return "" +} + +func (m *JobTrigger) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *JobTrigger) GetInspectJob() *InspectJobConfig { + if x, ok := m.GetJob().(*JobTrigger_InspectJob); ok { + return x.InspectJob + } + return nil +} + +func (m *JobTrigger) GetTriggers() []*JobTrigger_Trigger { + if m != nil { + return m.Triggers + } + return nil +} + +func (m *JobTrigger) GetErrors() []*JobTrigger_Error { + if m != nil { + return m.Errors + } + return nil +} + +func (m *JobTrigger) GetCreateTime() *google_protobuf1.Timestamp { + if m != nil { + return m.CreateTime + } + return nil +} + +func (m *JobTrigger) GetUpdateTime() *google_protobuf1.Timestamp { + if m != nil { + return m.UpdateTime + } + return nil +} + +func (m *JobTrigger) GetLastRunTime() *google_protobuf1.Timestamp { + if m != nil { + return m.LastRunTime + } + return nil +} + +func (m *JobTrigger) GetStatus() JobTrigger_Status { + if m != nil { + return m.Status + } + return JobTrigger_STATUS_UNSPECIFIED +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*JobTrigger) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _JobTrigger_OneofMarshaler, _JobTrigger_OneofUnmarshaler, _JobTrigger_OneofSizer, []interface{}{ + (*JobTrigger_InspectJob)(nil), + } +} + +func _JobTrigger_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*JobTrigger) + // job + switch x := m.Job.(type) { + case *JobTrigger_InspectJob: + b.EncodeVarint(4<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.InspectJob); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("JobTrigger.Job has unexpected type %T", x) + } + return nil +} + +func _JobTrigger_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*JobTrigger) + switch tag { + case 4: // job.inspect_job + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(InspectJobConfig) + err := b.DecodeMessage(msg) + m.Job = &JobTrigger_InspectJob{msg} + return true, err + default: + return false, nil + } +} + +func _JobTrigger_OneofSizer(msg proto.Message) (n int) { + m := msg.(*JobTrigger) + // job + switch x := m.Job.(type) { + case *JobTrigger_InspectJob: + s := proto.Size(x.InspectJob) + n += proto.SizeVarint(4<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// What event needs to occur for a new job to be started. +type JobTrigger_Trigger struct { + // Types that are valid to be assigned to Trigger: + // *JobTrigger_Trigger_Schedule + Trigger isJobTrigger_Trigger_Trigger `protobuf_oneof:"trigger"` +} + +func (m *JobTrigger_Trigger) Reset() { *m = JobTrigger_Trigger{} } +func (m *JobTrigger_Trigger) String() string { return proto.CompactTextString(m) } +func (*JobTrigger_Trigger) ProtoMessage() {} +func (*JobTrigger_Trigger) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{60, 0} } + +type isJobTrigger_Trigger_Trigger interface { + isJobTrigger_Trigger_Trigger() +} + +type JobTrigger_Trigger_Schedule struct { + Schedule *Schedule `protobuf:"bytes,1,opt,name=schedule,oneof"` +} + +func (*JobTrigger_Trigger_Schedule) isJobTrigger_Trigger_Trigger() {} + +func (m *JobTrigger_Trigger) GetTrigger() isJobTrigger_Trigger_Trigger { + if m != nil { + return m.Trigger + } + return nil +} + +func (m *JobTrigger_Trigger) GetSchedule() *Schedule { + if x, ok := m.GetTrigger().(*JobTrigger_Trigger_Schedule); ok { + return x.Schedule + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*JobTrigger_Trigger) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _JobTrigger_Trigger_OneofMarshaler, _JobTrigger_Trigger_OneofUnmarshaler, _JobTrigger_Trigger_OneofSizer, []interface{}{ + (*JobTrigger_Trigger_Schedule)(nil), + } +} + +func _JobTrigger_Trigger_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*JobTrigger_Trigger) + // trigger + switch x := m.Trigger.(type) { + case *JobTrigger_Trigger_Schedule: + b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Schedule); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("JobTrigger_Trigger.Trigger has unexpected type %T", x) + } + return nil +} + +func _JobTrigger_Trigger_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*JobTrigger_Trigger) + switch tag { + case 1: // trigger.schedule + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Schedule) + err := b.DecodeMessage(msg) + m.Trigger = &JobTrigger_Trigger_Schedule{msg} + return true, err + default: + return false, nil + } +} + +func _JobTrigger_Trigger_OneofSizer(msg proto.Message) (n int) { + m := msg.(*JobTrigger_Trigger) + // trigger + switch x := m.Trigger.(type) { + case *JobTrigger_Trigger_Schedule: + s := proto.Size(x.Schedule) + n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// The results of an unsuccessful activation of the JobTrigger. +type JobTrigger_Error struct { + Details *google_rpc.Status `protobuf:"bytes,1,opt,name=details" json:"details,omitempty"` + // The times the error occurred. + Timestamps []*google_protobuf1.Timestamp `protobuf:"bytes,2,rep,name=timestamps" json:"timestamps,omitempty"` +} + +func (m *JobTrigger_Error) Reset() { *m = JobTrigger_Error{} } +func (m *JobTrigger_Error) String() string { return proto.CompactTextString(m) } +func (*JobTrigger_Error) ProtoMessage() {} +func (*JobTrigger_Error) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{60, 1} } + +func (m *JobTrigger_Error) GetDetails() *google_rpc.Status { + if m != nil { + return m.Details + } + return nil +} + +func (m *JobTrigger_Error) GetTimestamps() []*google_protobuf1.Timestamp { + if m != nil { + return m.Timestamps + } + return nil +} + +// A task to execute on the completion of a job. +type Action struct { + // Types that are valid to be assigned to Action: + // *Action_SaveFindings_ + // *Action_PubSub + Action isAction_Action `protobuf_oneof:"action"` +} + +func (m *Action) Reset() { *m = Action{} } +func (m *Action) String() string { return proto.CompactTextString(m) } +func (*Action) ProtoMessage() {} +func (*Action) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{61} } + +type isAction_Action interface { + isAction_Action() +} + +type Action_SaveFindings_ struct { + SaveFindings *Action_SaveFindings `protobuf:"bytes,1,opt,name=save_findings,json=saveFindings,oneof"` +} +type Action_PubSub struct { + PubSub *Action_PublishToPubSub `protobuf:"bytes,2,opt,name=pub_sub,json=pubSub,oneof"` +} + +func (*Action_SaveFindings_) isAction_Action() {} +func (*Action_PubSub) isAction_Action() {} + +func (m *Action) GetAction() isAction_Action { + if m != nil { + return m.Action + } + return nil +} + +func (m *Action) GetSaveFindings() *Action_SaveFindings { + if x, ok := m.GetAction().(*Action_SaveFindings_); ok { + return x.SaveFindings + } + return nil +} + +func (m *Action) GetPubSub() *Action_PublishToPubSub { + if x, ok := m.GetAction().(*Action_PubSub); ok { + return x.PubSub + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*Action) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _Action_OneofMarshaler, _Action_OneofUnmarshaler, _Action_OneofSizer, []interface{}{ + (*Action_SaveFindings_)(nil), + (*Action_PubSub)(nil), + } +} + +func _Action_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*Action) + // action + switch x := m.Action.(type) { + case *Action_SaveFindings_: + b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.SaveFindings); err != nil { + return err + } + case *Action_PubSub: + b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.PubSub); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("Action.Action has unexpected type %T", x) + } + return nil +} + +func _Action_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*Action) + switch tag { + case 1: // action.save_findings + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Action_SaveFindings) + err := b.DecodeMessage(msg) + m.Action = &Action_SaveFindings_{msg} + return true, err + case 2: // action.pub_sub + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Action_PublishToPubSub) + err := b.DecodeMessage(msg) + m.Action = &Action_PubSub{msg} + return true, err + default: + return false, nil + } +} + +func _Action_OneofSizer(msg proto.Message) (n int) { + m := msg.(*Action) + // action + switch x := m.Action.(type) { + case *Action_SaveFindings_: + s := proto.Size(x.SaveFindings) + n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *Action_PubSub: + s := proto.Size(x.PubSub) + n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n } -func (m *DeidentifyTemplate) GetDescription() string { - if m != nil { - return m.Description - } - return "" +// If set, the detailed findings will be persisted to the specified +// OutputStorageConfig. Compatible with: Inspect +type Action_SaveFindings struct { + OutputConfig *OutputStorageConfig `protobuf:"bytes,1,opt,name=output_config,json=outputConfig" json:"output_config,omitempty"` } -func (m *DeidentifyTemplate) GetCreateTime() *google_protobuf1.Timestamp { +func (m *Action_SaveFindings) Reset() { *m = Action_SaveFindings{} } +func (m *Action_SaveFindings) String() string { return proto.CompactTextString(m) } +func (*Action_SaveFindings) ProtoMessage() {} +func (*Action_SaveFindings) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{61, 0} } + +func (m *Action_SaveFindings) GetOutputConfig() *OutputStorageConfig { if m != nil { - return m.CreateTime + return m.OutputConfig } return nil } -func (m *DeidentifyTemplate) GetUpdateTime() *google_protobuf1.Timestamp { - if m != nil { - return m.UpdateTime - } - return nil +// Publish the results of a DlpJob to a pub sub channel. +// Compatible with: Inpect, Risk +type Action_PublishToPubSub struct { + // Cloud Pub/Sub topic to send notifications to. The topic must have given + // publishing access rights to the DLP API service account executing + // the long running DlpJob sending the notifications. + // Format is projects/{project}/topics/{topic}. + Topic string `protobuf:"bytes,1,opt,name=topic" json:"topic,omitempty"` } -func (m *DeidentifyTemplate) GetDeidentifyConfig() *DeidentifyConfig { +func (m *Action_PublishToPubSub) Reset() { *m = Action_PublishToPubSub{} } +func (m *Action_PublishToPubSub) String() string { return proto.CompactTextString(m) } +func (*Action_PublishToPubSub) ProtoMessage() {} +func (*Action_PublishToPubSub) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{61, 1} } + +func (m *Action_PublishToPubSub) GetTopic() string { if m != nil { - return m.DeidentifyConfig + return m.Topic } - return nil + return "" } // Request message for CreateInspectTemplate. @@ -5619,7 +6662,7 @@ type CreateInspectTemplateRequest struct { func (m *CreateInspectTemplateRequest) Reset() { *m = CreateInspectTemplateRequest{} } func (m *CreateInspectTemplateRequest) String() string { return proto.CompactTextString(m) } func (*CreateInspectTemplateRequest) ProtoMessage() {} -func (*CreateInspectTemplateRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{56} } +func (*CreateInspectTemplateRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{62} } func (m *CreateInspectTemplateRequest) GetParent() string { if m != nil { @@ -5645,7 +6688,8 @@ func (m *CreateInspectTemplateRequest) GetTemplateId() string { // Request message for UpdateInspectTemplate. type UpdateInspectTemplateRequest struct { // Resource name of organization and inspectTemplate to be updated, for - // example `organizations/433245324/inspectTemplates/432452342`. + // example `organizations/433245324/inspectTemplates/432452342` or + // projects/project-id/inspectTemplates/432452342. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` // New InspectTemplate value. InspectTemplate *InspectTemplate `protobuf:"bytes,2,opt,name=inspect_template,json=inspectTemplate" json:"inspect_template,omitempty"` @@ -5656,7 +6700,7 @@ type UpdateInspectTemplateRequest struct { func (m *UpdateInspectTemplateRequest) Reset() { *m = UpdateInspectTemplateRequest{} } func (m *UpdateInspectTemplateRequest) String() string { return proto.CompactTextString(m) } func (*UpdateInspectTemplateRequest) ProtoMessage() {} -func (*UpdateInspectTemplateRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{57} } +func (*UpdateInspectTemplateRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{63} } func (m *UpdateInspectTemplateRequest) GetName() string { if m != nil { @@ -5682,14 +6726,15 @@ func (m *UpdateInspectTemplateRequest) GetUpdateMask() *google_protobuf4.FieldMa // Request message for GetInspectTemplate. type GetInspectTemplateRequest struct { // Resource name of the organization and inspectTemplate to be read, for - // example `organizations/433245324/inspectTemplates/432452342`. + // example `organizations/433245324/inspectTemplates/432452342` or + // projects/project-id/inspectTemplates/432452342. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` } func (m *GetInspectTemplateRequest) Reset() { *m = GetInspectTemplateRequest{} } func (m *GetInspectTemplateRequest) String() string { return proto.CompactTextString(m) } func (*GetInspectTemplateRequest) ProtoMessage() {} -func (*GetInspectTemplateRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{58} } +func (*GetInspectTemplateRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{64} } func (m *GetInspectTemplateRequest) GetName() string { if m != nil { @@ -5714,7 +6759,7 @@ type ListInspectTemplatesRequest struct { func (m *ListInspectTemplatesRequest) Reset() { *m = ListInspectTemplatesRequest{} } func (m *ListInspectTemplatesRequest) String() string { return proto.CompactTextString(m) } func (*ListInspectTemplatesRequest) ProtoMessage() {} -func (*ListInspectTemplatesRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{59} } +func (*ListInspectTemplatesRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{65} } func (m *ListInspectTemplatesRequest) GetParent() string { if m != nil { @@ -5749,7 +6794,7 @@ type ListInspectTemplatesResponse struct { func (m *ListInspectTemplatesResponse) Reset() { *m = ListInspectTemplatesResponse{} } func (m *ListInspectTemplatesResponse) String() string { return proto.CompactTextString(m) } func (*ListInspectTemplatesResponse) ProtoMessage() {} -func (*ListInspectTemplatesResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{60} } +func (*ListInspectTemplatesResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{66} } func (m *ListInspectTemplatesResponse) GetInspectTemplates() []*InspectTemplate { if m != nil { @@ -5768,14 +6813,15 @@ func (m *ListInspectTemplatesResponse) GetNextPageToken() string { // Request message for DeleteInspectTemplate. type DeleteInspectTemplateRequest struct { // Resource name of the organization and inspectTemplate to be deleted, for - // example `organizations/433245324/inspectTemplates/432452342`. + // example `organizations/433245324/inspectTemplates/432452342` or + // projects/project-id/inspectTemplates/432452342. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` } func (m *DeleteInspectTemplateRequest) Reset() { *m = DeleteInspectTemplateRequest{} } func (m *DeleteInspectTemplateRequest) String() string { return proto.CompactTextString(m) } func (*DeleteInspectTemplateRequest) ProtoMessage() {} -func (*DeleteInspectTemplateRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{61} } +func (*DeleteInspectTemplateRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{67} } func (m *DeleteInspectTemplateRequest) GetName() string { if m != nil { @@ -5784,6 +6830,207 @@ func (m *DeleteInspectTemplateRequest) GetName() string { return "" } +// Request message for CreateJobTrigger. +type CreateJobTriggerRequest struct { + // The parent resource name, for example projects/my-project-id. + Parent string `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"` + // The JobTrigger to create. + JobTrigger *JobTrigger `protobuf:"bytes,2,opt,name=job_trigger,json=jobTrigger" json:"job_trigger,omitempty"` + // The trigger id can contain uppercase and lowercase letters, + // numbers, and hyphens; that is, it must match the regular + // expression: `[a-zA-Z\\d-]+`. The maximum length is 100 + // characters. Can be empty to allow the system to generate one. + TriggerId string `protobuf:"bytes,3,opt,name=trigger_id,json=triggerId" json:"trigger_id,omitempty"` +} + +func (m *CreateJobTriggerRequest) Reset() { *m = CreateJobTriggerRequest{} } +func (m *CreateJobTriggerRequest) String() string { return proto.CompactTextString(m) } +func (*CreateJobTriggerRequest) ProtoMessage() {} +func (*CreateJobTriggerRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{68} } + +func (m *CreateJobTriggerRequest) GetParent() string { + if m != nil { + return m.Parent + } + return "" +} + +func (m *CreateJobTriggerRequest) GetJobTrigger() *JobTrigger { + if m != nil { + return m.JobTrigger + } + return nil +} + +func (m *CreateJobTriggerRequest) GetTriggerId() string { + if m != nil { + return m.TriggerId + } + return "" +} + +// Request message for UpdateJobTrigger. +type UpdateJobTriggerRequest struct { + // Resource name of the project and the triggeredJob, for example + // `projects/dlp-test-project/jobTriggers/53234423`. + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // New JobTrigger value. + JobTrigger *JobTrigger `protobuf:"bytes,2,opt,name=job_trigger,json=jobTrigger" json:"job_trigger,omitempty"` + // Mask to control which fields get updated. + UpdateMask *google_protobuf4.FieldMask `protobuf:"bytes,3,opt,name=update_mask,json=updateMask" json:"update_mask,omitempty"` +} + +func (m *UpdateJobTriggerRequest) Reset() { *m = UpdateJobTriggerRequest{} } +func (m *UpdateJobTriggerRequest) String() string { return proto.CompactTextString(m) } +func (*UpdateJobTriggerRequest) ProtoMessage() {} +func (*UpdateJobTriggerRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{69} } + +func (m *UpdateJobTriggerRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *UpdateJobTriggerRequest) GetJobTrigger() *JobTrigger { + if m != nil { + return m.JobTrigger + } + return nil +} + +func (m *UpdateJobTriggerRequest) GetUpdateMask() *google_protobuf4.FieldMask { + if m != nil { + return m.UpdateMask + } + return nil +} + +// Request message for GetJobTrigger. +type GetJobTriggerRequest struct { + // Resource name of the project and the triggeredJob, for example + // `projects/dlp-test-project/jobTriggers/53234423`. + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` +} + +func (m *GetJobTriggerRequest) Reset() { *m = GetJobTriggerRequest{} } +func (m *GetJobTriggerRequest) String() string { return proto.CompactTextString(m) } +func (*GetJobTriggerRequest) ProtoMessage() {} +func (*GetJobTriggerRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{70} } + +func (m *GetJobTriggerRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +// Request message for ListJobTriggers. +type ListJobTriggersRequest struct { + // The parent resource name, for example projects/my-project-id. + Parent string `protobuf:"bytes,1,opt,name=parent" json:"parent,omitempty"` + // Optional page token to continue retrieval. Comes from previous call + // to ListJobTriggers. `order_by` and `filter` should not change for + // subsequent calls, but can be omitted if token is specified. + PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken" json:"page_token,omitempty"` + // Optional size of the page, can be limited by a server. + PageSize int32 `protobuf:"varint,3,opt,name=page_size,json=pageSize" json:"page_size,omitempty"` + // Optional comma separated list of triggeredJob fields to order by, + // followed by 'asc/desc' postfix, i.e. + // `"create_time asc,name desc,schedule_mode asc"`. This list is + // case-insensitive. + // + // Example: `"name asc,schedule_mode desc, status desc"` + // + // Supported filters keys and values are: + // + // - `create_time`: corresponds to time the triggeredJob was created. + // - `update_time`: corresponds to time the triggeredJob was last updated. + // - `name`: corresponds to JobTrigger's display name. + // - `status`: corresponds to the triggeredJob status. + OrderBy string `protobuf:"bytes,4,opt,name=order_by,json=orderBy" json:"order_by,omitempty"` +} + +func (m *ListJobTriggersRequest) Reset() { *m = ListJobTriggersRequest{} } +func (m *ListJobTriggersRequest) String() string { return proto.CompactTextString(m) } +func (*ListJobTriggersRequest) ProtoMessage() {} +func (*ListJobTriggersRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{71} } + +func (m *ListJobTriggersRequest) GetParent() string { + if m != nil { + return m.Parent + } + return "" +} + +func (m *ListJobTriggersRequest) GetPageToken() string { + if m != nil { + return m.PageToken + } + return "" +} + +func (m *ListJobTriggersRequest) GetPageSize() int32 { + if m != nil { + return m.PageSize + } + return 0 +} + +func (m *ListJobTriggersRequest) GetOrderBy() string { + if m != nil { + return m.OrderBy + } + return "" +} + +// Response message for ListJobTriggers. +type ListJobTriggersResponse struct { + // List of triggeredJobs, up to page_size in ListJobTriggersRequest. + JobTriggers []*JobTrigger `protobuf:"bytes,1,rep,name=job_triggers,json=jobTriggers" json:"job_triggers,omitempty"` + // If the next page is available then the next page token to be used + // in following ListJobTriggers request. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken" json:"next_page_token,omitempty"` +} + +func (m *ListJobTriggersResponse) Reset() { *m = ListJobTriggersResponse{} } +func (m *ListJobTriggersResponse) String() string { return proto.CompactTextString(m) } +func (*ListJobTriggersResponse) ProtoMessage() {} +func (*ListJobTriggersResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{72} } + +func (m *ListJobTriggersResponse) GetJobTriggers() []*JobTrigger { + if m != nil { + return m.JobTriggers + } + return nil +} + +func (m *ListJobTriggersResponse) GetNextPageToken() string { + if m != nil { + return m.NextPageToken + } + return "" +} + +// Request message for DeleteJobTrigger. +type DeleteJobTriggerRequest struct { + // Resource name of the project and the triggeredJob, for example + // `projects/dlp-test-project/jobTriggers/53234423`. + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` +} + +func (m *DeleteJobTriggerRequest) Reset() { *m = DeleteJobTriggerRequest{} } +func (m *DeleteJobTriggerRequest) String() string { return proto.CompactTextString(m) } +func (*DeleteJobTriggerRequest) ProtoMessage() {} +func (*DeleteJobTriggerRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{73} } + +func (m *DeleteJobTriggerRequest) GetName() string { + if m != nil { + return m.Name + } + return "" +} + type InspectJobConfig struct { // The data to scan. StorageConfig *StorageConfig `protobuf:"bytes,1,opt,name=storage_config,json=storageConfig" json:"storage_config,omitempty"` @@ -5795,12 +7042,15 @@ type InspectJobConfig struct { // `inspect_config` will be merged into the values persisted as part of the // template. InspectTemplateName string `protobuf:"bytes,4,opt,name=inspect_template_name,json=inspectTemplateName" json:"inspect_template_name,omitempty"` + // Actions to execute at the completion of the job. Are executed in the order + // provided. + Actions []*Action `protobuf:"bytes,5,rep,name=actions" json:"actions,omitempty"` } func (m *InspectJobConfig) Reset() { *m = InspectJobConfig{} } func (m *InspectJobConfig) String() string { return proto.CompactTextString(m) } func (*InspectJobConfig) ProtoMessage() {} -func (*InspectJobConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{62} } +func (*InspectJobConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{74} } func (m *InspectJobConfig) GetStorageConfig() *StorageConfig { if m != nil { @@ -5830,6 +7080,13 @@ func (m *InspectJobConfig) GetInspectTemplateName() string { return "" } +func (m *InspectJobConfig) GetActions() []*Action { + if m != nil { + return m.Actions + } + return nil +} + // Combines all of the information about a DLP job. type DlpJob struct { // The server-assigned name. @@ -5850,12 +7107,15 @@ type DlpJob struct { EndTime *google_protobuf1.Timestamp `protobuf:"bytes,8,opt,name=end_time,json=endTime" json:"end_time,omitempty"` // A stream of errors encountered running the job. ErrorResults []*google_rpc.Status `protobuf:"bytes,9,rep,name=error_results,json=errorResults" json:"error_results,omitempty"` + // If created by a job trigger, the resource name of the trigger that + // instantiated the job. + JobTriggerName string `protobuf:"bytes,10,opt,name=job_trigger_name,json=jobTriggerName" json:"job_trigger_name,omitempty"` } func (m *DlpJob) Reset() { *m = DlpJob{} } func (m *DlpJob) String() string { return proto.CompactTextString(m) } func (*DlpJob) ProtoMessage() {} -func (*DlpJob) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{63} } +func (*DlpJob) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{75} } type isDlpJob_Details interface { isDlpJob_Details() @@ -5941,6 +7201,13 @@ func (m *DlpJob) GetErrorResults() []*google_rpc.Status { return nil } +func (m *DlpJob) GetJobTriggerName() string { + if m != nil { + return m.JobTriggerName + } + return "" +} + // XXX_OneofFuncs is for the internal use of the proto package. func (*DlpJob) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { return _DlpJob_OneofMarshaler, _DlpJob_OneofUnmarshaler, _DlpJob_OneofSizer, []interface{}{ @@ -6024,7 +7291,7 @@ type GetDlpJobRequest struct { func (m *GetDlpJobRequest) Reset() { *m = GetDlpJobRequest{} } func (m *GetDlpJobRequest) String() string { return proto.CompactTextString(m) } func (*GetDlpJobRequest) ProtoMessage() {} -func (*GetDlpJobRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{64} } +func (*GetDlpJobRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{76} } func (m *GetDlpJobRequest) GetName() string { if m != nil { @@ -6048,6 +7315,7 @@ type ListDlpJobsRequest struct { // * Supported fields/values for inspect jobs: // - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED // - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY + // - `trigger_name` - The resource name of the trigger that created job. // * Supported fields for risk analysis jobs: // - `state` - RUNNING|CANCELED|FINISHED|FAILED // * The operator must be `=` or `!=`. @@ -6071,7 +7339,7 @@ type ListDlpJobsRequest struct { func (m *ListDlpJobsRequest) Reset() { *m = ListDlpJobsRequest{} } func (m *ListDlpJobsRequest) String() string { return proto.CompactTextString(m) } func (*ListDlpJobsRequest) ProtoMessage() {} -func (*ListDlpJobsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{65} } +func (*ListDlpJobsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{77} } func (m *ListDlpJobsRequest) GetParent() string { if m != nil { @@ -6119,7 +7387,7 @@ type ListDlpJobsResponse struct { func (m *ListDlpJobsResponse) Reset() { *m = ListDlpJobsResponse{} } func (m *ListDlpJobsResponse) String() string { return proto.CompactTextString(m) } func (*ListDlpJobsResponse) ProtoMessage() {} -func (*ListDlpJobsResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{66} } +func (*ListDlpJobsResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{78} } func (m *ListDlpJobsResponse) GetJobs() []*DlpJob { if m != nil { @@ -6144,7 +7412,7 @@ type CancelDlpJobRequest struct { func (m *CancelDlpJobRequest) Reset() { *m = CancelDlpJobRequest{} } func (m *CancelDlpJobRequest) String() string { return proto.CompactTextString(m) } func (*CancelDlpJobRequest) ProtoMessage() {} -func (*CancelDlpJobRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{67} } +func (*CancelDlpJobRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{79} } func (m *CancelDlpJobRequest) GetName() string { if m != nil { @@ -6162,7 +7430,7 @@ type DeleteDlpJobRequest struct { func (m *DeleteDlpJobRequest) Reset() { *m = DeleteDlpJobRequest{} } func (m *DeleteDlpJobRequest) String() string { return proto.CompactTextString(m) } func (*DeleteDlpJobRequest) ProtoMessage() {} -func (*DeleteDlpJobRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{68} } +func (*DeleteDlpJobRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{80} } func (m *DeleteDlpJobRequest) GetName() string { if m != nil { @@ -6189,7 +7457,7 @@ func (m *CreateDeidentifyTemplateRequest) Reset() { *m = CreateDeidentif func (m *CreateDeidentifyTemplateRequest) String() string { return proto.CompactTextString(m) } func (*CreateDeidentifyTemplateRequest) ProtoMessage() {} func (*CreateDeidentifyTemplateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor0, []int{69} + return fileDescriptor0, []int{81} } func (m *CreateDeidentifyTemplateRequest) GetParent() string { @@ -6216,7 +7484,8 @@ func (m *CreateDeidentifyTemplateRequest) GetTemplateId() string { // Request message for UpdateDeidentifyTemplate. type UpdateDeidentifyTemplateRequest struct { // Resource name of organization and deidentify template to be updated, for - // example `organizations/433245324/deidentifyTemplates/432452342`. + // example `organizations/433245324/deidentifyTemplates/432452342` or + // projects/project-id/deidentifyTemplates/432452342. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` // New DeidentifyTemplate value. DeidentifyTemplate *DeidentifyTemplate `protobuf:"bytes,2,opt,name=deidentify_template,json=deidentifyTemplate" json:"deidentify_template,omitempty"` @@ -6228,7 +7497,7 @@ func (m *UpdateDeidentifyTemplateRequest) Reset() { *m = UpdateDeidentif func (m *UpdateDeidentifyTemplateRequest) String() string { return proto.CompactTextString(m) } func (*UpdateDeidentifyTemplateRequest) ProtoMessage() {} func (*UpdateDeidentifyTemplateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor0, []int{70} + return fileDescriptor0, []int{82} } func (m *UpdateDeidentifyTemplateRequest) GetName() string { @@ -6255,14 +7524,15 @@ func (m *UpdateDeidentifyTemplateRequest) GetUpdateMask() *google_protobuf4.Fiel // Request message for GetDeidentifyTemplate. type GetDeidentifyTemplateRequest struct { // Resource name of the organization and deidentify template to be read, for - // example `organizations/433245324/deidentifyTemplates/432452342`. + // example `organizations/433245324/deidentifyTemplates/432452342` or + // projects/project-id/deidentifyTemplates/432452342. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` } func (m *GetDeidentifyTemplateRequest) Reset() { *m = GetDeidentifyTemplateRequest{} } func (m *GetDeidentifyTemplateRequest) String() string { return proto.CompactTextString(m) } func (*GetDeidentifyTemplateRequest) ProtoMessage() {} -func (*GetDeidentifyTemplateRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{71} } +func (*GetDeidentifyTemplateRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{83} } func (m *GetDeidentifyTemplateRequest) GetName() string { if m != nil { @@ -6287,7 +7557,7 @@ type ListDeidentifyTemplatesRequest struct { func (m *ListDeidentifyTemplatesRequest) Reset() { *m = ListDeidentifyTemplatesRequest{} } func (m *ListDeidentifyTemplatesRequest) String() string { return proto.CompactTextString(m) } func (*ListDeidentifyTemplatesRequest) ProtoMessage() {} -func (*ListDeidentifyTemplatesRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{72} } +func (*ListDeidentifyTemplatesRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{84} } func (m *ListDeidentifyTemplatesRequest) GetParent() string { if m != nil { @@ -6324,7 +7594,7 @@ func (m *ListDeidentifyTemplatesResponse) Reset() { *m = ListDeidentifyT func (m *ListDeidentifyTemplatesResponse) String() string { return proto.CompactTextString(m) } func (*ListDeidentifyTemplatesResponse) ProtoMessage() {} func (*ListDeidentifyTemplatesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor0, []int{73} + return fileDescriptor0, []int{85} } func (m *ListDeidentifyTemplatesResponse) GetDeidentifyTemplates() []*DeidentifyTemplate { @@ -6344,7 +7614,8 @@ func (m *ListDeidentifyTemplatesResponse) GetNextPageToken() string { // Request message for DeleteDeidentifyTemplate. type DeleteDeidentifyTemplateRequest struct { // Resource name of the organization and deidentify template to be deleted, - // for example `organizations/433245324/deidentifyTemplates/432452342`. + // for example `organizations/433245324/deidentifyTemplates/432452342` or + // projects/project-id/deidentifyTemplates/432452342. Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` } @@ -6352,7 +7623,7 @@ func (m *DeleteDeidentifyTemplateRequest) Reset() { *m = DeleteDeidentif func (m *DeleteDeidentifyTemplateRequest) String() string { return proto.CompactTextString(m) } func (*DeleteDeidentifyTemplateRequest) ProtoMessage() {} func (*DeleteDeidentifyTemplateRequest) Descriptor() ([]byte, []int) { - return fileDescriptor0, []int{74} + return fileDescriptor0, []int{86} } func (m *DeleteDeidentifyTemplateRequest) GetName() string { @@ -6420,6 +7691,9 @@ func init() { proto.RegisterType((*AnalyzeDataSourceRiskDetails_KMapEstimationResult_KMapEstimationHistogramBucket)(nil), "google.privacy.dlp.v2beta2.AnalyzeDataSourceRiskDetails.KMapEstimationResult.KMapEstimationHistogramBucket") proto.RegisterType((*ValueFrequency)(nil), "google.privacy.dlp.v2beta2.ValueFrequency") proto.RegisterType((*Value)(nil), "google.privacy.dlp.v2beta2.Value") + proto.RegisterType((*QuoteInfo)(nil), "google.privacy.dlp.v2beta2.QuoteInfo") + proto.RegisterType((*DateTime)(nil), "google.privacy.dlp.v2beta2.DateTime") + proto.RegisterType((*DateTime_TimeZone)(nil), "google.privacy.dlp.v2beta2.DateTime.TimeZone") proto.RegisterType((*DeidentifyConfig)(nil), "google.privacy.dlp.v2beta2.DeidentifyConfig") proto.RegisterType((*PrimitiveTransformation)(nil), "google.privacy.dlp.v2beta2.PrimitiveTransformation") proto.RegisterType((*TimePartConfig)(nil), "google.privacy.dlp.v2beta2.TimePartConfig") @@ -6437,6 +7711,7 @@ func init() { proto.RegisterType((*TransientCryptoKey)(nil), "google.privacy.dlp.v2beta2.TransientCryptoKey") proto.RegisterType((*UnwrappedCryptoKey)(nil), "google.privacy.dlp.v2beta2.UnwrappedCryptoKey") proto.RegisterType((*KmsWrappedCryptoKey)(nil), "google.privacy.dlp.v2beta2.KmsWrappedCryptoKey") + proto.RegisterType((*DateShiftConfig)(nil), "google.privacy.dlp.v2beta2.DateShiftConfig") proto.RegisterType((*InfoTypeTransformations)(nil), "google.privacy.dlp.v2beta2.InfoTypeTransformations") proto.RegisterType((*InfoTypeTransformations_InfoTypeTransformation)(nil), "google.privacy.dlp.v2beta2.InfoTypeTransformations.InfoTypeTransformation") proto.RegisterType((*FieldTransformation)(nil), "google.privacy.dlp.v2beta2.FieldTransformation") @@ -6449,14 +7724,27 @@ func init() { proto.RegisterType((*TransformationOverview)(nil), "google.privacy.dlp.v2beta2.TransformationOverview") proto.RegisterType((*TransformationSummary)(nil), "google.privacy.dlp.v2beta2.TransformationSummary") proto.RegisterType((*TransformationSummary_SummaryResult)(nil), "google.privacy.dlp.v2beta2.TransformationSummary.SummaryResult") + proto.RegisterType((*Schedule)(nil), "google.privacy.dlp.v2beta2.Schedule") proto.RegisterType((*InspectTemplate)(nil), "google.privacy.dlp.v2beta2.InspectTemplate") proto.RegisterType((*DeidentifyTemplate)(nil), "google.privacy.dlp.v2beta2.DeidentifyTemplate") + proto.RegisterType((*JobTrigger)(nil), "google.privacy.dlp.v2beta2.JobTrigger") + proto.RegisterType((*JobTrigger_Trigger)(nil), "google.privacy.dlp.v2beta2.JobTrigger.Trigger") + proto.RegisterType((*JobTrigger_Error)(nil), "google.privacy.dlp.v2beta2.JobTrigger.Error") + proto.RegisterType((*Action)(nil), "google.privacy.dlp.v2beta2.Action") + proto.RegisterType((*Action_SaveFindings)(nil), "google.privacy.dlp.v2beta2.Action.SaveFindings") + proto.RegisterType((*Action_PublishToPubSub)(nil), "google.privacy.dlp.v2beta2.Action.PublishToPubSub") proto.RegisterType((*CreateInspectTemplateRequest)(nil), "google.privacy.dlp.v2beta2.CreateInspectTemplateRequest") proto.RegisterType((*UpdateInspectTemplateRequest)(nil), "google.privacy.dlp.v2beta2.UpdateInspectTemplateRequest") proto.RegisterType((*GetInspectTemplateRequest)(nil), "google.privacy.dlp.v2beta2.GetInspectTemplateRequest") proto.RegisterType((*ListInspectTemplatesRequest)(nil), "google.privacy.dlp.v2beta2.ListInspectTemplatesRequest") proto.RegisterType((*ListInspectTemplatesResponse)(nil), "google.privacy.dlp.v2beta2.ListInspectTemplatesResponse") proto.RegisterType((*DeleteInspectTemplateRequest)(nil), "google.privacy.dlp.v2beta2.DeleteInspectTemplateRequest") + proto.RegisterType((*CreateJobTriggerRequest)(nil), "google.privacy.dlp.v2beta2.CreateJobTriggerRequest") + proto.RegisterType((*UpdateJobTriggerRequest)(nil), "google.privacy.dlp.v2beta2.UpdateJobTriggerRequest") + proto.RegisterType((*GetJobTriggerRequest)(nil), "google.privacy.dlp.v2beta2.GetJobTriggerRequest") + proto.RegisterType((*ListJobTriggersRequest)(nil), "google.privacy.dlp.v2beta2.ListJobTriggersRequest") + proto.RegisterType((*ListJobTriggersResponse)(nil), "google.privacy.dlp.v2beta2.ListJobTriggersResponse") + proto.RegisterType((*DeleteJobTriggerRequest)(nil), "google.privacy.dlp.v2beta2.DeleteJobTriggerRequest") proto.RegisterType((*InspectJobConfig)(nil), "google.privacy.dlp.v2beta2.InspectJobConfig") proto.RegisterType((*DlpJob)(nil), "google.privacy.dlp.v2beta2.DlpJob") proto.RegisterType((*GetDlpJobRequest)(nil), "google.privacy.dlp.v2beta2.GetDlpJobRequest") @@ -6473,11 +7761,13 @@ func init() { proto.RegisterEnum("google.privacy.dlp.v2beta2.InfoTypeSupportedBy", InfoTypeSupportedBy_name, InfoTypeSupportedBy_value) proto.RegisterEnum("google.privacy.dlp.v2beta2.RelationalOperator", RelationalOperator_name, RelationalOperator_value) proto.RegisterEnum("google.privacy.dlp.v2beta2.DlpJobType", DlpJobType_name, DlpJobType_value) + proto.RegisterEnum("google.privacy.dlp.v2beta2.OutputStorageConfig_OutputSchema", OutputStorageConfig_OutputSchema_name, OutputStorageConfig_OutputSchema_value) proto.RegisterEnum("google.privacy.dlp.v2beta2.TimePartConfig_TimePart", TimePartConfig_TimePart_name, TimePartConfig_TimePart_value) proto.RegisterEnum("google.privacy.dlp.v2beta2.CharsToIgnore_CommonCharsToIgnore", CharsToIgnore_CommonCharsToIgnore_name, CharsToIgnore_CommonCharsToIgnore_value) proto.RegisterEnum("google.privacy.dlp.v2beta2.CryptoReplaceFfxFpeConfig_FfxCommonNativeAlphabet", CryptoReplaceFfxFpeConfig_FfxCommonNativeAlphabet_name, CryptoReplaceFfxFpeConfig_FfxCommonNativeAlphabet_value) proto.RegisterEnum("google.privacy.dlp.v2beta2.RecordCondition_Expressions_LogicalOperator", RecordCondition_Expressions_LogicalOperator_name, RecordCondition_Expressions_LogicalOperator_value) proto.RegisterEnum("google.privacy.dlp.v2beta2.TransformationSummary_TransformationResultCode", TransformationSummary_TransformationResultCode_name, TransformationSummary_TransformationResultCode_value) + proto.RegisterEnum("google.privacy.dlp.v2beta2.JobTrigger_Status", JobTrigger_Status_name, JobTrigger_Status_value) proto.RegisterEnum("google.privacy.dlp.v2beta2.DlpJob_JobState", DlpJob_JobState_name, DlpJob_JobState_value) } @@ -6511,7 +7801,7 @@ type DlpServiceClient interface { // repository. [How-to guide](/dlp/docs/inspecting-storage) InspectDataSource(ctx context.Context, in *InspectDataSourceRequest, opts ...grpc.CallOption) (*DlpJob, error) // Schedules a job to compute risk analysis metrics over content in a Google - // Cloud Platform repository. [How-to guide}(/dlp/docs/compute-risk-analysis) + // Cloud Platform repository. [How-to guide](/dlp/docs/compute-risk-analysis) AnalyzeDataSourceRisk(ctx context.Context, in *AnalyzeDataSourceRiskRequest, opts ...grpc.CallOption) (*DlpJob, error) // Returns sensitive information types DLP supports. ListInfoTypes(ctx context.Context, in *ListInfoTypesRequest, opts ...grpc.CallOption) (*ListInfoTypesResponse, error) @@ -6537,6 +7827,17 @@ type DlpServiceClient interface { ListDeidentifyTemplates(ctx context.Context, in *ListDeidentifyTemplatesRequest, opts ...grpc.CallOption) (*ListDeidentifyTemplatesResponse, error) // Deletes inspect templates. DeleteDeidentifyTemplate(ctx context.Context, in *DeleteDeidentifyTemplateRequest, opts ...grpc.CallOption) (*google_protobuf3.Empty, error) + // Creates a job to run DLP actions such as scanning storage for sensitive + // information on a set schedule. + CreateJobTrigger(ctx context.Context, in *CreateJobTriggerRequest, opts ...grpc.CallOption) (*JobTrigger, error) + // Updates a job trigger. + UpdateJobTrigger(ctx context.Context, in *UpdateJobTriggerRequest, opts ...grpc.CallOption) (*JobTrigger, error) + // Gets a job trigger. + GetJobTrigger(ctx context.Context, in *GetJobTriggerRequest, opts ...grpc.CallOption) (*JobTrigger, error) + // Lists job triggers. + ListJobTriggers(ctx context.Context, in *ListJobTriggersRequest, opts ...grpc.CallOption) (*ListJobTriggersResponse, error) + // Deletes a job trigger. + DeleteJobTrigger(ctx context.Context, in *DeleteJobTriggerRequest, opts ...grpc.CallOption) (*google_protobuf3.Empty, error) // Lists DlpJobs that match the specified filter in the request. ListDlpJobs(ctx context.Context, in *ListDlpJobsRequest, opts ...grpc.CallOption) (*ListDlpJobsResponse, error) // Gets the latest state of a long-running DlpJob. @@ -6712,6 +8013,51 @@ func (c *dlpServiceClient) DeleteDeidentifyTemplate(ctx context.Context, in *Del return out, nil } +func (c *dlpServiceClient) CreateJobTrigger(ctx context.Context, in *CreateJobTriggerRequest, opts ...grpc.CallOption) (*JobTrigger, error) { + out := new(JobTrigger) + err := grpc.Invoke(ctx, "/google.privacy.dlp.v2beta2.DlpService/CreateJobTrigger", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dlpServiceClient) UpdateJobTrigger(ctx context.Context, in *UpdateJobTriggerRequest, opts ...grpc.CallOption) (*JobTrigger, error) { + out := new(JobTrigger) + err := grpc.Invoke(ctx, "/google.privacy.dlp.v2beta2.DlpService/UpdateJobTrigger", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dlpServiceClient) GetJobTrigger(ctx context.Context, in *GetJobTriggerRequest, opts ...grpc.CallOption) (*JobTrigger, error) { + out := new(JobTrigger) + err := grpc.Invoke(ctx, "/google.privacy.dlp.v2beta2.DlpService/GetJobTrigger", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dlpServiceClient) ListJobTriggers(ctx context.Context, in *ListJobTriggersRequest, opts ...grpc.CallOption) (*ListJobTriggersResponse, error) { + out := new(ListJobTriggersResponse) + err := grpc.Invoke(ctx, "/google.privacy.dlp.v2beta2.DlpService/ListJobTriggers", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dlpServiceClient) DeleteJobTrigger(ctx context.Context, in *DeleteJobTriggerRequest, opts ...grpc.CallOption) (*google_protobuf3.Empty, error) { + out := new(google_protobuf3.Empty) + err := grpc.Invoke(ctx, "/google.privacy.dlp.v2beta2.DlpService/DeleteJobTrigger", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *dlpServiceClient) ListDlpJobs(ctx context.Context, in *ListDlpJobsRequest, opts ...grpc.CallOption) (*ListDlpJobsResponse, error) { out := new(ListDlpJobsResponse) err := grpc.Invoke(ctx, "/google.privacy.dlp.v2beta2.DlpService/ListDlpJobs", in, out, c.cc, opts...) @@ -6770,7 +8116,7 @@ type DlpServiceServer interface { // repository. [How-to guide](/dlp/docs/inspecting-storage) InspectDataSource(context.Context, *InspectDataSourceRequest) (*DlpJob, error) // Schedules a job to compute risk analysis metrics over content in a Google - // Cloud Platform repository. [How-to guide}(/dlp/docs/compute-risk-analysis) + // Cloud Platform repository. [How-to guide](/dlp/docs/compute-risk-analysis) AnalyzeDataSourceRisk(context.Context, *AnalyzeDataSourceRiskRequest) (*DlpJob, error) // Returns sensitive information types DLP supports. ListInfoTypes(context.Context, *ListInfoTypesRequest) (*ListInfoTypesResponse, error) @@ -6796,6 +8142,17 @@ type DlpServiceServer interface { ListDeidentifyTemplates(context.Context, *ListDeidentifyTemplatesRequest) (*ListDeidentifyTemplatesResponse, error) // Deletes inspect templates. DeleteDeidentifyTemplate(context.Context, *DeleteDeidentifyTemplateRequest) (*google_protobuf3.Empty, error) + // Creates a job to run DLP actions such as scanning storage for sensitive + // information on a set schedule. + CreateJobTrigger(context.Context, *CreateJobTriggerRequest) (*JobTrigger, error) + // Updates a job trigger. + UpdateJobTrigger(context.Context, *UpdateJobTriggerRequest) (*JobTrigger, error) + // Gets a job trigger. + GetJobTrigger(context.Context, *GetJobTriggerRequest) (*JobTrigger, error) + // Lists job triggers. + ListJobTriggers(context.Context, *ListJobTriggersRequest) (*ListJobTriggersResponse, error) + // Deletes a job trigger. + DeleteJobTrigger(context.Context, *DeleteJobTriggerRequest) (*google_protobuf3.Empty, error) // Lists DlpJobs that match the specified filter in the request. ListDlpJobs(context.Context, *ListDlpJobsRequest) (*ListDlpJobsResponse, error) // Gets the latest state of a long-running DlpJob. @@ -7120,6 +8477,96 @@ func _DlpService_DeleteDeidentifyTemplate_Handler(srv interface{}, ctx context.C return interceptor(ctx, in, info, handler) } +func _DlpService_CreateJobTrigger_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateJobTriggerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DlpServiceServer).CreateJobTrigger(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.privacy.dlp.v2beta2.DlpService/CreateJobTrigger", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DlpServiceServer).CreateJobTrigger(ctx, req.(*CreateJobTriggerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DlpService_UpdateJobTrigger_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateJobTriggerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DlpServiceServer).UpdateJobTrigger(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.privacy.dlp.v2beta2.DlpService/UpdateJobTrigger", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DlpServiceServer).UpdateJobTrigger(ctx, req.(*UpdateJobTriggerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DlpService_GetJobTrigger_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetJobTriggerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DlpServiceServer).GetJobTrigger(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.privacy.dlp.v2beta2.DlpService/GetJobTrigger", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DlpServiceServer).GetJobTrigger(ctx, req.(*GetJobTriggerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DlpService_ListJobTriggers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListJobTriggersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DlpServiceServer).ListJobTriggers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.privacy.dlp.v2beta2.DlpService/ListJobTriggers", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DlpServiceServer).ListJobTriggers(ctx, req.(*ListJobTriggersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DlpService_DeleteJobTrigger_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteJobTriggerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DlpServiceServer).DeleteJobTrigger(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.privacy.dlp.v2beta2.DlpService/DeleteJobTrigger", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DlpServiceServer).DeleteJobTrigger(ctx, req.(*DeleteJobTriggerRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _DlpService_ListDlpJobs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ListDlpJobsRequest) if err := dec(in); err != nil { @@ -7264,6 +8711,26 @@ var _DlpService_serviceDesc = grpc.ServiceDesc{ MethodName: "DeleteDeidentifyTemplate", Handler: _DlpService_DeleteDeidentifyTemplate_Handler, }, + { + MethodName: "CreateJobTrigger", + Handler: _DlpService_CreateJobTrigger_Handler, + }, + { + MethodName: "UpdateJobTrigger", + Handler: _DlpService_UpdateJobTrigger_Handler, + }, + { + MethodName: "GetJobTrigger", + Handler: _DlpService_GetJobTrigger_Handler, + }, + { + MethodName: "ListJobTriggers", + Handler: _DlpService_ListJobTriggers_Handler, + }, + { + MethodName: "DeleteJobTrigger", + Handler: _DlpService_DeleteJobTrigger_Handler, + }, { MethodName: "ListDlpJobs", Handler: _DlpService_ListDlpJobs_Handler, @@ -7288,417 +8755,488 @@ var _DlpService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("google/privacy/dlp/v2beta2/dlp.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 6587 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x7d, 0x6b, 0x6c, 0x1b, 0xd9, - 0x75, 0xb0, 0x86, 0x14, 0x25, 0xf2, 0x90, 0x94, 0xa8, 0xab, 0x87, 0x65, 0xda, 0x5e, 0x7b, 0x67, - 0x77, 0x1d, 0xaf, 0x77, 0x23, 0x65, 0xb5, 0xeb, 0x38, 0x6b, 0x7f, 0xde, 0x2c, 0x45, 0xd1, 0x96, - 0x6c, 0x49, 0xd4, 0x0e, 0x29, 0xaf, 0x9d, 0xdd, 0x6f, 0xe7, 0x1b, 0x91, 0x57, 0xd4, 0xac, 0xc8, - 0x19, 0x7a, 0x66, 0x68, 0x49, 0x9b, 0x2f, 0x5f, 0xbe, 0xb6, 0x48, 0x91, 0x34, 0x40, 0x1f, 0x48, - 0x80, 0x2d, 0x90, 0x02, 0x49, 0x80, 0x04, 0x48, 0x82, 0x22, 0x7d, 0xa4, 0x68, 0xd1, 0x3c, 0x80, - 0x34, 0x41, 0xd1, 0xf7, 0x8f, 0x22, 0x40, 0x81, 0xa2, 0x28, 0x5a, 0xb4, 0x05, 0x8a, 0x3e, 0x50, - 0x14, 0xfd, 0xd1, 0x7f, 0x05, 0x8a, 0xfb, 0x98, 0x27, 0x87, 0x43, 0x52, 0x92, 0xd1, 0x36, 0xff, - 0x38, 0xe7, 0x9e, 0x73, 0xee, 0xb9, 0xe7, 0x9e, 0x7b, 0xee, 0xb9, 0xe7, 0x3e, 0x08, 0xcf, 0x36, - 0x74, 0xbd, 0xd1, 0xc4, 0x8b, 0x6d, 0x43, 0x7d, 0xac, 0xd4, 0x8e, 0x16, 0xeb, 0xcd, 0xf6, 0xe2, - 0xe3, 0xa5, 0x1d, 0x6c, 0x29, 0x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0xb3, 0x89, 0x0d, 0xca, 0x66, 0xc2, 0xa1, 0xb4, 0x79, 0xa5, 0xd5, 0x96, 0xd2, 0xc0, 0xf2, - 0x8e, 0x7e, 0x88, 0x4d, 0xee, 0x92, 0x9e, 0x8f, 0xec, 0x26, 0x82, 0xee, 0x68, 0x08, 0x28, 0xf5, - 0x32, 0x21, 0x46, 0x2b, 0x00, 0x06, 0xae, 0xe9, 0x46, 0x5d, 0xde, 0xc7, 0x47, 0x5c, 0xcf, 0x91, - 0xc3, 0x42, 0xa2, 0xd8, 0xf7, 0xf0, 0x91, 0x94, 0x32, 0xec, 0x9f, 0xe8, 0x35, 0x62, 0xc8, 0x64, - 0xd2, 0x57, 0xeb, 0x74, 0xba, 0x18, 0x74, 0x58, 0xee, 0xb2, 0x1f, 0x68, 0x0b, 0x26, 0xe8, 0xa8, - 0x97, 0x9d, 0x1e, 0x67, 0x9d, 0xf5, 0x7c, 0xdf, 0x01, 0xea, 0x34, 0x2a, 0x6b, 0x79, 0x3f, 0xc5, - 0x17, 0x21, 0xeb, 0x2b, 0x47, 0xe7, 0x20, 0x65, 0xe8, 0x07, 0xb2, 0xaa, 0xd5, 0xf1, 0x21, 0xed, - 0xc1, 0xb8, 0x94, 0x34, 0xf4, 0x83, 0x35, 0xf2, 0x2d, 0x2e, 0x42, 0x82, 0xa9, 0x76, 0x06, 0x12, - 0xa6, 0xa5, 0x18, 0x16, 0xc7, 0x60, 0x1f, 0x28, 0x07, 0x71, 0xac, 0xb1, 0x71, 0x15, 0x97, 0xc8, - 0x4f, 0xb1, 0x06, 0x59, 0x9f, 0x4e, 0x09, 0x8a, 0xa5, 0xb7, 0xf9, 0x84, 0x44, 0x7e, 0x12, 0xef, - 0xd9, 0xc4, 0xbb, 0xf6, 0x6c, 0x43, 0x7f, 0x13, 0xf6, 0x07, 0x6a, 0xdd, 0xda, 0xa3, 0xc3, 0x22, - 0x21, 0xb1, 0x0f, 0x34, 0x07, 0x63, 0x7b, 0x58, 0x6d, 0xec, 0x59, 0x54, 0xff, 0x09, 0x89, 0x7f, - 0x89, 0xef, 0x8f, 0x02, 0x92, 0x70, 0x5d, 0xa9, 0x59, 0xb4, 0x2e, 0x7b, 0x86, 0x9a, 0x83, 0xb1, - 0xb6, 0x62, 0x60, 0xcd, 0xe2, 0x43, 0x97, 0x7f, 0x11, 0x25, 0xaa, 0xcc, 0xbd, 0xc8, 0x35, 0x3a, - 0xf7, 0x70, 0x0b, 0x7b, 0x7e, 0xe0, 0xc9, 0x4a, 0xca, 0xaa, 0xbe, 0xc8, 0xe8, 0x02, 0x30, 0x53, - 0xb1, 0xa7, 0x3e, 0x52, 0x5b, 0x8a, 0x42, 0xe8, 0x48, 0x77, 0x8a, 0xe9, 0x8c, 0x40, 0x64, 0xcf, - 0xf0, 0xe2, 0x15, 0x32, 0x29, 0x7c, 0x1c, 0xce, 0xb0, 0x62, 0x83, 0xb6, 0x41, 0xd5, 0x35, 0x2e, - 0x17, 0x09, 0x29, 0x88, 0xc9, 0x16, 0xa3, 0xed, 0x2c, 0xd8, 0xf0, 0x05, 0xfe, 0xc1, 0x99, 0x71, - 0x91, 0x67, 0xd5, 0x10, 0xa8, 0x99, 0xff, 0x0b, 0x01, 0x66, 0xc2, 0xf0, 0x51, 0xf1, 0x98, 0x53, - 0xe9, 0xea, 0x88, 0xc7, 0xc7, 0x5d, 0x81, 0x49, 0xd6, 0x28, 0x59, 0x69, 0x36, 0x65, 0x0b, 0x1f, - 0xb2, 0x6e, 0x4e, 0xae, 0x8e, 0x48, 0x59, 0x56, 0x50, 0x68, 0x36, 0xab, 0xf8, 0xd0, 0x22, 0xe3, - 0xde, 0xdb, 0xfc, 0xa6, 0x6e, 0xf0, 0x88, 0x2e, 0x72, 0xdc, 0x17, 0x09, 0xa2, 0x34, 0x61, 0xb8, - 0xb2, 0x37, 0x75, 0x63, 0x39, 0x09, 0x63, 0x96, 0x62, 0x34, 0xb0, 0x25, 0x16, 0x21, 0x41, 0x41, - 0xc4, 0xec, 0x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7c, 0x05, 0xe6, 0xc2, 0xfb, 0xf5, 0x24, 0x4c, 0xdf, 0x17, 0x20, 0x17, 0xec, 0x35, 0xf4, - 0x3a, 0xa4, 0x1e, 0x75, 0x14, 0x53, 0x95, 0xd5, 0xfa, 0x50, 0x29, 0xef, 0x24, 0xa5, 0x5a, 0xab, - 0xd3, 0x38, 0x86, 0x04, 0xee, 0xd6, 0x91, 0xac, 0xd6, 0x07, 0xc9, 0xe9, 0x96, 0x28, 0x32, 0x61, - 0x81, 0xf9, 0xaf, 0xfc, 0x37, 0x04, 0xc8, 0x05, 0xfb, 0xf8, 0x14, 0x24, 0xab, 0xc2, 0xb4, 0x89, - 0x35, 0x53, 0xb5, 0xd4, 0xc7, 0x58, 0x56, 0x2c, 0xcb, 0x50, 0x77, 0x3a, 0x96, 0xed, 0x46, 0x06, - 0xe2, 0x85, 0x1c, 0xfa, 0x82, 0x4d, 0x9e, 0xff, 0xdc, 0x38, 0xcc, 0x84, 0xd9, 0x07, 0x6a, 0x74, - 0x0b, 0x7c, 0xf7, 0x64, 0x26, 0xb7, 0x50, 0x55, 0x1a, 0x0d, 0x5c, 0xa7, 0xd2, 0x78, 0xda, 0x75, - 0x11, 0xd2, 0x06, 0x6e, 0x30, 0xfb, 0xae, 0xdb, 0x53, 0x28, 0x30, 0x10, 0x9d, 0xb0, 0x0e, 0x21, - 0xa7, 0x74, 0x0e, 0xd5, 0xa6, 0xaa, 0x18, 0x47, 0xcc, 0x77, 0xda, 0x33, 0xfd, 0xc6, 0x09, 0x05, - 0x2a, 0xd8, 0x6c, 0x99, 0x83, 0x9d, 0x54, 0x7c, 0xdf, 0x66, 0xfe, 0x9f, 0x04, 0x48, 0x7b, 0x84, - 0x3e, 0x81, 0xb9, 0xfa, 0x33, 0x69, 0xb1, 0x63, 0x66, 0xd2, 0x2e, 0x02, 0xf0, 0x4d, 0x44, 0x4b, - 0x69, 0x38, 0xdb, 0x47, 0x29, 0x06, 0xab, 0x2a, 0x0d, 0xf4, 0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58, 0x48, 0x8e, 0x17, 0x38, 0x64, 0xe8, 0x59, 0x98, 0xd0, 0x3a, 0xad, 0x1d, 0x6c, 0x10, - 0x0d, 0x93, 0x52, 0x7e, 0x9f, 0x20, 0xc3, 0xa0, 0x55, 0x9d, 0x30, 0x26, 0x41, 0xb0, 0x81, 0xc9, - 0xc2, 0x06, 0xcb, 0xba, 0x51, 0xc7, 0xec, 0x8c, 0x79, 0x92, 0xcc, 0x5f, 0x14, 0x58, 0x26, 0x30, - 0xf4, 0x16, 0xcc, 0x84, 0x76, 0xd8, 0x68, 0xff, 0xfb, 0x23, 0x3e, 0x45, 0x4b, 0xa8, 0xd6, 0xdd, - 0x29, 0x3f, 0x14, 0x60, 0xbe, 0x97, 0xf3, 0x47, 0xcb, 0x90, 0x0e, 0xae, 0x41, 0x07, 0x32, 0x71, - 0x68, 0xba, 0xeb, 0xd1, 0x65, 0x48, 0x07, 0x57, 0x9d, 0x83, 0xf1, 0xe8, 0x44, 0xae, 0x40, 0x05, - 0xef, 0x32, 0x40, 0xfc, 0x4a, 0x0c, 0x26, 0x83, 0xc2, 0xaf, 0xc3, 0xb8, 0x9d, 0x5a, 0x61, 0x8b, - 0xa3, 0xa5, 0x21, 0x26, 0x25, 0xfe, 0x2d, 0xd9, 0x2c, 0xf2, 0x3f, 0x10, 0x60, 0x8c, 0x2f, 0x6f, - 0x5e, 0x86, 0x78, 0x4b, 0xd5, 0x06, 0xd7, 0x06, 0xc1, 0xa6, 0x44, 0xca, 0xe1, 0xe0, 0xcd, 0x27, - 0xd8, 0x68, 0x13, 0xa6, 0xf8, 0x44, 0xd5, 0xc2, 0x9a, 0xe5, 0x09, 0xc9, 0x07, 0x62, 0x91, 0xf3, - 0xd0, 0x32, 0x87, 0xf3, 0x67, 0xa3, 0x70, 0xb6, 0x67, 0x88, 0x71, 0x3a, 0xae, 0x12, 0xdd, 0x82, - 0xf1, 0x9a, 0xae, 0x39, 0x17, 0x0b, 0x06, 0xbd, 0x51, 0xc4, 0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, 0x5a, 0x26, 0xc5, 0x7f, 0x68, 0x17, 0xbd, 0x4d, 0x8b, - 0xde, 0x5e, 0x69, 0xb6, 0xdf, 0xbe, 0xcf, 0x28, 0x77, 0xc6, 0x28, 0xff, 0x97, 0xff, 0x33, 0x00, - 0x00, 0xff, 0xff, 0x78, 0xae, 0x10, 0x67, 0xc0, 0x6a, 0x00, 0x00, + // 7722 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x7d, 0x5b, 0x6c, 0x23, 0x57, + 0x96, 0x98, 0x8a, 0x14, 0x25, 0xf2, 0x90, 0x94, 0xa8, 0xab, 0x47, 0xab, 0xd9, 0xdd, 0xee, 0x76, + 0x79, 0xdc, 0xd3, 0x96, 0x6d, 0xc9, 0x96, 0xdd, 0xe3, 0x71, 0x7b, 0xec, 0x31, 0x45, 0xb1, 0x5b, + 0x6a, 0x4b, 0xa2, 0x5c, 0xa4, 0xda, 0x6e, 0xdb, 0x71, 0xa5, 0x44, 0x5e, 0x51, 0xd5, 0x22, 0xab, + 0xd8, 0x55, 0xc5, 0x96, 0xe8, 0xcd, 0x26, 0x9b, 0x04, 0x9b, 0xec, 0x66, 0x83, 0x64, 0x17, 0x3b, + 0xc8, 0x24, 0x98, 0x20, 0xb3, 0x0b, 0xcc, 0xc7, 0x66, 0xb1, 0xc8, 0x13, 0xc8, 0xc7, 0xee, 0x04, + 0x48, 0x76, 0x3e, 0xb2, 0xc8, 0xe3, 0x6b, 0x81, 0x01, 0x82, 0x60, 0x91, 0x60, 0x93, 0x60, 0x91, + 0x07, 0xf2, 0x42, 0x32, 0x7f, 0x09, 0x82, 0xfb, 0xa8, 0x27, 0x8b, 0xc5, 0xa2, 0xa4, 0x46, 0xb2, + 0xfb, 0x25, 0xd6, 0xb9, 0xe7, 0x9c, 0x7b, 0xee, 0xb9, 0xe7, 0x9e, 0x7b, 0xee, 0xb9, 0x0f, 0xc1, +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46, 0x0e, 0xc0, 0x55, 0x89, 0xf8, 0x1f, 0x89, 0x9c, 0x21, 0x73, 0xc7, 0xab, 0x30, 0x47, + 0x26, 0x26, 0xea, 0x47, 0xed, 0x62, 0x7e, 0x08, 0xa9, 0xc0, 0x0b, 0x1c, 0x32, 0xf4, 0x35, 0x98, + 0xd1, 0x7a, 0x9d, 0x43, 0x6c, 0x10, 0x0d, 0x93, 0x52, 0x7e, 0x99, 0x27, 0xc7, 0xa0, 0x75, 0x9d, + 0x30, 0x26, 0xab, 0x23, 0x03, 0x93, 0x15, 0x2f, 0x96, 0x75, 0xa3, 0x89, 0xd9, 0x05, 0x8f, 0x34, + 0x99, 0x1a, 0x29, 0xb0, 0x4a, 0x60, 0xe8, 0x73, 0x58, 0x08, 0xed, 0xb0, 0xc9, 0xd1, 0x97, 0xb7, + 0x7c, 0x8a, 0x96, 0x50, 0x63, 0xb0, 0x53, 0x7e, 0x24, 0xc0, 0xf2, 0xb0, 0x79, 0x05, 0x6d, 0x40, + 0x36, 0x98, 0x9c, 0x88, 0x65, 0xe2, 0xd0, 0x76, 0x13, 0x15, 0x1b, 0x90, 0x0d, 0xa6, 0x23, 0xe2, + 0xf1, 0xe8, 0x45, 0xa6, 0x26, 0x04, 0xef, 0xfa, 0x50, 0xfc, 0x41, 0x02, 0x66, 0x83, 0xc2, 0xef, + 0xc0, 0xb4, 0x9d, 0x73, 0x63, 0xab, 0xe6, 0xf5, 0x31, 0xe6, 0x3b, 0xfe, 0x2d, 0xd9, 0x2c, 0x8a, + 0xbf, 0x2d, 0xc0, 0x14, 0x5f, 0xf7, 0xbe, 0x05, 0xc9, 0x8e, 0xaa, 0xc5, 0xd7, 0x06, 0xc1, 0xa6, + 0x44, 0xca, 0x59, 0xfc, 0xe6, 0x13, 0x6c, 0xb4, 0x07, 0x73, 0x7c, 0x0e, 0xec, 0x60, 0xcd, 0xf2, + 0xac, 0xd5, 0x62, 0xb1, 0x28, 0x78, 0x68, 0x99, 0xc3, 0xf9,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, + 0xe3, 0x58, 0x03, 0xda, 0x83, 0x0c, 0x0d, 0x46, 0x54, 0xfb, 0x94, 0xe6, 0x88, 0x05, 0x47, 0xdd, + 0x46, 0x76, 0x58, 0xd0, 0x15, 0xbe, 0x0d, 0x25, 0xfc, 0x7a, 0xda, 0xa9, 0xa1, 0x74, 0xbb, 0xd8, + 0x76, 0x20, 0x91, 0xfc, 0x0e, 0x6c, 0x64, 0x1f, 0x3f, 0x87, 0x05, 0x92, 0x20, 0x7b, 0xd2, 0x31, + 0x65, 0x9b, 0x63, 0x8c, 0x15, 0xc6, 0x47, 0x1d, 0xf3, 0x93, 0x41, 0x96, 0x70, 0xe2, 0x80, 0x37, + 0xd2, 0x30, 0xc5, 0xce, 0x29, 0x88, 0x77, 0x00, 0x0d, 0x36, 0x28, 0xec, 0x80, 0xb0, 0x78, 0x1b, + 0xd0, 0xa0, 0xa8, 0xa8, 0x00, 0x49, 0x7b, 0xfc, 0xe5, 0x24, 0xf2, 0x53, 0xfc, 0x12, 0xe6, 0x43, + 0x04, 0x20, 0x5e, 0x91, 0x13, 0xcb, 0x2e, 0x01, 0x70, 0x10, 0x41, 0xb8, 0x0d, 0xb3, 0xee, 0x80, + 0xf6, 0x9e, 0x41, 0xce, 0x3b, 0xc3, 0x95, 0xde, 0x01, 0xf9, 0x89, 0x00, 0xb3, 0x81, 0x18, 0x13, + 0xdd, 0x81, 0x82, 0xc7, 0x6d, 0xcb, 0x4d, 0xa5, 0x6f, 0x2f, 0xc2, 0x67, 0x5c, 0xc7, 0xbc, 0xa9, + 0xf4, 0x4d, 0x82, 0xe9, 0x99, 0x24, 0x18, 0x26, 0x9b, 0xeb, 0x66, 0xdc, 0x69, 0x80, 0x62, 0x7a, + 0x5c, 0x43, 0xf2, 0x1c, 0xae, 0xe1, 0xbe, 0xcf, 0x3f, 0x4d, 0x8e, 0xe1, 0x9f, 0xe8, 0x91, 0x25, + 0xfb, 0x83, 0x74, 0x55, 0x07, 0x5b, 0xc7, 0x7a, 0x53, 0xfc, 0xd7, 0x09, 0xb8, 0x32, 0x64, 0xbd, + 0x8f, 0x2c, 0x98, 0x1d, 0xcc, 0x1e, 0x8c, 0x3c, 0x93, 0x36, 0x84, 0xdb, 0x10, 0xb8, 0x14, 0xac, + 0xa2, 0xf8, 0x2f, 0x04, 0x58, 0x0a, 0xc7, 0xbd, 0x9c, 0x17, 0x4b, 0x34, 0x58, 0xee, 0xda, 0xb9, + 0x82, 0x40, 0xb6, 0x82, 0x8f, 0xac, 0xb7, 0x46, 0x9c, 0xde, 0x09, 0xcb, 0x33, 0x48, 0x57, 0xba, + 0xe1, 0x05, 0xe2, 0x77, 0x92, 0x30, 0x4f, 0x3b, 0x32, 0xd0, 0x98, 0xf7, 0x60, 0x8a, 0x1e, 0x4b, + 0x1a, 0xeb, 0x64, 0x22, 0x27, 0x41, 0xdb, 0x90, 0x69, 0xe8, 0x5a, 0x53, 0xa5, 0x52, 0x27, 0x47, + 0xaf, 0x9f, 0x58, 0x8a, 0xa5, 0x6c, 0x93, 0x48, 0x2e, 0x35, 0xea, 0x46, 0xe8, 0x63, 0xf2, 0xdc, + 0xfa, 0xd8, 0x9a, 0x18, 0xaa, 0x91, 0xe8, 0xfc, 0x54, 0xea, 0x79, 0xe4, 0xa7, 0x42, 0x16, 0x87, + 0xbf, 0x27, 0xc0, 0x62, 0x68, 0xe2, 0x09, 0x35, 0x61, 0x91, 0x5d, 0xc7, 0x0f, 0x37, 0xfe, 0xb5, + 0x91, 0xfd, 0x14, 0xb0, 0x8c, 0x85, 0xa3, 0x41, 0xa0, 0x89, 0xbe, 0x84, 0x79, 0x9e, 0x31, 0x33, + 0x7b, 0xdd, 0xae, 0x81, 0x4d, 0x93, 0xa7, 0xcb, 0x92, 0xa3, 0x52, 0x88, 0x4c, 0xea, 0x9a, 0x4b, + 0x25, 0x21, 0x23, 0x08, 0x32, 0xc5, 0x2f, 0x61, 0x6e, 0x00, 0xd1, 0x6f, 0x36, 0xc2, 0x45, 0xcc, + 0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ac, 0x6c, 0xfc, 0xaa, 0x00, 0x2f, 0x34, 0xf4, 0x4e, 0x84, 0x18, 0x1b, 0xe9, + 0xcd, 0x76, 0x77, 0x9f, 0xd4, 0xb6, 0x2f, 0x7c, 0xf6, 0x3e, 0xc7, 0x6b, 0xe9, 0x6d, 0x45, 0x6b, + 0xad, 0xea, 0x46, 0x6b, 0xad, 0x85, 0x35, 0x2a, 0xcb, 0x1a, 0x2b, 0x52, 0xba, 0xaa, 0x19, 0xf6, + 0x7f, 0xc4, 0xdf, 0x6b, 0xb6, 0xbb, 0xbf, 0x9e, 0x58, 0x7e, 0xc0, 0xe8, 0xcb, 0x6d, 0xbd, 0xd7, + 0x24, 0x7d, 0xb9, 0xfa, 0x68, 0x7d, 0x83, 0x14, 0xff, 0x53, 0xbb, 0xe8, 0x0b, 0x5a, 0xf4, 0xc5, + 0x66, 0xbb, 0xfb, 0xc5, 0x23, 0x46, 0x79, 0x38, 0x45, 0xf9, 0xbf, 0xf5, 0x7f, 0x03, 0x00, 0x00, + 0xff, 0xff, 0x25, 0x3f, 0xe2, 0xc3, 0x06, 0x7d, 0x00, 0x00, } diff --git a/vendor/google.golang.org/genproto/googleapis/privacy/dlp/v2beta2/storage.pb.go b/vendor/google.golang.org/genproto/googleapis/privacy/dlp/v2beta2/storage.pb.go index ab4fdec57..02bf32791 100644 --- a/vendor/google.golang.org/genproto/googleapis/privacy/dlp/v2beta2/storage.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/privacy/dlp/v2beta2/storage.pb.go @@ -7,7 +7,7 @@ import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" import _ "google.golang.org/genproto/googleapis/api/annotations" -import _ "github.com/golang/protobuf/ptypes/timestamp" +import google_protobuf1 "github.com/golang/protobuf/ptypes/timestamp" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -77,10 +77,19 @@ type CustomInfoType struct { // Info type configuration. All custom info types must have configurations // that do not conflict with built-in info types or other custom info types. InfoType *InfoType `protobuf:"bytes,1,opt,name=info_type,json=infoType" json:"info_type,omitempty"` + // Likelihood to return for this custom info type. This base value can be + // altered by a detection rule if the finding meets the criteria specified by + // the rule. Defaults to `VERY_LIKELY` if not specified. + Likelihood Likelihood `protobuf:"varint,6,opt,name=likelihood,enum=google.privacy.dlp.v2beta2.Likelihood" json:"likelihood,omitempty"` // Types that are valid to be assigned to Type: // *CustomInfoType_Dictionary_ + // *CustomInfoType_Regex_ // *CustomInfoType_SurrogateType_ Type isCustomInfoType_Type `protobuf_oneof:"type"` + // Set of detection rules to apply to all findings of this custom info type. + // Rules are applied in order that they are specified. Not supported for the + // `surrogate_type` custom info type. + DetectionRules []*CustomInfoType_DetectionRule `protobuf:"bytes,7,rep,name=detection_rules,json=detectionRules" json:"detection_rules,omitempty"` } func (m *CustomInfoType) Reset() { *m = CustomInfoType{} } @@ -95,11 +104,15 @@ type isCustomInfoType_Type interface { type CustomInfoType_Dictionary_ struct { Dictionary *CustomInfoType_Dictionary `protobuf:"bytes,2,opt,name=dictionary,oneof"` } +type CustomInfoType_Regex_ struct { + Regex *CustomInfoType_Regex `protobuf:"bytes,3,opt,name=regex,oneof"` +} type CustomInfoType_SurrogateType_ struct { SurrogateType *CustomInfoType_SurrogateType `protobuf:"bytes,4,opt,name=surrogate_type,json=surrogateType,oneof"` } func (*CustomInfoType_Dictionary_) isCustomInfoType_Type() {} +func (*CustomInfoType_Regex_) isCustomInfoType_Type() {} func (*CustomInfoType_SurrogateType_) isCustomInfoType_Type() {} func (m *CustomInfoType) GetType() isCustomInfoType_Type { @@ -116,6 +129,13 @@ func (m *CustomInfoType) GetInfoType() *InfoType { return nil } +func (m *CustomInfoType) GetLikelihood() Likelihood { + if m != nil { + return m.Likelihood + } + return Likelihood_LIKELIHOOD_UNSPECIFIED +} + func (m *CustomInfoType) GetDictionary() *CustomInfoType_Dictionary { if x, ok := m.GetType().(*CustomInfoType_Dictionary_); ok { return x.Dictionary @@ -123,6 +143,13 @@ func (m *CustomInfoType) GetDictionary() *CustomInfoType_Dictionary { return nil } +func (m *CustomInfoType) GetRegex() *CustomInfoType_Regex { + if x, ok := m.GetType().(*CustomInfoType_Regex_); ok { + return x.Regex + } + return nil +} + func (m *CustomInfoType) GetSurrogateType() *CustomInfoType_SurrogateType { if x, ok := m.GetType().(*CustomInfoType_SurrogateType_); ok { return x.SurrogateType @@ -130,10 +157,18 @@ func (m *CustomInfoType) GetSurrogateType() *CustomInfoType_SurrogateType { return nil } +func (m *CustomInfoType) GetDetectionRules() []*CustomInfoType_DetectionRule { + if m != nil { + return m.DetectionRules + } + return nil +} + // XXX_OneofFuncs is for the internal use of the proto package. func (*CustomInfoType) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { return _CustomInfoType_OneofMarshaler, _CustomInfoType_OneofUnmarshaler, _CustomInfoType_OneofSizer, []interface{}{ (*CustomInfoType_Dictionary_)(nil), + (*CustomInfoType_Regex_)(nil), (*CustomInfoType_SurrogateType_)(nil), } } @@ -147,6 +182,11 @@ func _CustomInfoType_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { if err := b.EncodeMessage(x.Dictionary); err != nil { return err } + case *CustomInfoType_Regex_: + b.EncodeVarint(3<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.Regex); err != nil { + return err + } case *CustomInfoType_SurrogateType_: b.EncodeVarint(4<<3 | proto.WireBytes) if err := b.EncodeMessage(x.SurrogateType); err != nil { @@ -170,6 +210,14 @@ func _CustomInfoType_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto err := b.DecodeMessage(msg) m.Type = &CustomInfoType_Dictionary_{msg} return true, err + case 3: // type.regex + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(CustomInfoType_Regex) + err := b.DecodeMessage(msg) + m.Type = &CustomInfoType_Regex_{msg} + return true, err case 4: // type.surrogate_type if wire != proto.WireBytes { return true, proto.ErrInternalBadWireType @@ -192,6 +240,11 @@ func _CustomInfoType_OneofSizer(msg proto.Message) (n int) { n += proto.SizeVarint(2<<3 | proto.WireBytes) n += proto.SizeVarint(uint64(s)) n += s + case *CustomInfoType_Regex_: + s := proto.Size(x.Regex) + n += proto.SizeVarint(3<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s case *CustomInfoType_SurrogateType_: s := proto.Size(x.SurrogateType) n += proto.SizeVarint(4<<3 | proto.WireBytes) @@ -335,6 +388,24 @@ func (m *CustomInfoType_Dictionary_WordList) GetWords() []string { return nil } +// Message defining a custom regular expression. +type CustomInfoType_Regex struct { + // Pattern defining the regular expression. + Pattern string `protobuf:"bytes,1,opt,name=pattern" json:"pattern,omitempty"` +} + +func (m *CustomInfoType_Regex) Reset() { *m = CustomInfoType_Regex{} } +func (m *CustomInfoType_Regex) String() string { return proto.CompactTextString(m) } +func (*CustomInfoType_Regex) ProtoMessage() {} +func (*CustomInfoType_Regex) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1, 1} } + +func (m *CustomInfoType_Regex) GetPattern() string { + if m != nil { + return m.Pattern + } + return "" +} + // Message for detecting output from deidentification transformations // such as // [`CryptoReplaceFfxFpeConfig`](/dlp/docs/reference/rest/v2beta1/content/deidentify#CryptoReplaceFfxFpeConfig). @@ -349,7 +420,301 @@ type CustomInfoType_SurrogateType struct { func (m *CustomInfoType_SurrogateType) Reset() { *m = CustomInfoType_SurrogateType{} } func (m *CustomInfoType_SurrogateType) String() string { return proto.CompactTextString(m) } func (*CustomInfoType_SurrogateType) ProtoMessage() {} -func (*CustomInfoType_SurrogateType) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1, 1} } +func (*CustomInfoType_SurrogateType) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1, 2} } + +// Rule for modifying a custom info type to alter behavior under certain +// circumstances, depending on the specific details of the rule. Not supported +// for the `surrogate_type` custom info type. +type CustomInfoType_DetectionRule struct { + // Types that are valid to be assigned to Type: + // *CustomInfoType_DetectionRule_HotwordRule_ + Type isCustomInfoType_DetectionRule_Type `protobuf_oneof:"type"` +} + +func (m *CustomInfoType_DetectionRule) Reset() { *m = CustomInfoType_DetectionRule{} } +func (m *CustomInfoType_DetectionRule) String() string { return proto.CompactTextString(m) } +func (*CustomInfoType_DetectionRule) ProtoMessage() {} +func (*CustomInfoType_DetectionRule) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1, 3} } + +type isCustomInfoType_DetectionRule_Type interface { + isCustomInfoType_DetectionRule_Type() +} + +type CustomInfoType_DetectionRule_HotwordRule_ struct { + HotwordRule *CustomInfoType_DetectionRule_HotwordRule `protobuf:"bytes,1,opt,name=hotword_rule,json=hotwordRule,oneof"` +} + +func (*CustomInfoType_DetectionRule_HotwordRule_) isCustomInfoType_DetectionRule_Type() {} + +func (m *CustomInfoType_DetectionRule) GetType() isCustomInfoType_DetectionRule_Type { + if m != nil { + return m.Type + } + return nil +} + +func (m *CustomInfoType_DetectionRule) GetHotwordRule() *CustomInfoType_DetectionRule_HotwordRule { + if x, ok := m.GetType().(*CustomInfoType_DetectionRule_HotwordRule_); ok { + return x.HotwordRule + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*CustomInfoType_DetectionRule) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _CustomInfoType_DetectionRule_OneofMarshaler, _CustomInfoType_DetectionRule_OneofUnmarshaler, _CustomInfoType_DetectionRule_OneofSizer, []interface{}{ + (*CustomInfoType_DetectionRule_HotwordRule_)(nil), + } +} + +func _CustomInfoType_DetectionRule_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*CustomInfoType_DetectionRule) + // type + switch x := m.Type.(type) { + case *CustomInfoType_DetectionRule_HotwordRule_: + b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.HotwordRule); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("CustomInfoType_DetectionRule.Type has unexpected type %T", x) + } + return nil +} + +func _CustomInfoType_DetectionRule_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*CustomInfoType_DetectionRule) + switch tag { + case 1: // type.hotword_rule + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(CustomInfoType_DetectionRule_HotwordRule) + err := b.DecodeMessage(msg) + m.Type = &CustomInfoType_DetectionRule_HotwordRule_{msg} + return true, err + default: + return false, nil + } +} + +func _CustomInfoType_DetectionRule_OneofSizer(msg proto.Message) (n int) { + m := msg.(*CustomInfoType_DetectionRule) + // type + switch x := m.Type.(type) { + case *CustomInfoType_DetectionRule_HotwordRule_: + s := proto.Size(x.HotwordRule) + n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// Message for specifying a window around a finding to apply a detection +// rule. +type CustomInfoType_DetectionRule_Proximity struct { + // Number of characters before the finding to consider. + WindowBefore int32 `protobuf:"varint,1,opt,name=window_before,json=windowBefore" json:"window_before,omitempty"` + // Number of characters after the finding to consider. + WindowAfter int32 `protobuf:"varint,2,opt,name=window_after,json=windowAfter" json:"window_after,omitempty"` +} + +func (m *CustomInfoType_DetectionRule_Proximity) Reset() { + *m = CustomInfoType_DetectionRule_Proximity{} +} +func (m *CustomInfoType_DetectionRule_Proximity) String() string { return proto.CompactTextString(m) } +func (*CustomInfoType_DetectionRule_Proximity) ProtoMessage() {} +func (*CustomInfoType_DetectionRule_Proximity) Descriptor() ([]byte, []int) { + return fileDescriptor1, []int{1, 3, 0} +} + +func (m *CustomInfoType_DetectionRule_Proximity) GetWindowBefore() int32 { + if m != nil { + return m.WindowBefore + } + return 0 +} + +func (m *CustomInfoType_DetectionRule_Proximity) GetWindowAfter() int32 { + if m != nil { + return m.WindowAfter + } + return 0 +} + +// Message for specifying an adjustment to the likelihood of a finding as +// part of a detection rule. +type CustomInfoType_DetectionRule_LikelihoodAdjustment struct { + // Types that are valid to be assigned to Adjustment: + // *CustomInfoType_DetectionRule_LikelihoodAdjustment_FixedLikelihood + // *CustomInfoType_DetectionRule_LikelihoodAdjustment_RelativeLikelihood + Adjustment isCustomInfoType_DetectionRule_LikelihoodAdjustment_Adjustment `protobuf_oneof:"adjustment"` +} + +func (m *CustomInfoType_DetectionRule_LikelihoodAdjustment) Reset() { + *m = CustomInfoType_DetectionRule_LikelihoodAdjustment{} +} +func (m *CustomInfoType_DetectionRule_LikelihoodAdjustment) String() string { + return proto.CompactTextString(m) +} +func (*CustomInfoType_DetectionRule_LikelihoodAdjustment) ProtoMessage() {} +func (*CustomInfoType_DetectionRule_LikelihoodAdjustment) Descriptor() ([]byte, []int) { + return fileDescriptor1, []int{1, 3, 1} +} + +type isCustomInfoType_DetectionRule_LikelihoodAdjustment_Adjustment interface { + isCustomInfoType_DetectionRule_LikelihoodAdjustment_Adjustment() +} + +type CustomInfoType_DetectionRule_LikelihoodAdjustment_FixedLikelihood struct { + FixedLikelihood Likelihood `protobuf:"varint,1,opt,name=fixed_likelihood,json=fixedLikelihood,enum=google.privacy.dlp.v2beta2.Likelihood,oneof"` +} +type CustomInfoType_DetectionRule_LikelihoodAdjustment_RelativeLikelihood struct { + RelativeLikelihood int32 `protobuf:"varint,2,opt,name=relative_likelihood,json=relativeLikelihood,oneof"` +} + +func (*CustomInfoType_DetectionRule_LikelihoodAdjustment_FixedLikelihood) isCustomInfoType_DetectionRule_LikelihoodAdjustment_Adjustment() { +} +func (*CustomInfoType_DetectionRule_LikelihoodAdjustment_RelativeLikelihood) isCustomInfoType_DetectionRule_LikelihoodAdjustment_Adjustment() { +} + +func (m *CustomInfoType_DetectionRule_LikelihoodAdjustment) GetAdjustment() isCustomInfoType_DetectionRule_LikelihoodAdjustment_Adjustment { + if m != nil { + return m.Adjustment + } + return nil +} + +func (m *CustomInfoType_DetectionRule_LikelihoodAdjustment) GetFixedLikelihood() Likelihood { + if x, ok := m.GetAdjustment().(*CustomInfoType_DetectionRule_LikelihoodAdjustment_FixedLikelihood); ok { + return x.FixedLikelihood + } + return Likelihood_LIKELIHOOD_UNSPECIFIED +} + +func (m *CustomInfoType_DetectionRule_LikelihoodAdjustment) GetRelativeLikelihood() int32 { + if x, ok := m.GetAdjustment().(*CustomInfoType_DetectionRule_LikelihoodAdjustment_RelativeLikelihood); ok { + return x.RelativeLikelihood + } + return 0 +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*CustomInfoType_DetectionRule_LikelihoodAdjustment) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _CustomInfoType_DetectionRule_LikelihoodAdjustment_OneofMarshaler, _CustomInfoType_DetectionRule_LikelihoodAdjustment_OneofUnmarshaler, _CustomInfoType_DetectionRule_LikelihoodAdjustment_OneofSizer, []interface{}{ + (*CustomInfoType_DetectionRule_LikelihoodAdjustment_FixedLikelihood)(nil), + (*CustomInfoType_DetectionRule_LikelihoodAdjustment_RelativeLikelihood)(nil), + } +} + +func _CustomInfoType_DetectionRule_LikelihoodAdjustment_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*CustomInfoType_DetectionRule_LikelihoodAdjustment) + // adjustment + switch x := m.Adjustment.(type) { + case *CustomInfoType_DetectionRule_LikelihoodAdjustment_FixedLikelihood: + b.EncodeVarint(1<<3 | proto.WireVarint) + b.EncodeVarint(uint64(x.FixedLikelihood)) + case *CustomInfoType_DetectionRule_LikelihoodAdjustment_RelativeLikelihood: + b.EncodeVarint(2<<3 | proto.WireVarint) + b.EncodeVarint(uint64(x.RelativeLikelihood)) + case nil: + default: + return fmt.Errorf("CustomInfoType_DetectionRule_LikelihoodAdjustment.Adjustment has unexpected type %T", x) + } + return nil +} + +func _CustomInfoType_DetectionRule_LikelihoodAdjustment_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*CustomInfoType_DetectionRule_LikelihoodAdjustment) + switch tag { + case 1: // adjustment.fixed_likelihood + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Adjustment = &CustomInfoType_DetectionRule_LikelihoodAdjustment_FixedLikelihood{Likelihood(x)} + return true, err + case 2: // adjustment.relative_likelihood + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Adjustment = &CustomInfoType_DetectionRule_LikelihoodAdjustment_RelativeLikelihood{int32(x)} + return true, err + default: + return false, nil + } +} + +func _CustomInfoType_DetectionRule_LikelihoodAdjustment_OneofSizer(msg proto.Message) (n int) { + m := msg.(*CustomInfoType_DetectionRule_LikelihoodAdjustment) + // adjustment + switch x := m.Adjustment.(type) { + case *CustomInfoType_DetectionRule_LikelihoodAdjustment_FixedLikelihood: + n += proto.SizeVarint(1<<3 | proto.WireVarint) + n += proto.SizeVarint(uint64(x.FixedLikelihood)) + case *CustomInfoType_DetectionRule_LikelihoodAdjustment_RelativeLikelihood: + n += proto.SizeVarint(2<<3 | proto.WireVarint) + n += proto.SizeVarint(uint64(x.RelativeLikelihood)) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +// Detection rule that adjusts the likelihood of findings within a certain +// proximity of hotwords. +type CustomInfoType_DetectionRule_HotwordRule struct { + // Regex pattern defining what qualifies as a hotword. + HotwordRegex *CustomInfoType_Regex `protobuf:"bytes,1,opt,name=hotword_regex,json=hotwordRegex" json:"hotword_regex,omitempty"` + // Proximity of the finding within which the entire hotword must reside. + // The total length of the window cannot exceed 1000 characters. Note that + // the finding itself will be included in the window, so that hotwords may + // be used to match substrings of the finding itself. For example, the + // certainty of a phone number regex "\(\d{3}\) \d{3}-\d{4}" could be + // adjusted upwards if the area code is known to be the local area code of + // a company office using the hotword regex "\(xxx\)", where "xxx" + // is the area code in question. + Proximity *CustomInfoType_DetectionRule_Proximity `protobuf:"bytes,2,opt,name=proximity" json:"proximity,omitempty"` + // Likelihood adjustment to apply to all matching findings. + LikelihoodAdjustment *CustomInfoType_DetectionRule_LikelihoodAdjustment `protobuf:"bytes,3,opt,name=likelihood_adjustment,json=likelihoodAdjustment" json:"likelihood_adjustment,omitempty"` +} + +func (m *CustomInfoType_DetectionRule_HotwordRule) Reset() { + *m = CustomInfoType_DetectionRule_HotwordRule{} +} +func (m *CustomInfoType_DetectionRule_HotwordRule) String() string { return proto.CompactTextString(m) } +func (*CustomInfoType_DetectionRule_HotwordRule) ProtoMessage() {} +func (*CustomInfoType_DetectionRule_HotwordRule) Descriptor() ([]byte, []int) { + return fileDescriptor1, []int{1, 3, 2} +} + +func (m *CustomInfoType_DetectionRule_HotwordRule) GetHotwordRegex() *CustomInfoType_Regex { + if m != nil { + return m.HotwordRegex + } + return nil +} + +func (m *CustomInfoType_DetectionRule_HotwordRule) GetProximity() *CustomInfoType_DetectionRule_Proximity { + if m != nil { + return m.Proximity + } + return nil +} + +func (m *CustomInfoType_DetectionRule_HotwordRule) GetLikelihoodAdjustment() *CustomInfoType_DetectionRule_LikelihoodAdjustment { + if m != nil { + return m.LikelihoodAdjustment + } + return nil +} // General identifier of a data field in a storage service. type FieldId struct { @@ -451,6 +816,9 @@ func (m *DatastoreOptions) GetKind() *KindExpression { // a Google Cloud Storage bucket. type CloudStorageOptions struct { FileSet *CloudStorageOptions_FileSet `protobuf:"bytes,1,opt,name=file_set,json=fileSet" json:"file_set,omitempty"` + // Max number of bytes to scan from a file. If a scanned file's size is bigger + // than this value then the rest of the bytes are omitted. + BytesLimitPerFile int64 `protobuf:"varint,4,opt,name=bytes_limit_per_file,json=bytesLimitPerFile" json:"bytes_limit_per_file,omitempty"` } func (m *CloudStorageOptions) Reset() { *m = CloudStorageOptions{} } @@ -465,6 +833,13 @@ func (m *CloudStorageOptions) GetFileSet() *CloudStorageOptions_FileSet { return nil } +func (m *CloudStorageOptions) GetBytesLimitPerFile() int64 { + if m != nil { + return m.BytesLimitPerFile + } + return 0 +} + // Set of files to scan. type CloudStorageOptions_FileSet struct { // The url, in the format `gs:///`. Trailing wildcard in the @@ -518,7 +893,8 @@ type StorageConfig struct { // *StorageConfig_DatastoreOptions // *StorageConfig_CloudStorageOptions // *StorageConfig_BigQueryOptions - Type isStorageConfig_Type `protobuf_oneof:"type"` + Type isStorageConfig_Type `protobuf_oneof:"type"` + TimespanConfig *StorageConfig_TimespanConfig `protobuf:"bytes,6,opt,name=timespan_config,json=timespanConfig" json:"timespan_config,omitempty"` } func (m *StorageConfig) Reset() { *m = StorageConfig{} } @@ -572,6 +948,13 @@ func (m *StorageConfig) GetBigQueryOptions() *BigQueryOptions { return nil } +func (m *StorageConfig) GetTimespanConfig() *StorageConfig_TimespanConfig { + if m != nil { + return m.TimespanConfig + } + return nil +} + // XXX_OneofFuncs is for the internal use of the proto package. func (*StorageConfig) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { return _StorageConfig_OneofMarshaler, _StorageConfig_OneofUnmarshaler, _StorageConfig_OneofSizer, []interface{}{ @@ -665,6 +1048,75 @@ func _StorageConfig_OneofSizer(msg proto.Message) (n int) { return n } +// Configuration of the timespan of the items to include in scanning. +// Currently only supported when inspecting Google Cloud Storage and BigQuery. +type StorageConfig_TimespanConfig struct { + // Exclude files older than this value. + StartTime *google_protobuf1.Timestamp `protobuf:"bytes,1,opt,name=start_time,json=startTime" json:"start_time,omitempty"` + // Exclude files newer than this value. + // If set to zero, no upper time limit is applied. + EndTime *google_protobuf1.Timestamp `protobuf:"bytes,2,opt,name=end_time,json=endTime" json:"end_time,omitempty"` + // When the job is started by a JobTrigger we will automatically figure out + // a valid start_time to avoid scanning files that have not been modified + // since the last time the JobTrigger executed. This will be based on the + // time of the execution of the last run of the JobTrigger. + EnableAutoPopulationOfTimespanConfig bool `protobuf:"varint,4,opt,name=enable_auto_population_of_timespan_config,json=enableAutoPopulationOfTimespanConfig" json:"enable_auto_population_of_timespan_config,omitempty"` +} + +func (m *StorageConfig_TimespanConfig) Reset() { *m = StorageConfig_TimespanConfig{} } +func (m *StorageConfig_TimespanConfig) String() string { return proto.CompactTextString(m) } +func (*StorageConfig_TimespanConfig) ProtoMessage() {} +func (*StorageConfig_TimespanConfig) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{8, 0} } + +func (m *StorageConfig_TimespanConfig) GetStartTime() *google_protobuf1.Timestamp { + if m != nil { + return m.StartTime + } + return nil +} + +func (m *StorageConfig_TimespanConfig) GetEndTime() *google_protobuf1.Timestamp { + if m != nil { + return m.EndTime + } + return nil +} + +func (m *StorageConfig_TimespanConfig) GetEnableAutoPopulationOfTimespanConfig() bool { + if m != nil { + return m.EnableAutoPopulationOfTimespanConfig + } + return false +} + +// Row key for identifying a record in BigQuery table. +type BigQueryKey struct { + // Complete BigQuery table reference. + TableReference *BigQueryTable `protobuf:"bytes,1,opt,name=table_reference,json=tableReference" json:"table_reference,omitempty"` + // Absolute number of the row from the beginning of the table at the time + // of scanning. + RowNumber int64 `protobuf:"varint,2,opt,name=row_number,json=rowNumber" json:"row_number,omitempty"` +} + +func (m *BigQueryKey) Reset() { *m = BigQueryKey{} } +func (m *BigQueryKey) String() string { return proto.CompactTextString(m) } +func (*BigQueryKey) ProtoMessage() {} +func (*BigQueryKey) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{9} } + +func (m *BigQueryKey) GetTableReference() *BigQueryTable { + if m != nil { + return m.TableReference + } + return nil +} + +func (m *BigQueryKey) GetRowNumber() int64 { + if m != nil { + return m.RowNumber + } + return 0 +} + // Record key for a finding in a Cloud Storage file. type CloudStorageKey struct { // Path to the file. @@ -676,7 +1128,7 @@ type CloudStorageKey struct { func (m *CloudStorageKey) Reset() { *m = CloudStorageKey{} } func (m *CloudStorageKey) String() string { return proto.CompactTextString(m) } func (*CloudStorageKey) ProtoMessage() {} -func (*CloudStorageKey) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{9} } +func (*CloudStorageKey) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{10} } func (m *CloudStorageKey) GetFilePath() string { if m != nil { @@ -701,7 +1153,7 @@ type DatastoreKey struct { func (m *DatastoreKey) Reset() { *m = DatastoreKey{} } func (m *DatastoreKey) String() string { return proto.CompactTextString(m) } func (*DatastoreKey) ProtoMessage() {} -func (*DatastoreKey) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{10} } +func (*DatastoreKey) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{11} } func (m *DatastoreKey) GetEntityKey() *Key { if m != nil { @@ -734,7 +1186,7 @@ type Key struct { func (m *Key) Reset() { *m = Key{} } func (m *Key) String() string { return proto.CompactTextString(m) } func (*Key) ProtoMessage() {} -func (*Key) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{11} } +func (*Key) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{12} } func (m *Key) GetPartitionId() *PartitionId { if m != nil { @@ -771,7 +1223,7 @@ type Key_PathElement struct { func (m *Key_PathElement) Reset() { *m = Key_PathElement{} } func (m *Key_PathElement) String() string { return proto.CompactTextString(m) } func (*Key_PathElement) ProtoMessage() {} -func (*Key_PathElement) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{11, 0} } +func (*Key_PathElement) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{12, 0} } type isKey_PathElement_IdType interface { isKey_PathElement_IdType() @@ -885,13 +1337,14 @@ type RecordKey struct { // Types that are valid to be assigned to Type: // *RecordKey_CloudStorageKey // *RecordKey_DatastoreKey + // *RecordKey_BigQueryKey Type isRecordKey_Type `protobuf_oneof:"type"` } func (m *RecordKey) Reset() { *m = RecordKey{} } func (m *RecordKey) String() string { return proto.CompactTextString(m) } func (*RecordKey) ProtoMessage() {} -func (*RecordKey) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{12} } +func (*RecordKey) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{13} } type isRecordKey_Type interface { isRecordKey_Type() @@ -903,9 +1356,13 @@ type RecordKey_CloudStorageKey struct { type RecordKey_DatastoreKey struct { DatastoreKey *DatastoreKey `protobuf:"bytes,2,opt,name=datastore_key,json=datastoreKey,oneof"` } +type RecordKey_BigQueryKey struct { + BigQueryKey *BigQueryKey `protobuf:"bytes,3,opt,name=big_query_key,json=bigQueryKey,oneof"` +} func (*RecordKey_CloudStorageKey) isRecordKey_Type() {} func (*RecordKey_DatastoreKey) isRecordKey_Type() {} +func (*RecordKey_BigQueryKey) isRecordKey_Type() {} func (m *RecordKey) GetType() isRecordKey_Type { if m != nil { @@ -928,11 +1385,19 @@ func (m *RecordKey) GetDatastoreKey() *DatastoreKey { return nil } +func (m *RecordKey) GetBigQueryKey() *BigQueryKey { + if x, ok := m.GetType().(*RecordKey_BigQueryKey); ok { + return x.BigQueryKey + } + return nil +} + // XXX_OneofFuncs is for the internal use of the proto package. func (*RecordKey) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { return _RecordKey_OneofMarshaler, _RecordKey_OneofUnmarshaler, _RecordKey_OneofSizer, []interface{}{ (*RecordKey_CloudStorageKey)(nil), (*RecordKey_DatastoreKey)(nil), + (*RecordKey_BigQueryKey)(nil), } } @@ -950,6 +1415,11 @@ func _RecordKey_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { if err := b.EncodeMessage(x.DatastoreKey); err != nil { return err } + case *RecordKey_BigQueryKey: + b.EncodeVarint(3<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.BigQueryKey); err != nil { + return err + } case nil: default: return fmt.Errorf("RecordKey.Type has unexpected type %T", x) @@ -976,6 +1446,14 @@ func _RecordKey_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buff err := b.DecodeMessage(msg) m.Type = &RecordKey_DatastoreKey{msg} return true, err + case 3: // type.big_query_key + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(BigQueryKey) + err := b.DecodeMessage(msg) + m.Type = &RecordKey_BigQueryKey{msg} + return true, err default: return false, nil } @@ -995,6 +1473,11 @@ func _RecordKey_OneofSizer(msg proto.Message) (n int) { n += proto.SizeVarint(2<<3 | proto.WireBytes) n += proto.SizeVarint(uint64(s)) n += s + case *RecordKey_BigQueryKey: + s := proto.Size(x.BigQueryKey) + n += proto.SizeVarint(3<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s case nil: default: panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) @@ -1020,7 +1503,7 @@ type BigQueryTable struct { func (m *BigQueryTable) Reset() { *m = BigQueryTable{} } func (m *BigQueryTable) String() string { return proto.CompactTextString(m) } func (*BigQueryTable) ProtoMessage() {} -func (*BigQueryTable) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{13} } +func (*BigQueryTable) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{14} } func (m *BigQueryTable) GetProjectId() string { if m != nil { @@ -1056,7 +1539,7 @@ type EntityId struct { func (m *EntityId) Reset() { *m = EntityId{} } func (m *EntityId) String() string { return proto.CompactTextString(m) } func (*EntityId) ProtoMessage() {} -func (*EntityId) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{14} } +func (*EntityId) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{15} } func (m *EntityId) GetField() *FieldId { if m != nil { @@ -1070,7 +1553,12 @@ func init() { proto.RegisterType((*CustomInfoType)(nil), "google.privacy.dlp.v2beta2.CustomInfoType") proto.RegisterType((*CustomInfoType_Dictionary)(nil), "google.privacy.dlp.v2beta2.CustomInfoType.Dictionary") proto.RegisterType((*CustomInfoType_Dictionary_WordList)(nil), "google.privacy.dlp.v2beta2.CustomInfoType.Dictionary.WordList") + proto.RegisterType((*CustomInfoType_Regex)(nil), "google.privacy.dlp.v2beta2.CustomInfoType.Regex") proto.RegisterType((*CustomInfoType_SurrogateType)(nil), "google.privacy.dlp.v2beta2.CustomInfoType.SurrogateType") + proto.RegisterType((*CustomInfoType_DetectionRule)(nil), "google.privacy.dlp.v2beta2.CustomInfoType.DetectionRule") + proto.RegisterType((*CustomInfoType_DetectionRule_Proximity)(nil), "google.privacy.dlp.v2beta2.CustomInfoType.DetectionRule.Proximity") + proto.RegisterType((*CustomInfoType_DetectionRule_LikelihoodAdjustment)(nil), "google.privacy.dlp.v2beta2.CustomInfoType.DetectionRule.LikelihoodAdjustment") + proto.RegisterType((*CustomInfoType_DetectionRule_HotwordRule)(nil), "google.privacy.dlp.v2beta2.CustomInfoType.DetectionRule.HotwordRule") proto.RegisterType((*FieldId)(nil), "google.privacy.dlp.v2beta2.FieldId") proto.RegisterType((*PartitionId)(nil), "google.privacy.dlp.v2beta2.PartitionId") proto.RegisterType((*KindExpression)(nil), "google.privacy.dlp.v2beta2.KindExpression") @@ -1079,6 +1567,8 @@ func init() { proto.RegisterType((*CloudStorageOptions_FileSet)(nil), "google.privacy.dlp.v2beta2.CloudStorageOptions.FileSet") proto.RegisterType((*BigQueryOptions)(nil), "google.privacy.dlp.v2beta2.BigQueryOptions") proto.RegisterType((*StorageConfig)(nil), "google.privacy.dlp.v2beta2.StorageConfig") + proto.RegisterType((*StorageConfig_TimespanConfig)(nil), "google.privacy.dlp.v2beta2.StorageConfig.TimespanConfig") + proto.RegisterType((*BigQueryKey)(nil), "google.privacy.dlp.v2beta2.BigQueryKey") proto.RegisterType((*CloudStorageKey)(nil), "google.privacy.dlp.v2beta2.CloudStorageKey") proto.RegisterType((*DatastoreKey)(nil), "google.privacy.dlp.v2beta2.DatastoreKey") proto.RegisterType((*Key)(nil), "google.privacy.dlp.v2beta2.Key") @@ -1092,74 +1582,105 @@ func init() { func init() { proto.RegisterFile("google/privacy/dlp/v2beta2/storage.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 1100 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xdf, 0x6e, 0xe3, 0xc4, - 0x17, 0x8e, 0x93, 0xb4, 0x4d, 0x4e, 0x9a, 0x26, 0x9d, 0xdd, 0xdf, 0x4f, 0x25, 0x4b, 0x77, 0x4b, - 0x58, 0x89, 0xb2, 0x45, 0x8e, 0x54, 0x84, 0x00, 0x21, 0x8a, 0x48, 0x93, 0x12, 0xd3, 0xaa, 0xe9, - 0x4e, 0xba, 0x5d, 0x15, 0x8a, 0x2c, 0x27, 0x33, 0x71, 0x87, 0x3a, 0x1e, 0x63, 0x4f, 0x76, 0xc9, - 0x0b, 0xf0, 0x0a, 0xdc, 0x71, 0xc3, 0x1d, 0x0f, 0x80, 0xc4, 0x15, 0x12, 0x97, 0x3c, 0x09, 0x8f, - 0x81, 0xe6, 0x8f, 0xd3, 0xa4, 0x94, 0xd0, 0x45, 0xdc, 0xcd, 0x9c, 0x39, 0xe7, 0x9b, 0x6f, 0xce, - 0xf9, 0xce, 0xb1, 0x61, 0xdb, 0xe7, 0xdc, 0x0f, 0x68, 0x23, 0x8a, 0xd9, 0x0b, 0x6f, 0x30, 0x69, - 0x90, 0x20, 0x6a, 0xbc, 0xd8, 0xed, 0x53, 0xe1, 0xed, 0x36, 0x12, 0xc1, 0x63, 0xcf, 0xa7, 0x76, - 0x14, 0x73, 0xc1, 0x51, 0x4d, 0x7b, 0xda, 0xc6, 0xd3, 0x26, 0x41, 0x64, 0x1b, 0xcf, 0xda, 0xeb, - 0x06, 0xc5, 0x8b, 0x58, 0xc3, 0x0b, 0x43, 0x2e, 0x3c, 0xc1, 0x78, 0x98, 0xe8, 0xc8, 0xda, 0xa3, - 0xe9, 0x1d, 0x5c, 0xf0, 0xfe, 0x78, 0xd8, 0x10, 0x6c, 0x44, 0x13, 0xe1, 0x8d, 0x22, 0xed, 0x50, - 0x7f, 0x08, 0x05, 0x27, 0x1c, 0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8f, 0x4f, 0x2f, 0x44, 0x44, 0x0a, 0x00, 0x00, + // 1585 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x72, 0x23, 0x49, + 0x11, 0x56, 0xeb, 0xc7, 0x96, 0x52, 0xd6, 0x8f, 0x6b, 0xbc, 0x84, 0xe8, 0xc5, 0xbb, 0x5e, 0xed, + 0x04, 0x78, 0x77, 0x08, 0x09, 0x4c, 0x6c, 0xc0, 0x06, 0xc1, 0x10, 0x96, 0x25, 0x23, 0x61, 0xaf, + 0xa5, 0x2d, 0x79, 0x66, 0xc2, 0x30, 0x44, 0xd3, 0x52, 0x55, 0xcb, 0x35, 0xd3, 0xea, 0x6a, 0xba, + 0x4b, 0x63, 0xeb, 0x46, 0xf0, 0x00, 0x5c, 0xb9, 0x71, 0xe1, 0x46, 0x70, 0xe1, 0x44, 0xf0, 0x0a, + 0x70, 0xe5, 0xc6, 0x0b, 0xf0, 0x06, 0x5c, 0x89, 0xaa, 0xea, 0x6e, 0x49, 0xc6, 0xc8, 0x3f, 0xc1, + 0x9e, 0xdc, 0x99, 0x95, 0xf9, 0x55, 0xfe, 0x67, 0x59, 0xb0, 0x3f, 0xe1, 0x7c, 0xe2, 0xd2, 0xa6, + 0x1f, 0xb0, 0x77, 0xf6, 0x78, 0xde, 0x24, 0xae, 0xdf, 0x7c, 0x77, 0x30, 0xa2, 0xc2, 0x3e, 0x68, + 0x86, 0x82, 0x07, 0xf6, 0x84, 0x36, 0xfc, 0x80, 0x0b, 0x8e, 0x4c, 0x2d, 0xd9, 0x88, 0x24, 0x1b, + 0xc4, 0xf5, 0x1b, 0x91, 0xa4, 0xf9, 0x8d, 0x08, 0xc5, 0xf6, 0x59, 0xd3, 0xf6, 0x3c, 0x2e, 0x6c, + 0xc1, 0xb8, 0x17, 0x6a, 0x4d, 0xf3, 0xc3, 0xe4, 0x0e, 0x2e, 0x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0xa1, 0x6d, 0x28, 0xbd, 0xec, 0xe0, 0x0b, 0xeb, 0xc5, + 0x99, 0x12, 0xb9, 0xa8, 0x1a, 0x68, 0x0b, 0xf2, 0x09, 0x95, 0x96, 0xd4, 0xa0, 0x3f, 0x1c, 0xf6, + 0x5a, 0xa7, 0x9d, 0x6a, 0x06, 0x01, 0x6c, 0x44, 0x27, 0x59, 0x54, 0x81, 0xa2, 0x52, 0x8d, 0x18, + 0xb9, 0xd6, 0x1f, 0x0c, 0xf8, 0x60, 0xcc, 0xa7, 0x6b, 0xec, 0x6c, 0x41, 0xdb, 0xf5, 0xa3, 0x02, + 0x18, 0x18, 0x3f, 0xfb, 0x51, 0x24, 0x39, 0xe1, 0xae, 0xed, 0x4d, 0x1a, 0x3c, 0x98, 0x34, 0x27, + 0xd4, 0x53, 0xc3, 0xb0, 0xa9, 0x8f, 0x6c, 0x9f, 0x85, 0xb7, 0xfd, 0x30, 0xf0, 0x43, 0xe2, 0xfa, + 0x7f, 0x4c, 0xd7, 0x7e, 0xa2, 0xf5, 0x55, 0xa9, 0x35, 0xda, 0xae, 0xdf, 0x78, 0x79, 0xd0, 0x92, + 0xc7, 0x7f, 0x8b, 0x8f, 0x5e, 0xab, 0xa3, 0xd7, 0x6d, 0xd7, 0x7f, 0xfd, 0x52, 0x6b, 0x8e, 0x36, + 0x14, 0xfe, 0xf7, 0xfe, 0x13, 0x00, 0x00, 0xff, 0xff, 0x78, 0x92, 0xfd, 0x26, 0x77, 0x10, 0x00, + 0x00, } diff --git a/vendor/google.golang.org/genproto/googleapis/spanner/v1/keys.pb.go b/vendor/google.golang.org/genproto/googleapis/spanner/v1/keys.pb.go index b86585469..66728bea2 100644 --- a/vendor/google.golang.org/genproto/googleapis/spanner/v1/keys.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/spanner/v1/keys.pb.go @@ -30,6 +30,11 @@ It has these top-level messages: ListSessionsResponse DeleteSessionRequest ExecuteSqlRequest + PartitionOptions + PartitionQueryRequest + PartitionReadRequest + Partition + PartitionResponse ReadRequest BeginTransactionRequest CommitRequest diff --git a/vendor/google.golang.org/genproto/googleapis/spanner/v1/mutation.pb.go b/vendor/google.golang.org/genproto/googleapis/spanner/v1/mutation.pb.go index 8abef20cd..2f827795e 100644 --- a/vendor/google.golang.org/genproto/googleapis/spanner/v1/mutation.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/spanner/v1/mutation.pb.go @@ -286,6 +286,8 @@ type Mutation_Delete struct { // Required. The table whose rows will be deleted. Table string `protobuf:"bytes,1,opt,name=table" json:"table,omitempty"` // Required. The primary keys of the rows within [table][google.spanner.v1.Mutation.Delete.table] to delete. + // Delete is idempotent. The transaction will succeed even if some or all + // rows do not exist. KeySet *KeySet `protobuf:"bytes,2,opt,name=key_set,json=keySet" json:"key_set,omitempty"` } diff --git a/vendor/google.golang.org/genproto/googleapis/spanner/v1/spanner.pb.go b/vendor/google.golang.org/genproto/googleapis/spanner/v1/spanner.pb.go index 2db458519..27125f188 100644 --- a/vendor/google.golang.org/genproto/googleapis/spanner/v1/spanner.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/spanner/v1/spanner.pb.go @@ -300,8 +300,14 @@ type ExecuteSqlRequest struct { // request that yielded this token. ResumeToken []byte `protobuf:"bytes,6,opt,name=resume_token,json=resumeToken,proto3" json:"resume_token,omitempty"` // Used to control the amount of debugging information returned in - // [ResultSetStats][google.spanner.v1.ResultSetStats]. + // [ResultSetStats][google.spanner.v1.ResultSetStats]. If [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only + // be set to [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL]. QueryMode ExecuteSqlRequest_QueryMode `protobuf:"varint,7,opt,name=query_mode,json=queryMode,enum=google.spanner.v1.ExecuteSqlRequest_QueryMode" json:"query_mode,omitempty"` + // If present, results will be restricted to the specified partition + // previously created using PartitionQuery(). There must be an exact + // match for the values of fields common to this message and the + // PartitionQueryRequest message used to create this partition_token. + PartitionToken []byte `protobuf:"bytes,8,opt,name=partition_token,json=partitionToken,proto3" json:"partition_token,omitempty"` } func (m *ExecuteSqlRequest) Reset() { *m = ExecuteSqlRequest{} } @@ -358,6 +364,267 @@ func (m *ExecuteSqlRequest) GetQueryMode() ExecuteSqlRequest_QueryMode { return ExecuteSqlRequest_NORMAL } +func (m *ExecuteSqlRequest) GetPartitionToken() []byte { + if m != nil { + return m.PartitionToken + } + return nil +} + +// Options for a PartitionQueryRequest and +// PartitionReadRequest. +type PartitionOptions struct { + // The desired data size for each partition generated. The default for this + // option is currently 1 GiB. This is only a hint. The actual size of each + // partition may be smaller or larger than this size request. + PartitionSizeBytes int64 `protobuf:"varint,1,opt,name=partition_size_bytes,json=partitionSizeBytes" json:"partition_size_bytes,omitempty"` + // The desired maximum number of partitions to return. For example, this may + // be set to the number of workers available. The default for this option + // is currently 10,000. The maximum value is currently 200,000. This is only + // a hint. The actual number of partitions returned may be smaller or larger + // than this maximum count request. + MaxPartitions int64 `protobuf:"varint,2,opt,name=max_partitions,json=maxPartitions" json:"max_partitions,omitempty"` +} + +func (m *PartitionOptions) Reset() { *m = PartitionOptions{} } +func (m *PartitionOptions) String() string { return proto.CompactTextString(m) } +func (*PartitionOptions) ProtoMessage() {} +func (*PartitionOptions) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{7} } + +func (m *PartitionOptions) GetPartitionSizeBytes() int64 { + if m != nil { + return m.PartitionSizeBytes + } + return 0 +} + +func (m *PartitionOptions) GetMaxPartitions() int64 { + if m != nil { + return m.MaxPartitions + } + return 0 +} + +// The request for [PartitionQuery][google.spanner.v1.Spanner.PartitionQuery] +type PartitionQueryRequest struct { + // Required. The session used to create the partitions. + Session string `protobuf:"bytes,1,opt,name=session" json:"session,omitempty"` + // Read only snapshot transactions are supported, read/write and single use + // transactions are not. + Transaction *TransactionSelector `protobuf:"bytes,2,opt,name=transaction" json:"transaction,omitempty"` + // The query request to generate partitions for. The request will fail if + // the query is not root partitionable. The query plan of a root + // partitionable query has a single distributed union operator. A distributed + // union operator conceptually divides one or more tables into multiple + // splits, remotely evaluates a subquery independently on each split, and + // then unions all results. + Sql string `protobuf:"bytes,3,opt,name=sql" json:"sql,omitempty"` + // The SQL query string can contain parameter placeholders. A parameter + // placeholder consists of `'@'` followed by the parameter + // name. Parameter names consist of any combination of letters, + // numbers, and underscores. + // + // Parameters can appear anywhere that a literal value is expected. The same + // parameter name can be used more than once, for example: + // `"WHERE id > @msg_id AND id < @msg_id + 100"` + // + // It is an error to execute an SQL query with unbound parameters. + // + // Parameter values are specified using `params`, which is a JSON + // object whose keys are parameter names, and whose values are the + // corresponding parameter values. + Params *google_protobuf1.Struct `protobuf:"bytes,4,opt,name=params" json:"params,omitempty"` + // It is not always possible for Cloud Spanner to infer the right SQL type + // from a JSON value. For example, values of type `BYTES` and values + // of type `STRING` both appear in [params][google.spanner.v1.PartitionQueryRequest.params] as JSON strings. + // + // In these cases, `param_types` can be used to specify the exact + // SQL type for some or all of the SQL query parameters. See the + // definition of [Type][google.spanner.v1.Type] for more information + // about SQL types. + ParamTypes map[string]*Type `protobuf:"bytes,5,rep,name=param_types,json=paramTypes" json:"param_types,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // Additional options that affect how many partitions are created. + PartitionOptions *PartitionOptions `protobuf:"bytes,6,opt,name=partition_options,json=partitionOptions" json:"partition_options,omitempty"` +} + +func (m *PartitionQueryRequest) Reset() { *m = PartitionQueryRequest{} } +func (m *PartitionQueryRequest) String() string { return proto.CompactTextString(m) } +func (*PartitionQueryRequest) ProtoMessage() {} +func (*PartitionQueryRequest) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{8} } + +func (m *PartitionQueryRequest) GetSession() string { + if m != nil { + return m.Session + } + return "" +} + +func (m *PartitionQueryRequest) GetTransaction() *TransactionSelector { + if m != nil { + return m.Transaction + } + return nil +} + +func (m *PartitionQueryRequest) GetSql() string { + if m != nil { + return m.Sql + } + return "" +} + +func (m *PartitionQueryRequest) GetParams() *google_protobuf1.Struct { + if m != nil { + return m.Params + } + return nil +} + +func (m *PartitionQueryRequest) GetParamTypes() map[string]*Type { + if m != nil { + return m.ParamTypes + } + return nil +} + +func (m *PartitionQueryRequest) GetPartitionOptions() *PartitionOptions { + if m != nil { + return m.PartitionOptions + } + return nil +} + +// The request for [PartitionRead][google.spanner.v1.Spanner.PartitionRead] +type PartitionReadRequest struct { + // Required. The session used to create the partitions. + Session string `protobuf:"bytes,1,opt,name=session" json:"session,omitempty"` + // Read only snapshot transactions are supported, read/write and single use + // transactions are not. + Transaction *TransactionSelector `protobuf:"bytes,2,opt,name=transaction" json:"transaction,omitempty"` + // Required. The name of the table in the database to be read. + Table string `protobuf:"bytes,3,opt,name=table" json:"table,omitempty"` + // If non-empty, the name of an index on [table][google.spanner.v1.PartitionReadRequest.table]. This index is + // used instead of the table primary key when interpreting [key_set][google.spanner.v1.PartitionReadRequest.key_set] + // and sorting result rows. See [key_set][google.spanner.v1.PartitionReadRequest.key_set] for further information. + Index string `protobuf:"bytes,4,opt,name=index" json:"index,omitempty"` + // The columns of [table][google.spanner.v1.PartitionReadRequest.table] to be returned for each row matching + // this request. + Columns []string `protobuf:"bytes,5,rep,name=columns" json:"columns,omitempty"` + // Required. `key_set` identifies the rows to be yielded. `key_set` names the + // primary keys of the rows in [table][google.spanner.v1.PartitionReadRequest.table] to be yielded, unless [index][google.spanner.v1.PartitionReadRequest.index] + // is present. If [index][google.spanner.v1.PartitionReadRequest.index] is present, then [key_set][google.spanner.v1.PartitionReadRequest.key_set] instead names + // index keys in [index][google.spanner.v1.PartitionReadRequest.index]. + // + // It is not an error for the `key_set` to name rows that do not + // exist in the database. Read yields nothing for nonexistent rows. + KeySet *KeySet `protobuf:"bytes,6,opt,name=key_set,json=keySet" json:"key_set,omitempty"` + // Additional options that affect how many partitions are created. + PartitionOptions *PartitionOptions `protobuf:"bytes,9,opt,name=partition_options,json=partitionOptions" json:"partition_options,omitempty"` +} + +func (m *PartitionReadRequest) Reset() { *m = PartitionReadRequest{} } +func (m *PartitionReadRequest) String() string { return proto.CompactTextString(m) } +func (*PartitionReadRequest) ProtoMessage() {} +func (*PartitionReadRequest) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{9} } + +func (m *PartitionReadRequest) GetSession() string { + if m != nil { + return m.Session + } + return "" +} + +func (m *PartitionReadRequest) GetTransaction() *TransactionSelector { + if m != nil { + return m.Transaction + } + return nil +} + +func (m *PartitionReadRequest) GetTable() string { + if m != nil { + return m.Table + } + return "" +} + +func (m *PartitionReadRequest) GetIndex() string { + if m != nil { + return m.Index + } + return "" +} + +func (m *PartitionReadRequest) GetColumns() []string { + if m != nil { + return m.Columns + } + return nil +} + +func (m *PartitionReadRequest) GetKeySet() *KeySet { + if m != nil { + return m.KeySet + } + return nil +} + +func (m *PartitionReadRequest) GetPartitionOptions() *PartitionOptions { + if m != nil { + return m.PartitionOptions + } + return nil +} + +// Information returned for each partition returned in a +// PartitionResponse. +type Partition struct { + // This token can be passed to Read, StreamingRead, ExecuteSql, or + // ExecuteStreamingSql requests to restrict the results to those identified by + // this partition token. + PartitionToken []byte `protobuf:"bytes,1,opt,name=partition_token,json=partitionToken,proto3" json:"partition_token,omitempty"` +} + +func (m *Partition) Reset() { *m = Partition{} } +func (m *Partition) String() string { return proto.CompactTextString(m) } +func (*Partition) ProtoMessage() {} +func (*Partition) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{10} } + +func (m *Partition) GetPartitionToken() []byte { + if m != nil { + return m.PartitionToken + } + return nil +} + +// The response for [PartitionQuery][google.spanner.v1.Spanner.PartitionQuery] +// or [PartitionRead][google.spanner.v1.Spanner.PartitionRead] +type PartitionResponse struct { + // Partitions created by this request. + Partitions []*Partition `protobuf:"bytes,1,rep,name=partitions" json:"partitions,omitempty"` + // Transaction created by this request. + Transaction *Transaction `protobuf:"bytes,2,opt,name=transaction" json:"transaction,omitempty"` +} + +func (m *PartitionResponse) Reset() { *m = PartitionResponse{} } +func (m *PartitionResponse) String() string { return proto.CompactTextString(m) } +func (*PartitionResponse) ProtoMessage() {} +func (*PartitionResponse) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{11} } + +func (m *PartitionResponse) GetPartitions() []*Partition { + if m != nil { + return m.Partitions + } + return nil +} + +func (m *PartitionResponse) GetTransaction() *Transaction { + if m != nil { + return m.Transaction + } + return nil +} + // The request for [Read][google.spanner.v1.Spanner.Read] and // [StreamingRead][google.spanner.v1.Spanner.StreamingRead]. type ReadRequest struct { @@ -380,14 +647,17 @@ type ReadRequest struct { // is present. If [index][google.spanner.v1.ReadRequest.index] is present, then [key_set][google.spanner.v1.ReadRequest.key_set] instead names // index keys in [index][google.spanner.v1.ReadRequest.index]. // - // Rows are yielded in table primary key order (if [index][google.spanner.v1.ReadRequest.index] is empty) - // or index key order (if [index][google.spanner.v1.ReadRequest.index] is non-empty). + // If the [partition_token][google.spanner.v1.ReadRequest.partition_token] field is empty, rows are yielded + // in table primary key order (if [index][google.spanner.v1.ReadRequest.index] is empty) or index key order + // (if [index][google.spanner.v1.ReadRequest.index] is non-empty). If the [partition_token][google.spanner.v1.ReadRequest.partition_token] field is not + // empty, rows will be yielded in an unspecified order. // // It is not an error for the `key_set` to name rows that do not // exist in the database. Read yields nothing for nonexistent rows. KeySet *KeySet `protobuf:"bytes,6,opt,name=key_set,json=keySet" json:"key_set,omitempty"` // If greater than zero, only the first `limit` rows are yielded. If `limit` - // is zero, the default is no limit. + // is zero, the default is no limit. A limit cannot be specified if + // `partition_token` is set. Limit int64 `protobuf:"varint,8,opt,name=limit" json:"limit,omitempty"` // If this request is resuming a previously interrupted read, // `resume_token` should be copied from the last @@ -396,12 +666,17 @@ type ReadRequest struct { // rest of the request parameters must exactly match the request // that yielded this token. ResumeToken []byte `protobuf:"bytes,9,opt,name=resume_token,json=resumeToken,proto3" json:"resume_token,omitempty"` + // If present, results will be restricted to the specified partition + // previously created using PartitionRead(). There must be an exact + // match for the values of fields common to this message and the + // PartitionReadRequest message used to create this partition_token. + PartitionToken []byte `protobuf:"bytes,10,opt,name=partition_token,json=partitionToken,proto3" json:"partition_token,omitempty"` } func (m *ReadRequest) Reset() { *m = ReadRequest{} } func (m *ReadRequest) String() string { return proto.CompactTextString(m) } func (*ReadRequest) ProtoMessage() {} -func (*ReadRequest) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{7} } +func (*ReadRequest) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{12} } func (m *ReadRequest) GetSession() string { if m != nil { @@ -459,6 +734,13 @@ func (m *ReadRequest) GetResumeToken() []byte { return nil } +func (m *ReadRequest) GetPartitionToken() []byte { + if m != nil { + return m.PartitionToken + } + return nil +} + // The request for [BeginTransaction][google.spanner.v1.Spanner.BeginTransaction]. type BeginTransactionRequest struct { // Required. The session in which the transaction runs. @@ -470,7 +752,7 @@ type BeginTransactionRequest struct { func (m *BeginTransactionRequest) Reset() { *m = BeginTransactionRequest{} } func (m *BeginTransactionRequest) String() string { return proto.CompactTextString(m) } func (*BeginTransactionRequest) ProtoMessage() {} -func (*BeginTransactionRequest) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{8} } +func (*BeginTransactionRequest) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{13} } func (m *BeginTransactionRequest) GetSession() string { if m != nil { @@ -505,7 +787,7 @@ type CommitRequest struct { func (m *CommitRequest) Reset() { *m = CommitRequest{} } func (m *CommitRequest) String() string { return proto.CompactTextString(m) } func (*CommitRequest) ProtoMessage() {} -func (*CommitRequest) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{9} } +func (*CommitRequest) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{14} } type isCommitRequest_Transaction interface { isCommitRequest_Transaction() @@ -635,7 +917,7 @@ type CommitResponse struct { func (m *CommitResponse) Reset() { *m = CommitResponse{} } func (m *CommitResponse) String() string { return proto.CompactTextString(m) } func (*CommitResponse) ProtoMessage() {} -func (*CommitResponse) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{10} } +func (*CommitResponse) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{15} } func (m *CommitResponse) GetCommitTimestamp() *google_protobuf3.Timestamp { if m != nil { @@ -655,7 +937,7 @@ type RollbackRequest struct { func (m *RollbackRequest) Reset() { *m = RollbackRequest{} } func (m *RollbackRequest) String() string { return proto.CompactTextString(m) } func (*RollbackRequest) ProtoMessage() {} -func (*RollbackRequest) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{11} } +func (*RollbackRequest) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{16} } func (m *RollbackRequest) GetSession() string { if m != nil { @@ -679,6 +961,11 @@ func init() { proto.RegisterType((*ListSessionsResponse)(nil), "google.spanner.v1.ListSessionsResponse") proto.RegisterType((*DeleteSessionRequest)(nil), "google.spanner.v1.DeleteSessionRequest") proto.RegisterType((*ExecuteSqlRequest)(nil), "google.spanner.v1.ExecuteSqlRequest") + proto.RegisterType((*PartitionOptions)(nil), "google.spanner.v1.PartitionOptions") + proto.RegisterType((*PartitionQueryRequest)(nil), "google.spanner.v1.PartitionQueryRequest") + proto.RegisterType((*PartitionReadRequest)(nil), "google.spanner.v1.PartitionReadRequest") + proto.RegisterType((*Partition)(nil), "google.spanner.v1.Partition") + proto.RegisterType((*PartitionResponse)(nil), "google.spanner.v1.PartitionResponse") proto.RegisterType((*ReadRequest)(nil), "google.spanner.v1.ReadRequest") proto.RegisterType((*BeginTransactionRequest)(nil), "google.spanner.v1.BeginTransactionRequest") proto.RegisterType((*CommitRequest)(nil), "google.spanner.v1.CommitRequest") @@ -787,6 +1074,24 @@ type SpannerClient interface { // transaction was already aborted, or the transaction is not // found. `Rollback` never returns `ABORTED`. Rollback(ctx context.Context, in *RollbackRequest, opts ...grpc.CallOption) (*google_protobuf4.Empty, error) + // Creates a set of partition tokens that can be used to execute a query + // operation in parallel. Each of the returned partition tokens can be used + // by [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] to specify a subset + // of the query result to read. The same session and read-only transaction + // must be used by the PartitionQueryRequest used to create the + // partition tokens and the ExecuteSqlRequests that use the partition tokens. + // Partition tokens become invalid when the session used to create them + // is deleted or begins a new transaction. + PartitionQuery(ctx context.Context, in *PartitionQueryRequest, opts ...grpc.CallOption) (*PartitionResponse, error) + // Creates a set of partition tokens that can be used to execute a read + // operation in parallel. Each of the returned partition tokens can be used + // by [StreamingRead][google.spanner.v1.Spanner.StreamingRead] to specify a subset of the read + // result to read. The same session and read-only transaction must be used by + // the PartitionReadRequest used to create the partition tokens and the + // ReadRequests that use the partition tokens. + // Partition tokens become invalid when the session used to create them + // is deleted or begins a new transaction. + PartitionRead(ctx context.Context, in *PartitionReadRequest, opts ...grpc.CallOption) (*PartitionResponse, error) } type spannerClient struct { @@ -942,6 +1247,24 @@ func (c *spannerClient) Rollback(ctx context.Context, in *RollbackRequest, opts return out, nil } +func (c *spannerClient) PartitionQuery(ctx context.Context, in *PartitionQueryRequest, opts ...grpc.CallOption) (*PartitionResponse, error) { + out := new(PartitionResponse) + err := grpc.Invoke(ctx, "/google.spanner.v1.Spanner/PartitionQuery", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *spannerClient) PartitionRead(ctx context.Context, in *PartitionReadRequest, opts ...grpc.CallOption) (*PartitionResponse, error) { + out := new(PartitionResponse) + err := grpc.Invoke(ctx, "/google.spanner.v1.Spanner/PartitionRead", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // Server API for Spanner service type SpannerServer interface { @@ -1034,6 +1357,24 @@ type SpannerServer interface { // transaction was already aborted, or the transaction is not // found. `Rollback` never returns `ABORTED`. Rollback(context.Context, *RollbackRequest) (*google_protobuf4.Empty, error) + // Creates a set of partition tokens that can be used to execute a query + // operation in parallel. Each of the returned partition tokens can be used + // by [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] to specify a subset + // of the query result to read. The same session and read-only transaction + // must be used by the PartitionQueryRequest used to create the + // partition tokens and the ExecuteSqlRequests that use the partition tokens. + // Partition tokens become invalid when the session used to create them + // is deleted or begins a new transaction. + PartitionQuery(context.Context, *PartitionQueryRequest) (*PartitionResponse, error) + // Creates a set of partition tokens that can be used to execute a read + // operation in parallel. Each of the returned partition tokens can be used + // by [StreamingRead][google.spanner.v1.Spanner.StreamingRead] to specify a subset of the read + // result to read. The same session and read-only transaction must be used by + // the PartitionReadRequest used to create the partition tokens and the + // ReadRequests that use the partition tokens. + // Partition tokens become invalid when the session used to create them + // is deleted or begins a new transaction. + PartitionRead(context.Context, *PartitionReadRequest) (*PartitionResponse, error) } func RegisterSpannerServer(s *grpc.Server, srv SpannerServer) { @@ -1244,6 +1585,42 @@ func _Spanner_Rollback_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Spanner_PartitionQuery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PartitionQueryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SpannerServer).PartitionQuery(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.spanner.v1.Spanner/PartitionQuery", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SpannerServer).PartitionQuery(ctx, req.(*PartitionQueryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Spanner_PartitionRead_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PartitionReadRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SpannerServer).PartitionRead(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/google.spanner.v1.Spanner/PartitionRead", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SpannerServer).PartitionRead(ctx, req.(*PartitionReadRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Spanner_serviceDesc = grpc.ServiceDesc{ ServiceName: "google.spanner.v1.Spanner", HandlerType: (*SpannerServer)(nil), @@ -1284,6 +1661,14 @@ var _Spanner_serviceDesc = grpc.ServiceDesc{ MethodName: "Rollback", Handler: _Spanner_Rollback_Handler, }, + { + MethodName: "PartitionQuery", + Handler: _Spanner_PartitionQuery_Handler, + }, + { + MethodName: "PartitionRead", + Handler: _Spanner_PartitionRead_Handler, + }, }, Streams: []grpc.StreamDesc{ { @@ -1303,94 +1688,109 @@ var _Spanner_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("google/spanner/v1/spanner.proto", fileDescriptor4) } var fileDescriptor4 = []byte{ - // 1416 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x4f, 0x6f, 0x13, 0x47, - 0x14, 0x67, 0x9d, 0xc4, 0x89, 0x9f, 0xf3, 0x8f, 0x21, 0x0d, 0xc6, 0x50, 0x30, 0x4b, 0x21, 0x91, - 0xa5, 0xda, 0x4d, 0x8a, 0x2a, 0x30, 0x6d, 0x81, 0x80, 0x81, 0x08, 0x87, 0x98, 0x75, 0x00, 0x09, - 0x51, 0x59, 0x63, 0x7b, 0x70, 0xb7, 0xd9, 0x7f, 0xd9, 0x19, 0x47, 0x31, 0x15, 0x97, 0x4a, 0x3d, - 0xf5, 0xd2, 0x52, 0x55, 0x3d, 0xb4, 0xb7, 0xf6, 0x54, 0x71, 0xef, 0xad, 0x1f, 0xa0, 0xd7, 0x7e, - 0x85, 0x7e, 0x8b, 0x5e, 0xaa, 0xf9, 0xe7, 0x6c, 0xec, 0xc5, 0x09, 0x72, 0xd5, 0x93, 0x67, 0xe6, - 0xbd, 0x79, 0xef, 0xb7, 0xbf, 0xf7, 0x66, 0x7e, 0x63, 0x38, 0xd7, 0xf6, 0xfd, 0xb6, 0x43, 0x8a, - 0x34, 0xc0, 0x9e, 0x47,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5, - 0x99, 0xb2, 0x3c, 0x7b, 0xbc, 0xd2, 0x48, 0x8a, 0xc0, 0x1f, 0xfe, 0x1b, 0x00, 0x00, 0xff, 0xff, - 0x57, 0x35, 0x15, 0x7f, 0x4e, 0x11, 0x00, 0x00, + // 1657 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x58, 0xdd, 0x6f, 0x53, 0xc9, + 0x15, 0xe7, 0xda, 0x89, 0x13, 0x1f, 0xc7, 0x89, 0x33, 0x98, 0x60, 0x0c, 0x85, 0x70, 0xf9, 0x48, + 0x64, 0xa9, 0x36, 0x49, 0x51, 0x15, 0x02, 0x2d, 0x10, 0x08, 0x90, 0x92, 0x10, 0x73, 0x9d, 0x80, + 0x8a, 0xa8, 0xac, 0xb1, 0x3d, 0xb8, 0xb7, 0xb9, 0x5f, 0xb9, 0x33, 0x8e, 0x62, 0x2a, 0x5e, 0x5a, + 0xf5, 0xbd, 0x2d, 0xaa, 0xfa, 0xd0, 0xbe, 0xed, 0xdb, 0x8a, 0x47, 0x24, 0xde, 0xf6, 0x65, 0xa5, + 0x7d, 0x58, 0x69, 0x9f, 0xf6, 0x5f, 0xd8, 0xff, 0x62, 0x5f, 0x56, 0x33, 0xf7, 0xc3, 0xd7, 0xf6, + 0xc4, 0x31, 0x32, 0xbb, 0xd2, 0x6a, 0x9f, 0x3c, 0x33, 0xe7, 0xcc, 0x9c, 0xdf, 0xfd, 0x9d, 0x33, + 0x73, 0xce, 0x31, 0x5c, 0x68, 0xda, 0x76, 0xd3, 0x20, 0x25, 0xea, 0x60, 0xcb, 0x22, 0x6e, 0xe9, + 0x60, 0x29, 0x18, 0x16, 0x1d, 0xd7, 0x66, 0x36, 0x9a, 0xf5, 0x14, 0x8a, 0xc1, 0xea, 0xc1, 0x52, + 0xfe, 0x9c, 0xbf, 0x07, 0x3b, 0x7a, 0x09, 0x5b, 0x96, 0xcd, 0x30,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0xe2, 0x91, 0x94, 0xe6, 0xcb, 0xe5, 0x00, 0x8f, + 0x5a, 0x80, 0xec, 0x7d, 0x62, 0x90, 0xbe, 0x08, 0x96, 0x71, 0xf5, 0x7e, 0x0c, 0x66, 0xd7, 0x0f, + 0x49, 0xbd, 0xc5, 0x48, 0x65, 0xdf, 0x08, 0x34, 0x73, 0x9d, 0x78, 0xf6, 0x94, 0x83, 0x29, 0x7a, + 0x04, 0xa9, 0xc8, 0x85, 0xf2, 0xa3, 0x5d, 0x16, 0x98, 0x3b, 0x1d, 0xad, 0x0a, 0x31, 0x48, 0x9d, + 0xd9, 0xae, 0x16, 0xdd, 0xca, 0x5d, 0x4f, 0xf7, 0x0d, 0x9f, 0x4d, 0x3e, 0x44, 0x25, 0x48, 0x38, + 0xd8, 0xc5, 0x26, 0xf5, 0xe3, 0xeb, 0x74, 0x5f, 0x7c, 0x55, 0xc4, 0x83, 0xa3, 0xf9, 0x6a, 0x68, + 0x17, 0x52, 0x62, 0x54, 0xe5, 0xd7, 0x97, 0xe6, 0xc6, 0x05, 0x97, 0xd7, 0x25, 0x60, 0xfa, 0xbe, + 0xb0, 0x58, 0xe6, 0xfb, 0x76, 0xf8, 0x36, 0xef, 0xce, 0x80, 0x13, 0x2e, 0xa0, 0x8b, 0x30, 0xc5, + 0x1f, 0x16, 0x33, 0x20, 0x39, 0x31, 0xaf, 0x2c, 0x4e, 0x69, 0x29, 0x6f, 0xcd, 0x73, 0xf9, 0x16, + 0xc0, 0x7e, 0x8b, 0xb8, 0xed, 0xaa, 0x69, 0x37, 0x48, 0x6e, 0x62, 0x5e, 0x59, 0x9c, 0x5e, 0x2e, + 0x0e, 0x65, 0xf8, 0x29, 0xdf, 0xb6, 0x65, 0x37, 0x88, 0x96, 0xdc, 0x0f, 0x86, 0x68, 0x01, 0x66, + 0x1c, 0xec, 0x32, 0x9d, 0x13, 0xe3, 0x1b, 0x9d, 0x14, 0x46, 0xa7, 0xc3, 0x65, 0x61, 0x37, 0xff, +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99, 0x02, 0x53, 0xd1, 0x8a, 0x1e, 0xc9, 0xde, 0x1f, 0x49, 0xe7, 0x91, 0x5f, + 0x38, 0x56, 0xcf, 0x8b, 0x1c, 0x75, 0x4d, 0x60, 0xbc, 0x85, 0x46, 0xe0, 0x0e, 0xfd, 0x5b, 0x81, + 0x74, 0x57, 0xfd, 0x2f, 0x75, 0xab, 0xac, 0x43, 0xc8, 0xcf, 0xf5, 0x85, 0xe7, 0x3a, 0xef, 0xff, + 0x03, 0xea, 0x0a, 0x23, 0x51, 0x07, 0x9d, 0x62, 0x58, 0xea, 0xcd, 0xbe, 0x5a, 0x39, 0x2f, 0xcb, + 0x44, 0x9a, 0x68, 0xf9, 0x2b, 0x84, 0xa9, 0x4f, 0x05, 0xa8, 0xc7, 0xea, 0x03, 0x01, 0xca, 0x37, + 0xf6, 0x91, 0xb8, 0x56, 0x49, 0x68, 0x94, 0xc7, 0xdc, 0x17, 0x0a, 0x9c, 0x0c, 0x60, 0x30, 0x97, + 0x60, 0x53, 0xb7, 0x9a, 0xc3, 0xc3, 0x3d, 0x32, 0x9f, 0x63, 0xa3, 0x83, 0xfa, 0x85, 0x40, 0xbd, + 0xa3, 0x6e, 0x7f, 0x0a, 0xd4, 0x11, 0x8c, 0xab, 0x4a, 0xe1, 0x9a, 0x82, 0xfe, 0xa5, 0xc0, 0x18, + 0xcf, 0xa7, 0xe8, 0xbc, 0x94, 0xba, 0x30, 0xd1, 0x1e, 0x43, 0xed, 0x63, 0x01, 0x72, 0x5d, 0xbd, + 0x33, 0x0a, 0x48, 0x97, 0xe0, 0x06, 0x27, 0xf5, 0x9d, 0x02, 0xe9, 0x10, 0xe9, 0x50, 0xe0, 0x86, + 0x22, 0x72, 0x47, 0x60, 0x7c, 0xa2, 0x6e, 0x8c, 0x82, 0x91, 0x46, 0x71, 0x79, 0x14, 0x7e, 0x50, + 0x20, 0xd3, 0x9b, 0x43, 0x51, 0x41, 0x82, 0xe8, 0x88, 0x44, 0x9b, 0x3f, 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0x56, 0xa3, 0xe8, 0x9f, 0x5b, 0x7c, 0xb6, 0xf4, 0x75, 0x20, 0x79, 0x29, 0x24, + 0x2f, 0x7d, 0xc9, 0xcb, 0x67, 0x4b, 0xb5, 0x84, 0x38, 0xf8, 0x37, 0x3f, 0x04, 0x00, 0x00, 0xff, + 0xff, 0x92, 0x18, 0x4b, 0x1c, 0x59, 0x17, 0x00, 0x00, } diff --git a/vendor/google.golang.org/genproto/googleapis/tracing/v1/trace.pb.go b/vendor/google.golang.org/genproto/googleapis/tracing/v1/trace.pb.go deleted file mode 100644 index b25493668..000000000 --- a/vendor/google.golang.org/genproto/googleapis/tracing/v1/trace.pb.go +++ /dev/null @@ -1,888 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: google/tracing/trace.proto - -/* -Package tracing is a generated protocol buffer package. - -It is generated from these files: - google/tracing/trace.proto - -It has these top-level messages: - TraceId - Module - StackTrace - LabelValue - Span - Trace -*/ -package tracing - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "google.golang.org/genproto/googleapis/api/annotations" -import google_protobuf1 "github.com/golang/protobuf/ptypes/timestamp" -import google_rpc "google.golang.org/genproto/googleapis/rpc/status" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -// The type of the network event. SENT or RECV event. -type Span_TimeEvent_NetworkEvent_Type int32 - -const ( - Span_TimeEvent_NetworkEvent_UNSPECIFIED Span_TimeEvent_NetworkEvent_Type = 0 - Span_TimeEvent_NetworkEvent_SENT Span_TimeEvent_NetworkEvent_Type = 1 - Span_TimeEvent_NetworkEvent_RECV Span_TimeEvent_NetworkEvent_Type = 2 -) - -var Span_TimeEvent_NetworkEvent_Type_name = map[int32]string{ - 0: "UNSPECIFIED", - 1: "SENT", - 2: "RECV", -} -var Span_TimeEvent_NetworkEvent_Type_value = map[string]int32{ - "UNSPECIFIED": 0, - "SENT": 1, - "RECV": 2, -} - -func (x Span_TimeEvent_NetworkEvent_Type) String() string { - return proto.EnumName(Span_TimeEvent_NetworkEvent_Type_name, int32(x)) -} -func (Span_TimeEvent_NetworkEvent_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor0, []int{4, 0, 1, 0} -} - -// The type of the link. -type Span_Link_Type int32 - -const ( - Span_Link_UNSPECIFIED Span_Link_Type = 0 - Span_Link_CHILD Span_Link_Type = 1 - Span_Link_PARENT Span_Link_Type = 2 -) - -var Span_Link_Type_name = map[int32]string{ - 0: "UNSPECIFIED", - 1: "CHILD", - 2: "PARENT", -} -var Span_Link_Type_value = map[string]int32{ - "UNSPECIFIED": 0, - "CHILD": 1, - "PARENT": 2, -} - -func (x Span_Link_Type) String() string { - return proto.EnumName(Span_Link_Type_name, int32(x)) -} -func (Span_Link_Type) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{4, 1, 0} } - -// A TraceId uniquely identifies a Trace. It is conceptually a 128-bit value, -// represented as a string, containing the hex-encoded value. -type TraceId struct { - // Trace ID specified as a hex-encoded string. *Must* be 32 bytes long. - HexEncoded string `protobuf:"bytes,1,opt,name=hex_encoded,json=hexEncoded" json:"hex_encoded,omitempty"` -} - -func (m *TraceId) Reset() { *m = TraceId{} } -func (m *TraceId) String() string { return proto.CompactTextString(m) } -func (*TraceId) ProtoMessage() {} -func (*TraceId) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } - -func (m *TraceId) GetHexEncoded() string { - if m != nil { - return m.HexEncoded - } - return "" -} - -type Module struct { - // Binary module. - // E.g. main binary, kernel modules, and dynamic libraries - // such as libc.so, sharedlib.so - Module string `protobuf:"bytes,1,opt,name=module" json:"module,omitempty"` - // Build_id is a unique identifier for the module, - // probably a hash of its contents - BuildId string `protobuf:"bytes,2,opt,name=build_id,json=buildId" json:"build_id,omitempty"` -} - -func (m *Module) Reset() { *m = Module{} } -func (m *Module) String() string { return proto.CompactTextString(m) } -func (*Module) ProtoMessage() {} -func (*Module) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } - -func (m *Module) GetModule() string { - if m != nil { - return m.Module - } - return "" -} - -func (m *Module) GetBuildId() string { - if m != nil { - return m.BuildId - } - return "" -} - -type StackTrace struct { - // Stack frames of this stack trace. - StackFrame []*StackTrace_StackFrame `protobuf:"bytes,1,rep,name=stack_frame,json=stackFrame" json:"stack_frame,omitempty"` - // User can choose to use his own hash function to hash large labels to save - // network bandwidth and storage. - // Typical usage is to pass both initially to inform the storage of the - // mapping. And in subsequent calls, pass in stack_trace_hash_id only. - // User shall verify the hash value is successfully stored. - StackTraceHashId uint64 `protobuf:"varint,2,opt,name=stack_trace_hash_id,json=stackTraceHashId" json:"stack_trace_hash_id,omitempty"` -} - -func (m *StackTrace) Reset() { *m = StackTrace{} } -func (m *StackTrace) String() string { return proto.CompactTextString(m) } -func (*StackTrace) ProtoMessage() {} -func (*StackTrace) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } - -func (m *StackTrace) GetStackFrame() []*StackTrace_StackFrame { - if m != nil { - return m.StackFrame - } - return nil -} - -func (m *StackTrace) GetStackTraceHashId() uint64 { - if m != nil { - return m.StackTraceHashId - } - return 0 -} - -// Presents a single stack frame in a stack trace. -type StackTrace_StackFrame struct { - // Fully qualified names which uniquely identify function/method/etc. - FunctionName string `protobuf:"bytes,1,opt,name=function_name,json=functionName" json:"function_name,omitempty"` - // Used when function name is ‘mangled’. Not guaranteed to be fully - // qualified but usually it is. - OrigFunctionName string `protobuf:"bytes,2,opt,name=orig_function_name,json=origFunctionName" json:"orig_function_name,omitempty"` - // File name of the frame. - FileName string `protobuf:"bytes,3,opt,name=file_name,json=fileName" json:"file_name,omitempty"` - // Line number of the frame. - LineNumber int64 `protobuf:"varint,4,opt,name=line_number,json=lineNumber" json:"line_number,omitempty"` - // Column number is important in JavaScript(anonymous functions), - // Might not be available in some languages. - ColumnNumber int64 `protobuf:"varint,5,opt,name=column_number,json=columnNumber" json:"column_number,omitempty"` - // Binary module the code is loaded from. - LoadModule *Module `protobuf:"bytes,6,opt,name=load_module,json=loadModule" json:"load_module,omitempty"` - // source_version is deployment specific. It might be - // better to be stored in deployment metadata. - // However, in distributed tracing, it’s hard to keep track of - // source/binary versions at one place for all spans. - SourceVersion string `protobuf:"bytes,7,opt,name=source_version,json=sourceVersion" json:"source_version,omitempty"` -} - -func (m *StackTrace_StackFrame) Reset() { *m = StackTrace_StackFrame{} } -func (m *StackTrace_StackFrame) String() string { return proto.CompactTextString(m) } -func (*StackTrace_StackFrame) ProtoMessage() {} -func (*StackTrace_StackFrame) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} } - -func (m *StackTrace_StackFrame) GetFunctionName() string { - if m != nil { - return m.FunctionName - } - return "" -} - -func (m *StackTrace_StackFrame) GetOrigFunctionName() string { - if m != nil { - return m.OrigFunctionName - } - return "" -} - -func (m *StackTrace_StackFrame) GetFileName() string { - if m != nil { - return m.FileName - } - return "" -} - -func (m *StackTrace_StackFrame) GetLineNumber() int64 { - if m != nil { - return m.LineNumber - } - return 0 -} - -func (m *StackTrace_StackFrame) GetColumnNumber() int64 { - if m != nil { - return m.ColumnNumber - } - return 0 -} - -func (m *StackTrace_StackFrame) GetLoadModule() *Module { - if m != nil { - return m.LoadModule - } - return nil -} - -func (m *StackTrace_StackFrame) GetSourceVersion() string { - if m != nil { - return m.SourceVersion - } - return "" -} - -// Allowed label values. -type LabelValue struct { - // The value of the label. - // - // Types that are valid to be assigned to Value: - // *LabelValue_StringValue - // *LabelValue_IntValue - // *LabelValue_BoolValue - Value isLabelValue_Value `protobuf_oneof:"value"` -} - -func (m *LabelValue) Reset() { *m = LabelValue{} } -func (m *LabelValue) String() string { return proto.CompactTextString(m) } -func (*LabelValue) ProtoMessage() {} -func (*LabelValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } - -type isLabelValue_Value interface { - isLabelValue_Value() -} - -type LabelValue_StringValue struct { - StringValue string `protobuf:"bytes,1,opt,name=string_value,json=stringValue,oneof"` -} -type LabelValue_IntValue struct { - IntValue int64 `protobuf:"varint,2,opt,name=int_value,json=intValue,oneof"` -} -type LabelValue_BoolValue struct { - BoolValue bool `protobuf:"varint,3,opt,name=bool_value,json=boolValue,oneof"` -} - -func (*LabelValue_StringValue) isLabelValue_Value() {} -func (*LabelValue_IntValue) isLabelValue_Value() {} -func (*LabelValue_BoolValue) isLabelValue_Value() {} - -func (m *LabelValue) GetValue() isLabelValue_Value { - if m != nil { - return m.Value - } - return nil -} - -func (m *LabelValue) GetStringValue() string { - if x, ok := m.GetValue().(*LabelValue_StringValue); ok { - return x.StringValue - } - return "" -} - -func (m *LabelValue) GetIntValue() int64 { - if x, ok := m.GetValue().(*LabelValue_IntValue); ok { - return x.IntValue - } - return 0 -} - -func (m *LabelValue) GetBoolValue() bool { - if x, ok := m.GetValue().(*LabelValue_BoolValue); ok { - return x.BoolValue - } - return false -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*LabelValue) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _LabelValue_OneofMarshaler, _LabelValue_OneofUnmarshaler, _LabelValue_OneofSizer, []interface{}{ - (*LabelValue_StringValue)(nil), - (*LabelValue_IntValue)(nil), - (*LabelValue_BoolValue)(nil), - } -} - -func _LabelValue_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*LabelValue) - // value - switch x := m.Value.(type) { - case *LabelValue_StringValue: - b.EncodeVarint(1<<3 | proto.WireBytes) - b.EncodeStringBytes(x.StringValue) - case *LabelValue_IntValue: - b.EncodeVarint(2<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.IntValue)) - case *LabelValue_BoolValue: - t := uint64(0) - if x.BoolValue { - t = 1 - } - b.EncodeVarint(3<<3 | proto.WireVarint) - b.EncodeVarint(t) - case nil: - default: - return fmt.Errorf("LabelValue.Value has unexpected type %T", x) - } - return nil -} - -func _LabelValue_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*LabelValue) - switch tag { - case 1: // value.string_value - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Value = &LabelValue_StringValue{x} - return true, err - case 2: // value.int_value - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Value = &LabelValue_IntValue{int64(x)} - return true, err - case 3: // value.bool_value - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Value = &LabelValue_BoolValue{x != 0} - return true, err - default: - return false, nil - } -} - -func _LabelValue_OneofSizer(msg proto.Message) (n int) { - m := msg.(*LabelValue) - // value - switch x := m.Value.(type) { - case *LabelValue_StringValue: - n += proto.SizeVarint(1<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.StringValue))) - n += len(x.StringValue) - case *LabelValue_IntValue: - n += proto.SizeVarint(2<<3 | proto.WireVarint) - n += proto.SizeVarint(uint64(x.IntValue)) - case *LabelValue_BoolValue: - n += proto.SizeVarint(3<<3 | proto.WireVarint) - n += 1 - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -// A span represents a single operation within a trace. Spans can be nested -// and form a trace tree. Often, a trace contains a root span that describes the -// end-to-end latency and, optionally, one or more subspans for -// its sub-operations. Spans do not need to be contiguous. There may be gaps -// between spans in a trace. -type Span struct { - // Identifier for the span. Must be a 64-bit integer other than 0 and - // unique within a trace. - Id uint64 `protobuf:"fixed64,1,opt,name=id" json:"id,omitempty"` - // Name of the span. The span name is sanitized and displayed in the - // Stackdriver Trace tool in the {% dynamic print site_values.console_name %}. - // The name may be a method name or some other per-call site name. - // For the same executable and the same call point, a best practice is - // to use a consistent name, which makes it easier to correlate - // cross-trace spans. - Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` - // ID of parent span. 0 or missing if this is a root span. - ParentId uint64 `protobuf:"fixed64,3,opt,name=parent_id,json=parentId" json:"parent_id,omitempty"` - // Local machine clock in nanoseconds from the UNIX epoch, - // at which span execution started. - // On the server side these are the times when the server application - // handler starts running. - LocalStartTime *google_protobuf1.Timestamp `protobuf:"bytes,4,opt,name=local_start_time,json=localStartTime" json:"local_start_time,omitempty"` - // Local machine clock in nanoseconds from the UNIX epoch, - // at which span execution ended. - // On the server side these are the times when the server application - // handler finishes running. - LocalEndTime *google_protobuf1.Timestamp `protobuf:"bytes,5,opt,name=local_end_time,json=localEndTime" json:"local_end_time,omitempty"` - // Properties of a span. Labels at the span level. - // E.g. - // "/instance_id": "my-instance" - // "/zone": "us-central1-a" - // "/grpc/peer_address": "ip:port" (dns, etc.) - // "/grpc/deadline": "Duration" - // "/http/user_agent" - // "/http/request_bytes": 300 - // "/http/response_bytes": 1200 - // "/http/url": google.com/apis - // "/pid" - // "abc.com/mylabel": "my label value" - Labels map[string]*LabelValue `protobuf:"bytes,6,rep,name=labels" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - // Stack trace captured at the start of the span. This is optional. - StackTrace *StackTrace `protobuf:"bytes,7,opt,name=stack_trace,json=stackTrace" json:"stack_trace,omitempty"` - // A collection of time-stamped events. - TimeEvents []*Span_TimeEvent `protobuf:"bytes,8,rep,name=time_events,json=timeEvents" json:"time_events,omitempty"` - // A collection of links. - Links []*Span_Link `protobuf:"bytes,9,rep,name=links" json:"links,omitempty"` - // The final status of the Span. This is optional. - Status *google_rpc.Status `protobuf:"bytes,10,opt,name=status" json:"status,omitempty"` - // True if this Span has a remote parent (is an RPC server Span). - HasRemoteParent bool `protobuf:"varint,11,opt,name=has_remote_parent,json=hasRemoteParent" json:"has_remote_parent,omitempty"` -} - -func (m *Span) Reset() { *m = Span{} } -func (m *Span) String() string { return proto.CompactTextString(m) } -func (*Span) ProtoMessage() {} -func (*Span) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } - -func (m *Span) GetId() uint64 { - if m != nil { - return m.Id - } - return 0 -} - -func (m *Span) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *Span) GetParentId() uint64 { - if m != nil { - return m.ParentId - } - return 0 -} - -func (m *Span) GetLocalStartTime() *google_protobuf1.Timestamp { - if m != nil { - return m.LocalStartTime - } - return nil -} - -func (m *Span) GetLocalEndTime() *google_protobuf1.Timestamp { - if m != nil { - return m.LocalEndTime - } - return nil -} - -func (m *Span) GetLabels() map[string]*LabelValue { - if m != nil { - return m.Labels - } - return nil -} - -func (m *Span) GetStackTrace() *StackTrace { - if m != nil { - return m.StackTrace - } - return nil -} - -func (m *Span) GetTimeEvents() []*Span_TimeEvent { - if m != nil { - return m.TimeEvents - } - return nil -} - -func (m *Span) GetLinks() []*Span_Link { - if m != nil { - return m.Links - } - return nil -} - -func (m *Span) GetStatus() *google_rpc.Status { - if m != nil { - return m.Status - } - return nil -} - -func (m *Span) GetHasRemoteParent() bool { - if m != nil { - return m.HasRemoteParent - } - return false -} - -// A time-stamped annotation in the Span. -type Span_TimeEvent struct { - // The local machine absolute timestamp when this event happened. - LocalTime *google_protobuf1.Timestamp `protobuf:"bytes,1,opt,name=local_time,json=localTime" json:"local_time,omitempty"` - // Types that are valid to be assigned to Value: - // *Span_TimeEvent_Annotation_ - // *Span_TimeEvent_NetworkEvent_ - Value isSpan_TimeEvent_Value `protobuf_oneof:"value"` -} - -func (m *Span_TimeEvent) Reset() { *m = Span_TimeEvent{} } -func (m *Span_TimeEvent) String() string { return proto.CompactTextString(m) } -func (*Span_TimeEvent) ProtoMessage() {} -func (*Span_TimeEvent) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4, 0} } - -type isSpan_TimeEvent_Value interface { - isSpan_TimeEvent_Value() -} - -type Span_TimeEvent_Annotation_ struct { - Annotation *Span_TimeEvent_Annotation `protobuf:"bytes,2,opt,name=annotation,oneof"` -} -type Span_TimeEvent_NetworkEvent_ struct { - NetworkEvent *Span_TimeEvent_NetworkEvent `protobuf:"bytes,3,opt,name=network_event,json=networkEvent,oneof"` -} - -func (*Span_TimeEvent_Annotation_) isSpan_TimeEvent_Value() {} -func (*Span_TimeEvent_NetworkEvent_) isSpan_TimeEvent_Value() {} - -func (m *Span_TimeEvent) GetValue() isSpan_TimeEvent_Value { - if m != nil { - return m.Value - } - return nil -} - -func (m *Span_TimeEvent) GetLocalTime() *google_protobuf1.Timestamp { - if m != nil { - return m.LocalTime - } - return nil -} - -func (m *Span_TimeEvent) GetAnnotation() *Span_TimeEvent_Annotation { - if x, ok := m.GetValue().(*Span_TimeEvent_Annotation_); ok { - return x.Annotation - } - return nil -} - -func (m *Span_TimeEvent) GetNetworkEvent() *Span_TimeEvent_NetworkEvent { - if x, ok := m.GetValue().(*Span_TimeEvent_NetworkEvent_); ok { - return x.NetworkEvent - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Span_TimeEvent) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Span_TimeEvent_OneofMarshaler, _Span_TimeEvent_OneofUnmarshaler, _Span_TimeEvent_OneofSizer, []interface{}{ - (*Span_TimeEvent_Annotation_)(nil), - (*Span_TimeEvent_NetworkEvent_)(nil), - } -} - -func _Span_TimeEvent_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Span_TimeEvent) - // value - switch x := m.Value.(type) { - case *Span_TimeEvent_Annotation_: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Annotation); err != nil { - return err - } - case *Span_TimeEvent_NetworkEvent_: - b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.NetworkEvent); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("Span_TimeEvent.Value has unexpected type %T", x) - } - return nil -} - -func _Span_TimeEvent_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Span_TimeEvent) - switch tag { - case 2: // value.annotation - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Span_TimeEvent_Annotation) - err := b.DecodeMessage(msg) - m.Value = &Span_TimeEvent_Annotation_{msg} - return true, err - case 3: // value.network_event - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(Span_TimeEvent_NetworkEvent) - err := b.DecodeMessage(msg) - m.Value = &Span_TimeEvent_NetworkEvent_{msg} - return true, err - default: - return false, nil - } -} - -func _Span_TimeEvent_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Span_TimeEvent) - // value - switch x := m.Value.(type) { - case *Span_TimeEvent_Annotation_: - s := proto.Size(x.Annotation) - n += proto.SizeVarint(2<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case *Span_TimeEvent_NetworkEvent_: - s := proto.Size(x.NetworkEvent) - n += proto.SizeVarint(3<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -// Text annotation with a set of labels. -type Span_TimeEvent_Annotation struct { - // A user-supplied message describing the event. - Description string `protobuf:"bytes,1,opt,name=description" json:"description,omitempty"` - // A set of labels on the annotation. - Labels map[string]*LabelValue `protobuf:"bytes,2,rep,name=labels" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` -} - -func (m *Span_TimeEvent_Annotation) Reset() { *m = Span_TimeEvent_Annotation{} } -func (m *Span_TimeEvent_Annotation) String() string { return proto.CompactTextString(m) } -func (*Span_TimeEvent_Annotation) ProtoMessage() {} -func (*Span_TimeEvent_Annotation) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4, 0, 0} } - -func (m *Span_TimeEvent_Annotation) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *Span_TimeEvent_Annotation) GetLabels() map[string]*LabelValue { - if m != nil { - return m.Labels - } - return nil -} - -// An event describing an RPC message sent/received on the network. -type Span_TimeEvent_NetworkEvent struct { - // If available, this is the kernel time: - // For sent messages, this is the time at which the first bit was sent. - // For received messages, this is the time at which the last bit was - // received. - KernelTime *google_protobuf1.Timestamp `protobuf:"bytes,1,opt,name=kernel_time,json=kernelTime" json:"kernel_time,omitempty"` - Type Span_TimeEvent_NetworkEvent_Type `protobuf:"varint,2,opt,name=type,enum=google.tracing.v1.Span_TimeEvent_NetworkEvent_Type" json:"type,omitempty"` - // Every message has an identifier, that must be different from all the - // network messages in this span. - // This is very important when the request/response are streamed. - MessageId uint64 `protobuf:"varint,3,opt,name=message_id,json=messageId" json:"message_id,omitempty"` - // Number of bytes send/receive. - MessageSize uint64 `protobuf:"varint,4,opt,name=message_size,json=messageSize" json:"message_size,omitempty"` -} - -func (m *Span_TimeEvent_NetworkEvent) Reset() { *m = Span_TimeEvent_NetworkEvent{} } -func (m *Span_TimeEvent_NetworkEvent) String() string { return proto.CompactTextString(m) } -func (*Span_TimeEvent_NetworkEvent) ProtoMessage() {} -func (*Span_TimeEvent_NetworkEvent) Descriptor() ([]byte, []int) { - return fileDescriptor0, []int{4, 0, 1} -} - -func (m *Span_TimeEvent_NetworkEvent) GetKernelTime() *google_protobuf1.Timestamp { - if m != nil { - return m.KernelTime - } - return nil -} - -func (m *Span_TimeEvent_NetworkEvent) GetType() Span_TimeEvent_NetworkEvent_Type { - if m != nil { - return m.Type - } - return Span_TimeEvent_NetworkEvent_UNSPECIFIED -} - -func (m *Span_TimeEvent_NetworkEvent) GetMessageId() uint64 { - if m != nil { - return m.MessageId - } - return 0 -} - -func (m *Span_TimeEvent_NetworkEvent) GetMessageSize() uint64 { - if m != nil { - return m.MessageSize - } - return 0 -} - -// Link one span with another which may be in a different Trace. Used (for -// example) in batching operations, where a single batch handler processes -// multiple requests from different traces. -type Span_Link struct { - // The trace and span identifier of the linked span. - TraceId *TraceId `protobuf:"bytes,1,opt,name=trace_id,json=traceId" json:"trace_id,omitempty"` - SpanId uint64 `protobuf:"fixed64,2,opt,name=span_id,json=spanId" json:"span_id,omitempty"` - Type Span_Link_Type `protobuf:"varint,3,opt,name=type,enum=google.tracing.v1.Span_Link_Type" json:"type,omitempty"` -} - -func (m *Span_Link) Reset() { *m = Span_Link{} } -func (m *Span_Link) String() string { return proto.CompactTextString(m) } -func (*Span_Link) ProtoMessage() {} -func (*Span_Link) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4, 1} } - -func (m *Span_Link) GetTraceId() *TraceId { - if m != nil { - return m.TraceId - } - return nil -} - -func (m *Span_Link) GetSpanId() uint64 { - if m != nil { - return m.SpanId - } - return 0 -} - -func (m *Span_Link) GetType() Span_Link_Type { - if m != nil { - return m.Type - } - return Span_Link_UNSPECIFIED -} - -// A trace describes how long it takes for an application to perform some -// operations. It consists of a tree of spans, each of which contains details -// about an operation with time information and operation details. -type Trace struct { - // Globally unique identifier for the trace. Common to all the spans. - TraceId *TraceId `protobuf:"bytes,1,opt,name=trace_id,json=traceId" json:"trace_id,omitempty"` - // Collection of spans in the trace. The root span has parent_id == 0. - Spans []*Span `protobuf:"bytes,2,rep,name=spans" json:"spans,omitempty"` -} - -func (m *Trace) Reset() { *m = Trace{} } -func (m *Trace) String() string { return proto.CompactTextString(m) } -func (*Trace) ProtoMessage() {} -func (*Trace) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } - -func (m *Trace) GetTraceId() *TraceId { - if m != nil { - return m.TraceId - } - return nil -} - -func (m *Trace) GetSpans() []*Span { - if m != nil { - return m.Spans - } - return nil -} - -func init() { - proto.RegisterType((*TraceId)(nil), "google.tracing.v1.TraceId") - proto.RegisterType((*Module)(nil), "google.tracing.v1.Module") - proto.RegisterType((*StackTrace)(nil), "google.tracing.v1.StackTrace") - proto.RegisterType((*StackTrace_StackFrame)(nil), "google.tracing.v1.StackTrace.StackFrame") - proto.RegisterType((*LabelValue)(nil), "google.tracing.v1.LabelValue") - proto.RegisterType((*Span)(nil), "google.tracing.v1.Span") - proto.RegisterType((*Span_TimeEvent)(nil), "google.tracing.v1.Span.TimeEvent") - proto.RegisterType((*Span_TimeEvent_Annotation)(nil), "google.tracing.v1.Span.TimeEvent.Annotation") - proto.RegisterType((*Span_TimeEvent_NetworkEvent)(nil), "google.tracing.v1.Span.TimeEvent.NetworkEvent") - proto.RegisterType((*Span_Link)(nil), "google.tracing.v1.Span.Link") - proto.RegisterType((*Trace)(nil), "google.tracing.v1.Trace") - proto.RegisterEnum("google.tracing.v1.Span_TimeEvent_NetworkEvent_Type", Span_TimeEvent_NetworkEvent_Type_name, Span_TimeEvent_NetworkEvent_Type_value) - proto.RegisterEnum("google.tracing.v1.Span_Link_Type", Span_Link_Type_name, Span_Link_Type_value) -} - -func init() { proto.RegisterFile("google/tracing/trace.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 1102 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xdd, 0x6e, 0x1a, 0x47, - 0x14, 0x66, 0xf9, 0x59, 0xe0, 0x2c, 0x76, 0xc8, 0x54, 0xad, 0x09, 0x8d, 0x65, 0x9b, 0xa8, 0x92, - 0xe5, 0x26, 0x8b, 0x82, 0x15, 0xc9, 0x8d, 0xa5, 0xaa, 0xb1, 0x8d, 0x0b, 0x52, 0x8a, 0xd0, 0xe0, - 0x58, 0x55, 0x6f, 0x56, 0xc3, 0xee, 0x18, 0x56, 0x2c, 0xb3, 0xab, 0x9d, 0x81, 0xc6, 0xbe, 0xed, - 0x1b, 0xf4, 0x1d, 0x7a, 0xdb, 0x37, 0xe8, 0x83, 0xb4, 0x4f, 0x53, 0xcd, 0xcf, 0x62, 0xaa, 0xd8, - 0x71, 0x53, 0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 0xe8, 0x05, 0x7c, 0xa6, 0x43, 0x29, 0x09, - 0xbd, 0x29, 0xe1, 0xd3, 0xec, 0xfc, 0x22, 0xae, 0xf3, 0x95, 0x7f, 0x8f, 0xf0, 0x69, 0x3f, 0x68, - 0xfe, 0x96, 0x37, 0x89, 0x68, 0xef, 0x67, 0xb0, 0x71, 0xb5, 0x60, 0xbe, 0x54, 0xd3, 0x63, 0x3a, - 0x15, 0x99, 0x77, 0x2d, 0x03, 0x07, 0x92, 0xf4, 0x1c, 0x50, 0x9c, 0x86, 0x13, 0xef, 0x9f, 0x4c, - 0x7d, 0xc3, 0xba, 0xb4, 0x9c, 0xaf, 0xb3, 0xbf, 0x84, 0xea, 0x55, 0x18, 0x51, 0x4d, 0x2a, 0x28, - 0x52, 0x45, 0x02, 0xca, 0xb8, 0x03, 0x4e, 0x14, 0x32, 0xea, 0xb1, 0xc5, 0x7c, 0x4c, 0xd3, 0x46, - 0x71, 0xd7, 0xda, 0x2f, 0x60, 0x90, 0xd0, 0x40, 0x21, 0x32, 0x21, 0x3f, 0x8e, 0x16, 0x73, 0x96, - 0x51, 0x4a, 0x8a, 0x52, 0xd3, 0xa0, 0x21, 0xbd, 0x06, 0x27, 0x8a, 0x49, 0xe0, 0x99, 0x2a, 0xd8, - 0xbb, 0xd6, 0xbe, 0xd3, 0x79, 0x72, 0x87, 0x7c, 0xba, 0x60, 0x18, 0x24, 0xdb, 0x14, 0xef, 0x2b, - 0xd8, 0xe4, 0xf1, 0x22, 0xf5, 0xa9, 0xb7, 0xa4, 0x29, 0x0f, 0x63, 0xd6, 0x28, 0xab, 0x1c, 0x37, - 0x34, 0x7a, 0xa9, 0xc1, 0xd6, 0x0d, 0xc0, 0x5b, 0x32, 0xa6, 0xd1, 0x25, 0x89, 0x16, 0x52, 0xa6, - 0x1a, 0x17, 0x69, 0xc8, 0x26, 0xde, 0x52, 0xee, 0xb5, 0x4a, 0xbd, 0x1c, 0x76, 0x34, 0xaa, 0x49, - 0xdb, 0x50, 0x0d, 0x99, 0x30, 0x0c, 0xa9, 0x4e, 0xa1, 0x97, 0xc3, 0x95, 0x90, 0x09, 0x6d, 0xde, - 0x01, 0x18, 0xc7, 0x71, 0x64, 0xec, 0x52, 0x98, 0x4a, 0x2f, 0x87, 0xab, 0x12, 0x53, 0x84, 0x93, - 0x32, 0x94, 0x94, 0xad, 0xf5, 0x6b, 0x0d, 0x8a, 0xa3, 0x84, 0x30, 0xb4, 0x09, 0xf9, 0x50, 0xb7, - 0xa2, 0x8d, 0xf3, 0x61, 0x80, 0x10, 0x14, 0xd7, 0xa4, 0x57, 0x6b, 0x29, 0x77, 0x42, 0x52, 0xca, - 0x84, 0xac, 0x7a, 0x41, 0x51, 0x2b, 0x1a, 0xe8, 0x07, 0xe8, 0x0c, 0xea, 0x51, 0xec, 0x93, 0xc8, - 0xe3, 0x82, 0xa4, 0xc2, 0x93, 0x73, 0xa1, 0x34, 0x77, 0x3a, 0xcd, 0x4c, 0xad, 0x6c, 0x68, 0xdc, - 0x8b, 0x6c, 0x68, 0xf0, 0xa6, 0xf2, 0x19, 0x49, 0x17, 0x09, 0xa2, 0xef, 0x40, 0x23, 0x1e, 0x65, - 0x81, 0x8e, 0x51, 0x7a, 0x30, 0x46, 0x4d, 0x79, 0x74, 0x59, 0xa0, 0x22, 0x1c, 0x83, 0x1d, 0x49, - 0x35, 0x79, 0xc3, 0x56, 0xad, 0xfe, 0xec, 0xae, 0x56, 0x4f, 0x08, 0x73, 0x95, 0xe6, 0xbc, 0xcb, - 0x44, 0x7a, 0x8d, 0x8d, 0x0b, 0xfa, 0x36, 0x1b, 0x16, 0xd5, 0xe1, 0xaa, 0x5c, 0x4e, 0x67, 0xfb, - 0xa3, 0xc3, 0x62, 0x26, 0x44, 0x0f, 0xdb, 0x09, 0x38, 0x32, 0x69, 0x8f, 0x2e, 0x29, 0x13, 0xbc, - 0x51, 0x51, 0x19, 0xec, 0xdd, 0x97, 0x81, 0xcc, 0xb7, 0x2b, 0x99, 0x18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 0xa1, 0x74, 0xda, 0xeb, 0xbf, 0x3d, 0xab, 0x5b, 0x08, - 0xc0, 0x1e, 0xbe, 0xc1, 0xf2, 0x4a, 0xf9, 0xff, 0xaf, 0x51, 0x5a, 0x73, 0x28, 0xe9, 0xe7, 0xec, - 0x3f, 0x2a, 0xf3, 0x02, 0x4a, 0x52, 0x8a, 0x6c, 0x26, 0xb6, 0xee, 0x51, 0x00, 0x6b, 0xd6, 0x89, - 0x07, 0x9f, 0xfb, 0xf1, 0xfc, 0x43, 0xd2, 0x09, 0xa8, 0xc8, 0x43, 0xd9, 0x87, 0x43, 0xeb, 0xa7, - 0x23, 0x43, 0x98, 0xc4, 0x11, 0x61, 0x13, 0x37, 0x4e, 0x27, 0xed, 0x09, 0x65, 0xaa, 0x4b, 0xdb, - 0xda, 0x44, 0x92, 0x90, 0xaf, 0xfe, 0xe6, 0x2d, 0x5f, 0x1e, 0x9b, 0xe5, 0xd8, 0x56, 0xa4, 0xc3, - 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x30, 0x5b, 0x04, 0x0a, 0x0a, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/genproto/protobuf/field_mask/field_mask.pb.go b/vendor/google.golang.org/genproto/protobuf/field_mask/field_mask.pb.go index 42693d686..485bf0066 100644 --- a/vendor/google.golang.org/genproto/protobuf/field_mask/field_mask.pb.go +++ b/vendor/google.golang.org/genproto/protobuf/field_mask/field_mask.pb.go @@ -228,12 +228,6 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // // Note that oneof type names ("test_oneof" in this case) cannot be used in // paths. -// -// ## Field Mask Verification -// -// The implementation of the all the API methods, which have any FieldMask type -// field in the request, should verify the included field paths, and return -// `INVALID_ARGUMENT` error if any path is duplicated or unmappable. type FieldMask struct { // The set of field mask paths. Paths []string `protobuf:"bytes,1,rep,name=paths" json:"paths,omitempty"` diff --git a/vendor/google.golang.org/grpc/Documentation/encoding.md b/vendor/google.golang.org/grpc/Documentation/encoding.md new file mode 100644 index 000000000..31436609d --- /dev/null +++ b/vendor/google.golang.org/grpc/Documentation/encoding.md @@ -0,0 +1,146 @@ +# Encoding + +The gRPC API for sending and receiving is based upon *messages*. However, +messages cannot be transmitted directly over a network; they must first be +converted into *bytes*. This document describes how gRPC-Go converts messages +into bytes and vice-versa for the purposes of network transmission. + +## Codecs (Serialization and Deserialization) + +A `Codec` contains code to serialize a message into a byte slice (`Marshal`) and +deserialize a byte slice back into a message (`Unmarshal`). `Codec`s are +registered by name into a global registry maintained in the `encoding` package. + +### Implementing a `Codec` + +A typical `Codec` will be implemented in its own package with an `init` function +that registers itself, and is imported anonymously. For example: + +```go +package proto + +import "google.golang.org/grpc/encoding" + +func init() { + encoding.RegisterCodec(protoCodec{}) +} + +// ... implementation of protoCodec ... +``` + +For an example, gRPC's implementation of the `proto` codec can be found in +[`encoding/proto`](https://godoc.org/google.golang.org/grpc/encoding/proto). + +### Using a `Codec` + +By default, gRPC registers and uses the "proto" codec, so it is not necessary to +do this in your own code to send and receive proto messages. To use another +`Codec` from a client or server: + +```go +package myclient + +import _ "path/to/another/codec" +``` + +`Codec`s, by definition, must be symmetric, so the same desired `Codec` should +be registered in both client and server binaries. + +On the client-side, to specify a `Codec` to use for message transmission, the +`CallOption` `CallContentSubtype` should be used as follows: + +```go + response, err := myclient.MyCall(ctx, request, grpc.CallContentSubtype("mycodec")) +``` + +As a reminder, all `CallOption`s may be converted into `DialOption`s that become +the default for all RPCs sent through a client using `grpc.WithDefaultCallOptions`: + +```go + myclient := grpc.Dial(ctx, target, grpc.WithDefaultCallOptions(grpc.CallContentSubtype("mycodec"))) +``` + +When specified in either of these ways, messages will be encoded using this +codec and sent along with headers indicating the codec (`content-type` set to +`application/grpc+`). + +On the server-side, using a `Codec` is as simple as registering it into the +global registry (i.e. `import`ing it). If a message is encoded with the content +sub-type supported by a registered `Codec`, it will be used automatically for +decoding the request and encoding the response. Otherwise, for +backward-compatibility reasons, gRPC will attempt to use the "proto" codec. In +an upcoming change (tracked in [this +issue](https://github.com/grpc/grpc-go/issues/1824)), such requests will be +rejected with status code `Unimplemented` instead. + +## Compressors (Compression and Decompression) + +Sometimes, the resulting serialization of a message is not space-efficient, and +it may be beneficial to compress this byte stream before transmitting it over +the network. To facilitate this operation, gRPC supports a mechanism for +performing compression and decompression. + +A `Compressor` contains code to compress and decompress by wrapping `io.Writer`s +and `io.Reader`s, respectively. (The form of `Compress` and `Decompress` were +chosen to most closely match Go's standard package +[implementations](https://golang.org/pkg/compress/) of compressors. Like +`Codec`s, `Compressor`s are registered by name into a global registry maintained +in the `encoding` package. + +### Implementing a `Compressor` + +A typical `Compressor` will be implemented in its own package with an `init` +function that registers itself, and is imported anonymously. For example: + +```go +package gzip + +import "google.golang.org/grpc/encoding" + +func init() { + encoding.RegisterCompressor(compressor{}) +} + +// ... implementation of compressor ... +``` + +An implementation of a `gzip` compressor can be found in +[`encoding/gzip`](https://godoc.org/google.golang.org/grpc/encoding/gzip). + +### Using a `Compressor` + +By default, gRPC does not register or use any compressors. To use a +`Compressor` from a client or server: + +```go +package myclient + +import _ "google.golang.org/grpc/encoding/gzip" +``` + +`Compressor`s, by definition, must be symmetric, so the same desired +`Compressor` should be registered in both client and server binaries. + +On the client-side, to specify a `Compressor` to use for message transmission, +the `CallOption` `UseCompressor` should be used as follows: + +```go + response, err := myclient.MyCall(ctx, request, grpc.UseCompressor("gzip")) +``` + +As a reminder, all `CallOption`s may be converted into `DialOption`s that become +the default for all RPCs sent through a client using `grpc.WithDefaultCallOptions`: + +```go + myclient := grpc.Dial(ctx, target, grpc.WithDefaultCallOptions(grpc.UseCompresor("gzip"))) +``` + +When specified in either of these ways, messages will be compressed using this +compressor and sent along with headers indicating the compressor +(`content-coding` set to ``). + +On the server-side, using a `Compressor` is as simple as registering it into the +global registry (i.e. `import`ing it). If a message is compressed with the +content coding supported by a registered `Compressor`, it will be used +automatically for decompressing the request and compressing the response. +Otherwise, the request will be rejected with status code `Unimplemented`. diff --git a/vendor/google.golang.org/grpc/Documentation/grpc-metadata.md b/vendor/google.golang.org/grpc/Documentation/grpc-metadata.md index c9a88c689..971c469a1 100644 --- a/vendor/google.golang.org/grpc/Documentation/grpc-metadata.md +++ b/vendor/google.golang.org/grpc/Documentation/grpc-metadata.md @@ -82,13 +82,16 @@ func (s *server) SomeRPC(ctx context.Context, in *pb.SomeRequest) (*pb.SomeRespo ### Sending metadata -To send metadata to server, the client can wrap the metadata into a context using `NewOutgoingContext`, and make the RPC with this context: +There are two ways to send metadata to the server. The recommended way is to append kv pairs to the context using +`AppendToOutgoingContext`. This can be used with or without existing metadata on the context. When there is no prior +metadata, metadata is added; when metadata already exists on the context, kv pairs are merged in. ```go -md := metadata.Pairs("key", "val") +// create a new context with some metadata +ctx := metadata.AppendToOutgoingContext(ctx, "k1", "v1", "k1", "v2", "k2", "v3") -// create a new context with this metadata -ctx := metadata.NewOutgoingContext(context.Background(), md) +// later, add some more metadata to the context (e.g. in an interceptor) +ctx := metadata.AppendToOutgoingContext(ctx, "k3", "v4") // make unary RPC response, err := client.SomeRPC(ctx, someRequest) @@ -97,7 +100,27 @@ response, err := client.SomeRPC(ctx, someRequest) stream, err := client.SomeStreamingRPC(ctx) ``` -To read this back from the context on the client (e.g. in an interceptor) before the RPC is sent, use `FromOutgoingContext`. +Alternatively, metadata may be attached to the context using `NewOutgoingContext`. However, this +replaces any existing metadata in the context, so care must be taken to preserve the existing +metadata if desired. This is slower than using `AppendToOutgoingContext`. An example of this +is below: + +```go +// create a new context with some metadata +md := metadata.Pairs("k1", "v1", "k1", "v2", "k2", "v3") +ctx := metadata.NewOutgoingContext(context.Background(), md) + +// later, add some more metadata to the context (e.g. in an interceptor) +md, _ := metadata.FromOutgoingContext(ctx) +newMD := metadata.Pairs("k3", "v3") +ctx = metadata.NewContext(ctx, metadata.Join(metadata.New(send), newMD)) + +// make unary RPC +response, err := client.SomeRPC(ctx, someRequest) + +// or make streaming RPC +stream, err := client.SomeStreamingRPC(ctx) +``` ### Receiving metadata diff --git a/vendor/google.golang.org/grpc/benchmark/primitives/primitives_test.go b/vendor/google.golang.org/grpc/benchmark/primitives/primitives_test.go index 9937ae779..846813d8d 100644 --- a/vendor/google.golang.org/grpc/benchmark/primitives/primitives_test.go +++ b/vendor/google.golang.org/grpc/benchmark/primitives/primitives_test.go @@ -277,55 +277,82 @@ func BenchmarkAtomicTimePointerStore(b *testing.B) { b.StopTimer() } -func BenchmarkValueStoreWithContention(b *testing.B) { +func BenchmarkStoreContentionWithAtomic(b *testing.B) { t := 123 - for _, n := range []int{10, 100, 1000, 10000, 100000} { - b.Run(fmt.Sprintf("Atomic/%v", n), func(b *testing.B) { - var wg sync.WaitGroup - var c atomic.Value - for i := 0; i < n; i++ { - wg.Add(1) - go func() { - for j := 0; j < b.N; j++ { - c.Store(t) + var c unsafe.Pointer + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + atomic.StorePointer(&c, unsafe.Pointer(&t)) + } + }) +} + +func BenchmarkStoreContentionWithMutex(b *testing.B) { + t := 123 + var mu sync.Mutex + var c int + + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + mu.Lock() + c = t + mu.Unlock() + } + }) + _ = c +} + +type dummyStruct struct { + a int64 + b time.Time +} + +func BenchmarkStructStoreContention(b *testing.B) { + d := dummyStruct{} + dp := unsafe.Pointer(&d) + t := time.Now() + for _, j := range []int{100000000, 10000, 0} { + for _, i := range []int{100000, 10} { + b.Run(fmt.Sprintf("CAS/%v/%v", j, i), func(b *testing.B) { + b.SetParallelism(i) + b.RunParallel(func(pb *testing.PB) { + n := &dummyStruct{ + b: t, } - wg.Done() - }() - } - wg.Wait() - }) - b.Run(fmt.Sprintf("AtomicStorePointer/%v", n), func(b *testing.B) { - var wg sync.WaitGroup - var up unsafe.Pointer - for i := 0; i < n; i++ { - wg.Add(1) - go func() { - for j := 0; j < b.N; j++ { - atomic.StorePointer(&up, unsafe.Pointer(&t)) + for pb.Next() { + for y := 0; y < j; y++ { + } + for { + v := (*dummyStruct)(atomic.LoadPointer(&dp)) + n.a = v.a + 1 + if atomic.CompareAndSwapPointer(&dp, unsafe.Pointer(v), unsafe.Pointer(n)) { + n = v + break + } + } } - wg.Done() - }() - } - wg.Wait() - }) - b.Run(fmt.Sprintf("Mutex/%v", n), func(b *testing.B) { - var wg sync.WaitGroup - var c int - mu := sync.Mutex{} - for i := 0; i < n; i++ { - wg.Add(1) - go func() { - for j := 0; j < b.N; j++ { + }) + }) + } + } + + var mu sync.Mutex + for _, j := range []int{100000000, 10000, 0} { + for _, i := range []int{100000, 10} { + b.Run(fmt.Sprintf("Mutex/%v/%v", j, i), func(b *testing.B) { + b.SetParallelism(i) + b.RunParallel(func(pb *testing.PB) { + for pb.Next() { + for y := 0; y < j; y++ { + } mu.Lock() - c = t + d.a++ + d.b = t mu.Unlock() } - wg.Done() - }() - } - _ = c - wg.Wait() - }) + }) + }) + } } } diff --git a/vendor/google.golang.org/grpc/benchmark/worker/benchmark_client.go b/vendor/google.golang.org/grpc/benchmark/worker/benchmark_client.go index 10d82aeeb..f2a26503f 100644 --- a/vendor/google.golang.org/grpc/benchmark/worker/benchmark_client.go +++ b/vendor/google.golang.org/grpc/benchmark/worker/benchmark_client.go @@ -139,7 +139,7 @@ func createConns(config *testpb.ClientConfig) ([]*grpc.ClientConn, func(), error if config.PayloadConfig != nil { switch config.PayloadConfig.Payload.(type) { case *testpb.PayloadConfig_BytebufParams: - opts = append(opts, grpc.WithCodec(byteBufCodec{})) + opts = append(opts, grpc.WithDefaultCallOptions(grpc.CallCustomCodec(byteBufCodec{}))) case *testpb.PayloadConfig_SimpleParams: default: return nil, nil, status.Errorf(codes.InvalidArgument, "unknow payload config: %v", config.PayloadConfig) diff --git a/vendor/google.golang.org/grpc/call.go b/vendor/google.golang.org/grpc/call.go index 13cf8b13b..a66e3c2d9 100644 --- a/vendor/google.golang.org/grpc/call.go +++ b/vendor/google.golang.org/grpc/call.go @@ -19,131 +19,13 @@ package grpc import ( - "io" - "time" - "golang.org/x/net/context" - "golang.org/x/net/trace" - "google.golang.org/grpc/balancer" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/encoding" - "google.golang.org/grpc/peer" - "google.golang.org/grpc/stats" - "google.golang.org/grpc/status" - "google.golang.org/grpc/transport" ) -// recvResponse receives and parses an RPC response. -// On error, it returns the error and indicates whether the call should be retried. -// -// TODO(zhaoq): Check whether the received message sequence is valid. -// TODO ctx is used for stats collection and processing. It is the context passed from the application. -func recvResponse(ctx context.Context, dopts dialOptions, t transport.ClientTransport, c *callInfo, stream *transport.Stream, reply interface{}) (err error) { - // Try to acquire header metadata from the server if there is any. - defer func() { - if err != nil { - if _, ok := err.(transport.ConnectionError); !ok { - t.CloseStream(stream, err) - } - } - }() - c.headerMD, err = stream.Header() - if err != nil { - return - } - p := &parser{r: stream} - var inPayload *stats.InPayload - if dopts.copts.StatsHandler != nil { - inPayload = &stats.InPayload{ - Client: true, - } - } - for { - if c.maxReceiveMessageSize == nil { - return status.Errorf(codes.Internal, "callInfo maxReceiveMessageSize field uninitialized(nil)") - } - - // Set dc if it exists and matches the message compression type used, - // otherwise set comp if a registered compressor exists for it. - var comp encoding.Compressor - var dc Decompressor - if rc := stream.RecvCompress(); dopts.dc != nil && dopts.dc.Type() == rc { - dc = dopts.dc - } else if rc != "" && rc != encoding.Identity { - comp = encoding.GetCompressor(rc) - } - if err = recv(p, dopts.codec, stream, dc, reply, *c.maxReceiveMessageSize, inPayload, comp); err != nil { - if err == io.EOF { - break - } - return - } - } - if inPayload != nil && err == io.EOF && stream.Status().Code() == codes.OK { - // TODO in the current implementation, inTrailer may be handled before inPayload in some cases. - // Fix the order if necessary. - dopts.copts.StatsHandler.HandleRPC(ctx, inPayload) - } - c.trailerMD = stream.Trailer() - return nil -} - -// sendRequest writes out various information of an RPC such as Context and Message. -func sendRequest(ctx context.Context, dopts dialOptions, compressor Compressor, c *callInfo, callHdr *transport.CallHdr, stream *transport.Stream, t transport.ClientTransport, args interface{}, opts *transport.Options) (err error) { - defer func() { - if err != nil { - // If err is connection error, t will be closed, no need to close stream here. - if _, ok := err.(transport.ConnectionError); !ok { - t.CloseStream(stream, err) - } - } - }() - var ( - outPayload *stats.OutPayload - ) - if dopts.copts.StatsHandler != nil { - outPayload = &stats.OutPayload{ - Client: true, - } - } - // Set comp and clear compressor if a registered compressor matches the type - // specified via UseCompressor. (And error if a matching compressor is not - // registered.) - var comp encoding.Compressor - if ct := c.compressorType; ct != "" && ct != encoding.Identity { - compressor = nil // Disable the legacy compressor. - comp = encoding.GetCompressor(ct) - if comp == nil { - return status.Errorf(codes.Internal, "grpc: Compressor is not installed for grpc-encoding %q", ct) - } - } - hdr, data, err := encode(dopts.codec, args, compressor, outPayload, comp) - if err != nil { - return err - } - if c.maxSendMessageSize == nil { - return status.Errorf(codes.Internal, "callInfo maxSendMessageSize field uninitialized(nil)") - } - if len(data) > *c.maxSendMessageSize { - return status.Errorf(codes.ResourceExhausted, "grpc: trying to send message larger than max (%d vs. %d)", len(data), *c.maxSendMessageSize) - } - err = t.Write(stream, hdr, data, opts) - if err == nil && outPayload != nil { - outPayload.SentTime = time.Now() - dopts.copts.StatsHandler.HandleRPC(ctx, outPayload) - } - // t.NewStream(...) could lead to an early rejection of the RPC (e.g., the service/method - // does not exist.) so that t.Write could get io.EOF from wait(...). Leave the following - // recvResponse to get the final status. - if err != nil && err != io.EOF { - return err - } - // Sent successfully. - return nil -} - // Invoke sends the RPC request on the wire and returns after response is // received. This is typically called by generated code. +// +// All errors returned by Invoke are compatible with the status package. func (cc *ClientConn) Invoke(ctx context.Context, method string, args, reply interface{}, opts ...CallOption) error { if cc.dopts.unaryInt != nil { return cc.dopts.unaryInt(ctx, method, args, reply, cc, invoke, opts...) @@ -159,188 +41,34 @@ func Invoke(ctx context.Context, method string, args, reply interface{}, cc *Cli return cc.Invoke(ctx, method, args, reply, opts...) } -func invoke(ctx context.Context, method string, args, reply interface{}, cc *ClientConn, opts ...CallOption) (e error) { - c := defaultCallInfo() - mc := cc.GetMethodConfig(method) - if mc.WaitForReady != nil { - c.failFast = !*mc.WaitForReady - } - - if mc.Timeout != nil && *mc.Timeout >= 0 { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, *mc.Timeout) - defer cancel() - } - - opts = append(cc.dopts.callOptions, opts...) - for _, o := range opts { - if err := o.before(c); err != nil { - return toRPCErr(err) - } - } - defer func() { - for _, o := range opts { - o.after(c) - } - }() - - c.maxSendMessageSize = getMaxSize(mc.MaxReqSize, c.maxSendMessageSize, defaultClientMaxSendMessageSize) - c.maxReceiveMessageSize = getMaxSize(mc.MaxRespSize, c.maxReceiveMessageSize, defaultClientMaxReceiveMessageSize) +var unaryStreamDesc = &StreamDesc{ServerStreams: false, ClientStreams: false} - if EnableTracing { - c.traceInfo.tr = trace.New("grpc.Sent."+methodFamily(method), method) - defer c.traceInfo.tr.Finish() - c.traceInfo.firstLine.client = true - if deadline, ok := ctx.Deadline(); ok { - c.traceInfo.firstLine.deadline = deadline.Sub(time.Now()) - } - c.traceInfo.tr.LazyLog(&c.traceInfo.firstLine, false) - // TODO(dsymonds): Arrange for c.traceInfo.firstLine.remoteAddr to be set. - defer func() { - if e != nil { - c.traceInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{e}}, true) - c.traceInfo.tr.SetError() - } - }() - } - ctx = newContextWithRPCInfo(ctx, c.failFast) - sh := cc.dopts.copts.StatsHandler - if sh != nil { - ctx = sh.TagRPC(ctx, &stats.RPCTagInfo{FullMethodName: method, FailFast: c.failFast}) - begin := &stats.Begin{ - Client: true, - BeginTime: time.Now(), - FailFast: c.failFast, - } - sh.HandleRPC(ctx, begin) - defer func() { - end := &stats.End{ - Client: true, - EndTime: time.Now(), - Error: e, - } - sh.HandleRPC(ctx, end) - }() - } - topts := &transport.Options{ - Last: true, - Delay: false, - } - callHdr := &transport.CallHdr{ - Host: cc.authority, - Method: method, - } - if c.creds != nil { - callHdr.Creds = c.creds - } - if c.compressorType != "" { - callHdr.SendCompress = c.compressorType - } else if cc.dopts.cp != nil { - callHdr.SendCompress = cc.dopts.cp.Type() - } +func invoke(ctx context.Context, method string, req, reply interface{}, cc *ClientConn, opts ...CallOption) error { + // TODO: implement retries in clientStream and make this simply + // newClientStream, SendMsg, RecvMsg. firstAttempt := true - for { - // Check to make sure the context has expired. This will prevent us from - // looping forever if an error occurs for wait-for-ready RPCs where no data - // is sent on the wire. - select { - case <-ctx.Done(): - return toRPCErr(ctx.Err()) - default: - } - - // Record the done handler from Balancer.Get(...). It is called once the - // RPC has completed or failed. - t, done, err := cc.getTransport(ctx, c.failFast) + csInt, err := newClientStream(ctx, unaryStreamDesc, cc, method, opts...) if err != nil { return err } - stream, err := t.NewStream(ctx, callHdr) - if err != nil { - if done != nil { - done(balancer.DoneInfo{Err: err}) - } - // In the event of any error from NewStream, we never attempted to write - // anything to the wire, so we can retry indefinitely for non-fail-fast - // RPCs. - if !c.failFast { + cs := csInt.(*clientStream) + if err := cs.SendMsg(req); err != nil { + if !cs.c.failFast && cs.s.Unprocessed() && firstAttempt { + // TODO: Add a field to header for grpc-transparent-retry-attempts + firstAttempt = false continue } - return toRPCErr(err) - } - if peer, ok := peer.FromContext(stream.Context()); ok { - c.peer = peer - } - if c.traceInfo.tr != nil { - c.traceInfo.tr.LazyLog(&payload{sent: true, msg: args}, true) - } - err = sendRequest(ctx, cc.dopts, cc.dopts.cp, c, callHdr, stream, t, args, topts) - if err != nil { - if done != nil { - done(balancer.DoneInfo{ - Err: err, - BytesSent: true, - BytesReceived: stream.BytesReceived(), - }) - } - // Retry a non-failfast RPC when - // i) the server started to drain before this RPC was initiated. - // ii) the server refused the stream. - if !c.failFast && stream.Unprocessed() { - // In this case, the server did not receive the data, but we still - // created wire traffic, so we should not retry indefinitely. - if firstAttempt { - // TODO: Add a field to header for grpc-transparent-retry-attempts - firstAttempt = false - continue - } - // Otherwise, give up and return an error anyway. - } - return toRPCErr(err) - } - err = recvResponse(ctx, cc.dopts, t, c, stream, reply) - if err != nil { - if done != nil { - done(balancer.DoneInfo{ - Err: err, - BytesSent: true, - BytesReceived: stream.BytesReceived(), - }) - } - if !c.failFast && stream.Unprocessed() { - // In these cases, the server did not receive the data, but we still - // created wire traffic, so we should not retry indefinitely. - if firstAttempt { - // TODO: Add a field to header for grpc-transparent-retry-attempts - firstAttempt = false - continue - } - // Otherwise, give up and return an error anyway. - } - return toRPCErr(err) - } - if c.traceInfo.tr != nil { - c.traceInfo.tr.LazyLog(&payload{sent: false, msg: reply}, true) - } - t.CloseStream(stream, nil) - err = stream.Status().Err() - if done != nil { - done(balancer.DoneInfo{ - Err: err, - BytesSent: true, - BytesReceived: stream.BytesReceived(), - }) + return err } - if !c.failFast && stream.Unprocessed() { - // In these cases, the server did not receive the data, but we still - // created wire traffic, so we should not retry indefinitely. - if firstAttempt { + if err := cs.RecvMsg(reply); err != nil { + if !cs.c.failFast && cs.s.Unprocessed() && firstAttempt { // TODO: Add a field to header for grpc-transparent-retry-attempts firstAttempt = false continue } + return err } - return err + return nil } } diff --git a/vendor/google.golang.org/grpc/clientconn.go b/vendor/google.golang.org/grpc/clientconn.go index bfbef3621..2c22d628d 100644 --- a/vendor/google.golang.org/grpc/clientconn.go +++ b/vendor/google.golang.org/grpc/clientconn.go @@ -32,6 +32,7 @@ import ( "golang.org/x/net/trace" "google.golang.org/grpc/balancer" _ "google.golang.org/grpc/balancer/roundrobin" // To register roundrobin. + "google.golang.org/grpc/codes" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/credentials" "google.golang.org/grpc/grpclog" @@ -40,17 +41,17 @@ import ( _ "google.golang.org/grpc/resolver/dns" // To register dns resolver. _ "google.golang.org/grpc/resolver/passthrough" // To register passthrough resolver. "google.golang.org/grpc/stats" + "google.golang.org/grpc/status" "google.golang.org/grpc/transport" ) var ( // ErrClientConnClosing indicates that the operation is illegal because // the ClientConn is closing. - ErrClientConnClosing = errors.New("grpc: the client connection is closing") - // ErrClientConnTimeout indicates that the ClientConn cannot establish the - // underlying connections within the specified timeout. - // DEPRECATED: Please use context.DeadlineExceeded instead. - ErrClientConnTimeout = errors.New("grpc: timed out when dialing") + // + // Deprecated: this error should not be relied upon by users; use the status + // code of Canceled instead. + ErrClientConnClosing = status.Error(codes.Canceled, "grpc: the client connection is closing") // errConnDrain indicates that the connection starts to be drained and does not accept any new RPCs. errConnDrain = errors.New("grpc: the connection is drained") // errConnClosing indicates that the connection is closing. @@ -85,7 +86,6 @@ var ( type dialOptions struct { unaryInt UnaryClientInterceptor streamInt StreamClientInterceptor - codec Codec cp Compressor dc Decompressor bs backoffStrategy @@ -99,10 +99,8 @@ type dialOptions struct { // balancer, and also by WithBalancerName dial option. balancerBuilder balancer.Builder // This is to support grpclb. - resolverBuilder resolver.Builder - // Custom user options for resolver.Build. - resolverBuildUserOptions interface{} - waitForHandshake bool + resolverBuilder resolver.Builder + waitForHandshake bool } const ( @@ -167,10 +165,10 @@ func WithDefaultCallOptions(cos ...CallOption) DialOption { } // WithCodec returns a DialOption which sets a codec for message marshaling and unmarshaling. +// +// Deprecated: use WithDefaultCallOptions(CallCustomCodec(c)) instead. func WithCodec(c Codec) DialOption { - return func(o *dialOptions) { - o.codec = c - } + return WithDefaultCallOptions(CallCustomCodec(c)) } // WithCompressor returns a DialOption which sets a Compressor to use for @@ -236,14 +234,6 @@ func withResolverBuilder(b resolver.Builder) DialOption { } } -// WithResolverUserOptions returns a DialOption which sets the UserOptions -// field of resolver's BuildOption. -func WithResolverUserOptions(userOpt interface{}) DialOption { - return func(o *dialOptions) { - o.resolverBuildUserOptions = userOpt - } -} - // WithServiceConfig returns a DialOption which has a channel to read the service configuration. // DEPRECATED: service config should be received through name resolver, as specified here. // https://github.com/grpc/grpc/blob/master/doc/service_config.md @@ -407,6 +397,10 @@ func Dial(target string, opts ...DialOption) (*ClientConn, error) { // cancel or expire the pending connection. Once this function returns, the // cancellation and expiration of ctx will be noop. Users should call ClientConn.Close // to terminate all the pending operations after this function returns. +// +// The target name syntax is defined in +// https://github.com/grpc/grpc/blob/master/doc/naming.md. +// e.g. to use dns resolver, a "dns:///" prefix should be applied to the target. func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *ClientConn, err error) { cc := &ClientConn{ target: target, @@ -482,10 +476,6 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * default: } } - // Set defaults. - if cc.dopts.codec == nil { - cc.dopts.codec = protoCodec{} - } if cc.dopts.bs == nil { cc.dopts.bs = DefaultBackoffConfig } @@ -1385,3 +1375,10 @@ func (ac *addrConn) getState() connectivity.State { defer ac.mu.Unlock() return ac.state } + +// ErrClientConnTimeout indicates that the ClientConn cannot establish the +// underlying connections within the specified timeout. +// +// Deprecated: This error is never returned by grpc and should not be +// referenced by users. +var ErrClientConnTimeout = errors.New("grpc: timed out when dialing") diff --git a/vendor/google.golang.org/grpc/clientconn_test.go b/vendor/google.golang.org/grpc/clientconn_test.go index d87daf2b8..4e8e90186 100644 --- a/vendor/google.golang.org/grpc/clientconn_test.go +++ b/vendor/google.golang.org/grpc/clientconn_test.go @@ -599,6 +599,41 @@ func TestNonblockingDialWithEmptyBalancer(t *testing.T) { } } +func TestResolverServiceConfigBeforeAddressNotPanic(t *testing.T) { + defer leakcheck.Check(t) + r, rcleanup := manual.GenerateAndRegisterManualResolver() + defer rcleanup() + + cc, err := Dial(r.Scheme()+":///test.server", WithInsecure()) + if err != nil { + t.Fatalf("failed to dial: %v", err) + } + defer cc.Close() + + // SwitchBalancer before NewAddress. There was no balancer created, this + // makes sure we don't call close on nil balancerWrapper. + r.NewServiceConfig(`{"loadBalancingPolicy": "round_robin"}`) // This should not panic. + + time.Sleep(time.Second) // Sleep to make sure the service config is handled by ClientConn. +} + +func TestResolverEmptyUpdateNotPanic(t *testing.T) { + defer leakcheck.Check(t) + r, rcleanup := manual.GenerateAndRegisterManualResolver() + defer rcleanup() + + cc, err := Dial(r.Scheme()+":///test.server", WithInsecure()) + if err != nil { + t.Fatalf("failed to dial: %v", err) + } + defer cc.Close() + + // This make sure we don't create addrConn with empty address list. + r.NewAddress([]resolver.Address{}) // This should not panic. + + time.Sleep(time.Second) // Sleep to make sure the service config is handled by ClientConn. +} + func TestClientUpdatesParamsAfterGoAway(t *testing.T) { defer leakcheck.Check(t) lis, err := net.Listen("tcp", "localhost:0") diff --git a/vendor/google.golang.org/grpc/codec.go b/vendor/google.golang.org/grpc/codec.go index 43d81ed2a..129776547 100644 --- a/vendor/google.golang.org/grpc/codec.go +++ b/vendor/google.golang.org/grpc/codec.go @@ -19,96 +19,32 @@ package grpc import ( - "math" - "sync" - - "github.com/golang/protobuf/proto" + "google.golang.org/grpc/encoding" + _ "google.golang.org/grpc/encoding/proto" // to register the Codec for "proto" ) +// baseCodec contains the functionality of both Codec and encoding.Codec, but +// omits the name/string, which vary between the two and are not needed for +// anything besides the registry in the encoding package. +type baseCodec interface { + Marshal(v interface{}) ([]byte, error) + Unmarshal(data []byte, v interface{}) error +} + +var _ baseCodec = Codec(nil) +var _ baseCodec = encoding.Codec(nil) + // Codec defines the interface gRPC uses to encode and decode messages. // Note that implementations of this interface must be thread safe; // a Codec's methods can be called from concurrent goroutines. +// +// Deprecated: use encoding.Codec instead. type Codec interface { // Marshal returns the wire format of v. Marshal(v interface{}) ([]byte, error) // Unmarshal parses the wire format into v. Unmarshal(data []byte, v interface{}) error - // String returns the name of the Codec implementation. The returned - // string will be used as part of content type in transmission. + // String returns the name of the Codec implementation. This is unused by + // gRPC. String() string } - -// protoCodec is a Codec implementation with protobuf. It is the default codec for gRPC. -type protoCodec struct { -} - -type cachedProtoBuffer struct { - lastMarshaledSize uint32 - proto.Buffer -} - -func capToMaxInt32(val int) uint32 { - if val > math.MaxInt32 { - return uint32(math.MaxInt32) - } - return uint32(val) -} - -func (p protoCodec) marshal(v interface{}, cb *cachedProtoBuffer) ([]byte, error) { - protoMsg := v.(proto.Message) - newSlice := make([]byte, 0, cb.lastMarshaledSize) - - cb.SetBuf(newSlice) - cb.Reset() - if err := cb.Marshal(protoMsg); err != nil { - return nil, err - } - out := cb.Bytes() - cb.lastMarshaledSize = capToMaxInt32(len(out)) - return out, nil -} - -func (p protoCodec) Marshal(v interface{}) ([]byte, error) { - if pm, ok := v.(proto.Marshaler); ok { - // object can marshal itself, no need for buffer - return pm.Marshal() - } - - cb := protoBufferPool.Get().(*cachedProtoBuffer) - out, err := p.marshal(v, cb) - - // put back buffer and lose the ref to the slice - cb.SetBuf(nil) - protoBufferPool.Put(cb) - return out, err -} - -func (p protoCodec) Unmarshal(data []byte, v interface{}) error { - protoMsg := v.(proto.Message) - protoMsg.Reset() - - if pu, ok := protoMsg.(proto.Unmarshaler); ok { - // object can unmarshal itself, no need for buffer - return pu.Unmarshal(data) - } - - cb := protoBufferPool.Get().(*cachedProtoBuffer) - cb.SetBuf(data) - err := cb.Unmarshal(protoMsg) - cb.SetBuf(nil) - protoBufferPool.Put(cb) - return err -} - -func (protoCodec) String() string { - return "proto" -} - -var protoBufferPool = &sync.Pool{ - New: func() interface{} { - return &cachedProtoBuffer{ - Buffer: proto.Buffer{}, - lastMarshaledSize: 16, - } - }, -} diff --git a/vendor/google.golang.org/grpc/codec_test.go b/vendor/google.golang.org/grpc/codec_test.go index 246b13b08..3fda708ed 100644 --- a/vendor/google.golang.org/grpc/codec_test.go +++ b/vendor/google.golang.org/grpc/codec_test.go @@ -19,110 +19,14 @@ package grpc import ( - "bytes" - "sync" "testing" - "google.golang.org/grpc/test/codec_perf" + "google.golang.org/grpc/encoding" + "google.golang.org/grpc/encoding/proto" ) -func marshalAndUnmarshal(t *testing.T, protoCodec Codec, expectedBody []byte) { - p := &codec_perf.Buffer{} - p.Body = expectedBody - - marshalledBytes, err := protoCodec.Marshal(p) - if err != nil { - t.Errorf("protoCodec.Marshal(_) returned an error") - } - - if err := protoCodec.Unmarshal(marshalledBytes, p); err != nil { - t.Errorf("protoCodec.Unmarshal(_) returned an error") - } - - if bytes.Compare(p.GetBody(), expectedBody) != 0 { - t.Errorf("Unexpected body; got %v; want %v", p.GetBody(), expectedBody) - } -} - -func TestBasicProtoCodecMarshalAndUnmarshal(t *testing.T) { - marshalAndUnmarshal(t, protoCodec{}, []byte{1, 2, 3}) -} - -// Try to catch possible race conditions around use of pools -func TestConcurrentUsage(t *testing.T) { - const ( - numGoRoutines = 100 - numMarshUnmarsh = 1000 - ) - - // small, arbitrary byte slices - protoBodies := [][]byte{ - []byte("one"), - []byte("two"), - []byte("three"), - []byte("four"), - []byte("five"), - } - - var wg sync.WaitGroup - codec := protoCodec{} - - for i := 0; i < numGoRoutines; i++ { - wg.Add(1) - go func() { - defer wg.Done() - for k := 0; k < numMarshUnmarsh; k++ { - marshalAndUnmarshal(t, codec, protoBodies[k%len(protoBodies)]) - } - }() - } - - wg.Wait() -} - -// TestStaggeredMarshalAndUnmarshalUsingSamePool tries to catch potential errors in which slices get -// stomped on during reuse of a proto.Buffer. -func TestStaggeredMarshalAndUnmarshalUsingSamePool(t *testing.T) { - codec1 := protoCodec{} - codec2 := protoCodec{} - - expectedBody1 := []byte{1, 2, 3} - expectedBody2 := []byte{4, 5, 6} - - proto1 := codec_perf.Buffer{Body: expectedBody1} - proto2 := codec_perf.Buffer{Body: expectedBody2} - - var m1, m2 []byte - var err error - - if m1, err = codec1.Marshal(&proto1); err != nil { - t.Errorf("protoCodec.Marshal(%v) failed", proto1) - } - - if m2, err = codec2.Marshal(&proto2); err != nil { - t.Errorf("protoCodec.Marshal(%v) failed", proto2) - } - - if err = codec1.Unmarshal(m1, &proto1); err != nil { - t.Errorf("protoCodec.Unmarshal(%v) failed", m1) - } - - if err = codec2.Unmarshal(m2, &proto2); err != nil { - t.Errorf("protoCodec.Unmarshal(%v) failed", m2) - } - - b1 := proto1.GetBody() - b2 := proto2.GetBody() - - for i, v := range b1 { - if expectedBody1[i] != v { - t.Errorf("expected %v at index %v but got %v", i, expectedBody1[i], v) - } - } - - for i, v := range b2 { - if expectedBody2[i] != v { - t.Errorf("expected %v at index %v but got %v", i, expectedBody2[i], v) - } +func TestGetCodecForProtoIsNotNil(t *testing.T) { + if encoding.GetCodec(proto.Name) == nil { + t.Fatalf("encoding.GetCodec(%q) must not be nil by default", proto.Name) } } diff --git a/vendor/google.golang.org/grpc/codes/codes.go b/vendor/google.golang.org/grpc/codes/codes.go index f3719d562..a8280ae66 100644 --- a/vendor/google.golang.org/grpc/codes/codes.go +++ b/vendor/google.golang.org/grpc/codes/codes.go @@ -19,6 +19,7 @@ // Package codes defines the canonical error codes used by gRPC. It is // consistent across various languages. package codes // import "google.golang.org/grpc/codes" + import ( "fmt" ) @@ -33,9 +34,9 @@ const ( // Canceled indicates the operation was canceled (typically by the caller). Canceled Code = 1 - // Unknown error. An example of where this error may be returned is + // Unknown error. An example of where this error may be returned is // if a Status value received from another address space belongs to - // an error-space that is not known in this address space. Also + // an error-space that is not known in this address space. Also // errors raised by APIs that do not return enough error information // may be converted to this error. Unknown Code = 2 @@ -64,15 +65,11 @@ const ( // PermissionDenied indicates the caller does not have permission to // execute the specified operation. It must not be used for rejections // caused by exhausting some resource (use ResourceExhausted - // instead for those errors). It must not be + // instead for those errors). It must not be // used if the caller cannot be identified (use Unauthenticated // instead for those errors). PermissionDenied Code = 7 - // Unauthenticated indicates the request does not have valid - // authentication credentials for the operation. - Unauthenticated Code = 16 - // ResourceExhausted indicates some resource has been exhausted, perhaps // a per-user quota, or perhaps the entire file system is out of space. ResourceExhausted Code = 8 @@ -88,7 +85,7 @@ const ( // (b) Use Aborted if the client should retry at a higher-level // (e.g., restarting a read-modify-write sequence). // (c) Use FailedPrecondition if the client should not retry until - // the system state has been explicitly fixed. E.g., if an "rmdir" + // the system state has been explicitly fixed. E.g., if an "rmdir" // fails because the directory is non-empty, FailedPrecondition // should be returned since the client should not retry unless // they have first fixed up the directory by deleting files from it. @@ -117,7 +114,7 @@ const ( // file size. // // There is a fair bit of overlap between FailedPrecondition and - // OutOfRange. We recommend using OutOfRange (the more specific + // OutOfRange. We recommend using OutOfRange (the more specific // error) when it applies so that callers who are iterating through // a space can easily look for an OutOfRange error to detect when // they are done. @@ -127,8 +124,8 @@ const ( // supported/enabled in this service. Unimplemented Code = 12 - // Internal errors. Means some invariants expected by underlying - // system has been broken. If you see one of these errors, + // Internal errors. Means some invariants expected by underlying + // system has been broken. If you see one of these errors, // something is very broken. Internal Code = 13 @@ -142,6 +139,10 @@ const ( // DataLoss indicates unrecoverable data loss or corruption. DataLoss Code = 15 + + // Unauthenticated indicates the request does not have valid + // authentication credentials for the operation. + Unauthenticated Code = 16 ) var strToCode = map[string]Code{ diff --git a/vendor/google.golang.org/grpc/credentials/credentials.go b/vendor/google.golang.org/grpc/credentials/credentials.go index 1d2e864f8..3351bf0ee 100644 --- a/vendor/google.golang.org/grpc/credentials/credentials.go +++ b/vendor/google.golang.org/grpc/credentials/credentials.go @@ -43,8 +43,9 @@ type PerRPCCredentials interface { // GetRequestMetadata gets the current request metadata, refreshing // tokens if required. This should be called by the transport layer on // each request, and the data should be populated in headers or other - // context. uri is the URI of the entry point for the request. When - // supported by the underlying implementation, ctx can be used for + // context. If a status code is returned, it will be used as the status + // for the RPC. uri is the URI of the entry point for the request. + // When supported by the underlying implementation, ctx can be used for // timeout and cancellation. // TODO(zhaoq): Define the set of the qualified keys instead of leaving // it as an arbitrary string. diff --git a/vendor/google.golang.org/grpc/encoding/encoding.go b/vendor/google.golang.org/grpc/encoding/encoding.go index 47d10b076..8e26c1943 100644 --- a/vendor/google.golang.org/grpc/encoding/encoding.go +++ b/vendor/google.golang.org/grpc/encoding/encoding.go @@ -16,46 +16,103 @@ * */ -// Package encoding defines the interface for the compressor and the functions -// to register and get the compossor. +// Package encoding defines the interface for the compressor and codec, and +// functions to register and retrieve compressors and codecs. +// // This package is EXPERIMENTAL. package encoding import ( "io" + "strings" ) -var registerCompressor = make(map[string]Compressor) +// Identity specifies the optional encoding for uncompressed streams. +// It is intended for grpc internal use only. +const Identity = "identity" -// Compressor is used for compressing and decompressing when sending or receiving messages. +// Compressor is used for compressing and decompressing when sending or +// receiving messages. type Compressor interface { - // Compress writes the data written to wc to w after compressing it. If an error - // occurs while initializing the compressor, that error is returned instead. + // Compress writes the data written to wc to w after compressing it. If an + // error occurs while initializing the compressor, that error is returned + // instead. Compress(w io.Writer) (io.WriteCloser, error) - // Decompress reads data from r, decompresses it, and provides the uncompressed data - // via the returned io.Reader. If an error occurs while initializing the decompressor, that error - // is returned instead. + // Decompress reads data from r, decompresses it, and provides the + // uncompressed data via the returned io.Reader. If an error occurs while + // initializing the decompressor, that error is returned instead. Decompress(r io.Reader) (io.Reader, error) - // Name is the name of the compression codec and is used to set the content coding header. + // Name is the name of the compression codec and is used to set the content + // coding header. The result must be static; the result cannot change + // between calls. Name() string } -// RegisterCompressor registers the compressor with gRPC by its name. It can be activated when -// sending an RPC via grpc.UseCompressor(). It will be automatically accessed when receiving a -// message based on the content coding header. Servers also use it to send a response with the -// same encoding as the request. +var registeredCompressor = make(map[string]Compressor) + +// RegisterCompressor registers the compressor with gRPC by its name. It can +// be activated when sending an RPC via grpc.UseCompressor(). It will be +// automatically accessed when receiving a message based on the content coding +// header. Servers also use it to send a response with the same encoding as +// the request. // -// NOTE: this function must only be called during initialization time (i.e. in an init() function). If -// multiple Compressors are registered with the same name, the one registered last will take effect. +// NOTE: this function must only be called during initialization time (i.e. in +// an init() function), and is not thread-safe. If multiple Compressors are +// registered with the same name, the one registered last will take effect. func RegisterCompressor(c Compressor) { - registerCompressor[c.Name()] = c + registeredCompressor[c.Name()] = c } // GetCompressor returns Compressor for the given compressor name. func GetCompressor(name string) Compressor { - return registerCompressor[name] + return registeredCompressor[name] } -// Identity specifies the optional encoding for uncompressed streams. -// It is intended for grpc internal use only. -const Identity = "identity" +// Codec defines the interface gRPC uses to encode and decode messages. Note +// that implementations of this interface must be thread safe; a Codec's +// methods can be called from concurrent goroutines. +type Codec interface { + // Marshal returns the wire format of v. + Marshal(v interface{}) ([]byte, error) + // Unmarshal parses the wire format into v. + Unmarshal(data []byte, v interface{}) error + // Name returns the name of the Codec implementation. The returned string + // will be used as part of content type in transmission. The result must be + // static; the result cannot change between calls. + Name() string +} + +var registeredCodecs = make(map[string]Codec, 0) + +// RegisterCodec registers the provided Codec for use with all gRPC clients and +// servers. +// +// The Codec will be stored and looked up by result of its Name() method, which +// should match the content-subtype of the encoding handled by the Codec. This +// is case-insensitive, and is stored and looked up as lowercase. If the +// result of calling Name() is an empty string, RegisterCodec will panic. See +// Content-Type on +// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests for +// more details. +// +// NOTE: this function must only be called during initialization time (i.e. in +// an init() function), and is not thread-safe. If multiple Compressors are +// registered with the same name, the one registered last will take effect. +func RegisterCodec(codec Codec) { + if codec == nil { + panic("cannot register a nil Codec") + } + contentSubtype := strings.ToLower(codec.Name()) + if contentSubtype == "" { + panic("cannot register Codec with empty string result for String()") + } + registeredCodecs[contentSubtype] = codec +} + +// GetCodec gets a registered Codec by content-subtype, or nil if no Codec is +// registered for the content-subtype. +// +// The content-subtype is expected to be lowercase. +func GetCodec(contentSubtype string) Codec { + return registeredCodecs[contentSubtype] +} diff --git a/vendor/google.golang.org/grpc/encoding/gzip/gzip.go b/vendor/google.golang.org/grpc/encoding/gzip/gzip.go index fb4385eb1..c991a6622 100644 --- a/vendor/google.golang.org/grpc/encoding/gzip/gzip.go +++ b/vendor/google.golang.org/grpc/encoding/gzip/gzip.go @@ -30,6 +30,9 @@ import ( "google.golang.org/grpc/encoding" ) +// Name is the name registered for the gzip compressor. +const Name = "gzip" + func init() { c := &compressor{} c.poolCompressor.New = func() interface{} { @@ -84,7 +87,7 @@ func (z *reader) Read(p []byte) (n int, err error) { } func (c *compressor) Name() string { - return "gzip" + return Name } type compressor struct { diff --git a/vendor/google.golang.org/grpc/encoding/proto/proto.go b/vendor/google.golang.org/grpc/encoding/proto/proto.go new file mode 100644 index 000000000..66b97a6f6 --- /dev/null +++ b/vendor/google.golang.org/grpc/encoding/proto/proto.go @@ -0,0 +1,110 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Package proto defines the protobuf codec. Importing this package will +// register the codec. +package proto + +import ( + "math" + "sync" + + "github.com/golang/protobuf/proto" + "google.golang.org/grpc/encoding" +) + +// Name is the name registered for the proto compressor. +const Name = "proto" + +func init() { + encoding.RegisterCodec(codec{}) +} + +// codec is a Codec implementation with protobuf. It is the default codec for gRPC. +type codec struct{} + +type cachedProtoBuffer struct { + lastMarshaledSize uint32 + proto.Buffer +} + +func capToMaxInt32(val int) uint32 { + if val > math.MaxInt32 { + return uint32(math.MaxInt32) + } + return uint32(val) +} + +func marshal(v interface{}, cb *cachedProtoBuffer) ([]byte, error) { + protoMsg := v.(proto.Message) + newSlice := make([]byte, 0, cb.lastMarshaledSize) + + cb.SetBuf(newSlice) + cb.Reset() + if err := cb.Marshal(protoMsg); err != nil { + return nil, err + } + out := cb.Bytes() + cb.lastMarshaledSize = capToMaxInt32(len(out)) + return out, nil +} + +func (codec) Marshal(v interface{}) ([]byte, error) { + if pm, ok := v.(proto.Marshaler); ok { + // object can marshal itself, no need for buffer + return pm.Marshal() + } + + cb := protoBufferPool.Get().(*cachedProtoBuffer) + out, err := marshal(v, cb) + + // put back buffer and lose the ref to the slice + cb.SetBuf(nil) + protoBufferPool.Put(cb) + return out, err +} + +func (codec) Unmarshal(data []byte, v interface{}) error { + protoMsg := v.(proto.Message) + protoMsg.Reset() + + if pu, ok := protoMsg.(proto.Unmarshaler); ok { + // object can unmarshal itself, no need for buffer + return pu.Unmarshal(data) + } + + cb := protoBufferPool.Get().(*cachedProtoBuffer) + cb.SetBuf(data) + err := cb.Unmarshal(protoMsg) + cb.SetBuf(nil) + protoBufferPool.Put(cb) + return err +} + +func (codec) Name() string { + return Name +} + +var protoBufferPool = &sync.Pool{ + New: func() interface{} { + return &cachedProtoBuffer{ + Buffer: proto.Buffer{}, + lastMarshaledSize: 16, + } + }, +} diff --git a/vendor/google.golang.org/grpc/codec_benchmark_test.go b/vendor/google.golang.org/grpc/encoding/proto/proto_benchmark_test.go similarity index 83% rename from vendor/google.golang.org/grpc/codec_benchmark_test.go rename to vendor/google.golang.org/grpc/encoding/proto/proto_benchmark_test.go index 2286fd813..63ea57de2 100644 --- a/vendor/google.golang.org/grpc/codec_benchmark_test.go +++ b/vendor/google.golang.org/grpc/encoding/proto/proto_benchmark_test.go @@ -18,13 +18,14 @@ * */ -package grpc +package proto import ( "fmt" "testing" "github.com/golang/protobuf/proto" + "google.golang.org/grpc/encoding" "google.golang.org/grpc/test/codec_perf" ) @@ -68,7 +69,7 @@ func BenchmarkProtoCodec(b *testing.B) { protoStructs := setupBenchmarkProtoCodecInputs(s) name := fmt.Sprintf("MinPayloadSize:%v/SetParallelism(%v)", s, p) b.Run(name, func(b *testing.B) { - codec := &protoCodec{} + codec := &codec{} b.SetParallelism(p) b.RunParallel(func(pb *testing.PB) { benchmarkProtoCodec(codec, protoStructs, pb, b) @@ -78,7 +79,7 @@ func BenchmarkProtoCodec(b *testing.B) { } } -func benchmarkProtoCodec(codec *protoCodec, protoStructs []proto.Message, pb *testing.PB, b *testing.B) { +func benchmarkProtoCodec(codec *codec, protoStructs []proto.Message, pb *testing.PB, b *testing.B) { counter := 0 for pb.Next() { counter++ @@ -87,13 +88,13 @@ func benchmarkProtoCodec(codec *protoCodec, protoStructs []proto.Message, pb *te } } -func fastMarshalAndUnmarshal(protoCodec Codec, protoStruct proto.Message, b *testing.B) { - marshaledBytes, err := protoCodec.Marshal(protoStruct) +func fastMarshalAndUnmarshal(codec encoding.Codec, protoStruct proto.Message, b *testing.B) { + marshaledBytes, err := codec.Marshal(protoStruct) if err != nil { - b.Errorf("protoCodec.Marshal(_) returned an error") + b.Errorf("codec.Marshal(_) returned an error") } res := codec_perf.Buffer{} - if err := protoCodec.Unmarshal(marshaledBytes, &res); err != nil { - b.Errorf("protoCodec.Unmarshal(_) returned an error") + if err := codec.Unmarshal(marshaledBytes, &res); err != nil { + b.Errorf("codec.Unmarshal(_) returned an error") } } diff --git a/vendor/google.golang.org/grpc/encoding/proto/proto_test.go b/vendor/google.golang.org/grpc/encoding/proto/proto_test.go new file mode 100644 index 000000000..b6a0b6669 --- /dev/null +++ b/vendor/google.golang.org/grpc/encoding/proto/proto_test.go @@ -0,0 +1,129 @@ +/* + * + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package proto + +import ( + "bytes" + "sync" + "testing" + + "google.golang.org/grpc/encoding" + "google.golang.org/grpc/test/codec_perf" +) + +func marshalAndUnmarshal(t *testing.T, codec encoding.Codec, expectedBody []byte) { + p := &codec_perf.Buffer{} + p.Body = expectedBody + + marshalledBytes, err := codec.Marshal(p) + if err != nil { + t.Errorf("codec.Marshal(_) returned an error") + } + + if err := codec.Unmarshal(marshalledBytes, p); err != nil { + t.Errorf("codec.Unmarshal(_) returned an error") + } + + if bytes.Compare(p.GetBody(), expectedBody) != 0 { + t.Errorf("Unexpected body; got %v; want %v", p.GetBody(), expectedBody) + } +} + +func TestBasicProtoCodecMarshalAndUnmarshal(t *testing.T) { + marshalAndUnmarshal(t, codec{}, []byte{1, 2, 3}) +} + +// Try to catch possible race conditions around use of pools +func TestConcurrentUsage(t *testing.T) { + const ( + numGoRoutines = 100 + numMarshUnmarsh = 1000 + ) + + // small, arbitrary byte slices + protoBodies := [][]byte{ + []byte("one"), + []byte("two"), + []byte("three"), + []byte("four"), + []byte("five"), + } + + var wg sync.WaitGroup + codec := codec{} + + for i := 0; i < numGoRoutines; i++ { + wg.Add(1) + go func() { + defer wg.Done() + for k := 0; k < numMarshUnmarsh; k++ { + marshalAndUnmarshal(t, codec, protoBodies[k%len(protoBodies)]) + } + }() + } + + wg.Wait() +} + +// TestStaggeredMarshalAndUnmarshalUsingSamePool tries to catch potential errors in which slices get +// stomped on during reuse of a proto.Buffer. +func TestStaggeredMarshalAndUnmarshalUsingSamePool(t *testing.T) { + codec1 := codec{} + codec2 := codec{} + + expectedBody1 := []byte{1, 2, 3} + expectedBody2 := []byte{4, 5, 6} + + proto1 := codec_perf.Buffer{Body: expectedBody1} + proto2 := codec_perf.Buffer{Body: expectedBody2} + + var m1, m2 []byte + var err error + + if m1, err = codec1.Marshal(&proto1); err != nil { + t.Errorf("codec.Marshal(%v) failed", proto1) + } + + if m2, err = codec2.Marshal(&proto2); err != nil { + t.Errorf("codec.Marshal(%v) failed", proto2) + } + + if err = codec1.Unmarshal(m1, &proto1); err != nil { + t.Errorf("codec.Unmarshal(%v) failed", m1) + } + + if err = codec2.Unmarshal(m2, &proto2); err != nil { + t.Errorf("codec.Unmarshal(%v) failed", m2) + } + + b1 := proto1.GetBody() + b2 := proto2.GetBody() + + for i, v := range b1 { + if expectedBody1[i] != v { + t.Errorf("expected %v at index %v but got %v", i, expectedBody1[i], v) + } + } + + for i, v := range b2 { + if expectedBody2[i] != v { + t.Errorf("expected %v at index %v but got %v", i, expectedBody2[i], v) + } + } +} diff --git a/vendor/google.golang.org/grpc/examples/route_guide/client/client.go b/vendor/google.golang.org/grpc/examples/route_guide/client/client.go index 6fc7a079c..e789fabb9 100644 --- a/vendor/google.golang.org/grpc/examples/route_guide/client/client.go +++ b/vendor/google.golang.org/grpc/examples/route_guide/client/client.go @@ -101,12 +101,12 @@ func runRecordRoute(client pb.RouteGuideClient) { // runRouteChat receives a sequence of route notes, while sending notes for various locations. func runRouteChat(client pb.RouteGuideClient) { notes := []*pb.RouteNote{ - {&pb.Point{Latitude: 0, Longitude: 1}, "First message"}, - {&pb.Point{Latitude: 0, Longitude: 2}, "Second message"}, - {&pb.Point{Latitude: 0, Longitude: 3}, "Third message"}, - {&pb.Point{Latitude: 0, Longitude: 1}, "Fourth message"}, - {&pb.Point{Latitude: 0, Longitude: 2}, "Fifth message"}, - {&pb.Point{Latitude: 0, Longitude: 3}, "Sixth message"}, + {Location: &pb.Point{Latitude: 0, Longitude: 1}, Message: "First message"}, + {Location: &pb.Point{Latitude: 0, Longitude: 2}, Message: "Second message"}, + {Location: &pb.Point{Latitude: 0, Longitude: 3}, Message: "Third message"}, + {Location: &pb.Point{Latitude: 0, Longitude: 1}, Message: "Fourth message"}, + {Location: &pb.Point{Latitude: 0, Longitude: 2}, Message: "Fifth message"}, + {Location: &pb.Point{Latitude: 0, Longitude: 3}, Message: "Sixth message"}, } stream, err := client.RouteChat(context.Background()) if err != nil { diff --git a/vendor/google.golang.org/grpc/go16.go b/vendor/google.golang.org/grpc/go16.go index f3dbf2170..0ae4dbda9 100644 --- a/vendor/google.golang.org/grpc/go16.go +++ b/vendor/google.golang.org/grpc/go16.go @@ -48,6 +48,9 @@ func sendHTTPRequest(ctx context.Context, req *http.Request, conn net.Conn) erro // toRPCErr converts an error into an error from the status package. func toRPCErr(err error) error { + if err == nil || err == io.EOF { + return err + } if _, ok := status.FromError(err); ok { return err } @@ -62,8 +65,6 @@ func toRPCErr(err error) error { return status.Error(codes.DeadlineExceeded, err.Error()) case context.Canceled: return status.Error(codes.Canceled, err.Error()) - case ErrClientConnClosing: - return status.Error(codes.FailedPrecondition, err.Error()) } } return status.Error(codes.Unknown, err.Error()) diff --git a/vendor/google.golang.org/grpc/go17.go b/vendor/google.golang.org/grpc/go17.go index de23098eb..539088280 100644 --- a/vendor/google.golang.org/grpc/go17.go +++ b/vendor/google.golang.org/grpc/go17.go @@ -49,6 +49,9 @@ func sendHTTPRequest(ctx context.Context, req *http.Request, conn net.Conn) erro // toRPCErr converts an error into an error from the status package. func toRPCErr(err error) error { + if err == nil || err == io.EOF { + return err + } if _, ok := status.FromError(err); ok { return err } @@ -63,8 +66,6 @@ func toRPCErr(err error) error { return status.Error(codes.DeadlineExceeded, err.Error()) case context.Canceled, netctx.Canceled: return status.Error(codes.Canceled, err.Error()) - case ErrClientConnClosing: - return status.Error(codes.FailedPrecondition, err.Error()) } } return status.Error(codes.Unknown, err.Error()) diff --git a/vendor/google.golang.org/grpc/interop/test_utils.go b/vendor/google.golang.org/grpc/interop/test_utils.go index 7f288c1b7..c3cd3fc8e 100644 --- a/vendor/google.golang.org/grpc/interop/test_utils.go +++ b/vendor/google.golang.org/grpc/interop/test_utils.go @@ -241,10 +241,8 @@ func DoTimeoutOnSleepingServer(tc testpb.TestServiceClient, args ...grpc.CallOpt ResponseType: testpb.PayloadType_COMPRESSABLE, Payload: pl, } - if err := stream.Send(req); err != nil { - if status.Code(err) != codes.DeadlineExceeded { - grpclog.Fatalf("%v.Send(_) = %v", stream, err) - } + if err := stream.Send(req); err != nil && err != io.EOF { + grpclog.Fatalf("%v.Send(_) = %v", stream, err) } if _, err := stream.Recv(); status.Code(err) != codes.DeadlineExceeded { grpclog.Fatalf("%v.Recv() = _, %v, want error code %d", stream, err, codes.DeadlineExceeded) diff --git a/vendor/google.golang.org/grpc/metadata/metadata.go b/vendor/google.golang.org/grpc/metadata/metadata.go index ccfea5d45..15662b5d8 100644 --- a/vendor/google.golang.org/grpc/metadata/metadata.go +++ b/vendor/google.golang.org/grpc/metadata/metadata.go @@ -17,7 +17,8 @@ */ // Package metadata define the structure of the metadata supported by gRPC library. -// Please refer to https://grpc.io/docs/guides/wire.html for more information about custom-metadata. +// Please refer to https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md +// for more information about custom-metadata. package metadata // import "google.golang.org/grpc/metadata" import ( @@ -115,9 +116,22 @@ func NewIncomingContext(ctx context.Context, md MD) context.Context { return context.WithValue(ctx, mdIncomingKey{}, md) } -// NewOutgoingContext creates a new context with outgoing md attached. +// NewOutgoingContext creates a new context with outgoing md attached. If used +// in conjunction with AppendToOutgoingContext, NewOutgoingContext will +// overwrite any previously-appended metadata. func NewOutgoingContext(ctx context.Context, md MD) context.Context { - return context.WithValue(ctx, mdOutgoingKey{}, md) + return context.WithValue(ctx, mdOutgoingKey{}, rawMD{md: md}) +} + +// AppendToOutgoingContext returns a new context with the provided kv merged +// with any existing metadata in the context. Please refer to the +// documentation of Pairs for a description of kv. +func AppendToOutgoingContext(ctx context.Context, kv ...string) context.Context { + if len(kv)%2 == 1 { + panic(fmt.Sprintf("metadata: AppendToOutgoingContext got an odd number of input pairs for metadata: %d", len(kv))) + } + md, _ := ctx.Value(mdOutgoingKey{}).(rawMD) + return context.WithValue(ctx, mdOutgoingKey{}, rawMD{md: md.md, added: append(md.added, kv)}) } // FromIncomingContext returns the incoming metadata in ctx if it exists. The @@ -128,10 +142,39 @@ func FromIncomingContext(ctx context.Context) (md MD, ok bool) { return } +// FromOutgoingContextRaw returns the un-merged, intermediary contents +// of rawMD. Remember to perform strings.ToLower on the keys. The returned +// MD should not be modified. Writing to it may cause races. Modification +// should be made to copies of the returned MD. +// +// This is intended for gRPC-internal use ONLY. +func FromOutgoingContextRaw(ctx context.Context) (MD, [][]string, bool) { + raw, ok := ctx.Value(mdOutgoingKey{}).(rawMD) + if !ok { + return nil, nil, false + } + + return raw.md, raw.added, true +} + // FromOutgoingContext returns the outgoing metadata in ctx if it exists. The // returned MD should not be modified. Writing to it may cause races. // Modification should be made to the copies of the returned MD. -func FromOutgoingContext(ctx context.Context) (md MD, ok bool) { - md, ok = ctx.Value(mdOutgoingKey{}).(MD) - return +func FromOutgoingContext(ctx context.Context) (MD, bool) { + raw, ok := ctx.Value(mdOutgoingKey{}).(rawMD) + if !ok { + return nil, false + } + + mds := make([]MD, 0, len(raw.added)+1) + mds = append(mds, raw.md) + for _, vv := range raw.added { + mds = append(mds, Pairs(vv...)) + } + return Join(mds...), ok +} + +type rawMD struct { + md MD + added [][]string } diff --git a/vendor/google.golang.org/grpc/metadata/metadata_test.go b/vendor/google.golang.org/grpc/metadata/metadata_test.go index 210cbb267..6edeeda67 100644 --- a/vendor/google.golang.org/grpc/metadata/metadata_test.go +++ b/vendor/google.golang.org/grpc/metadata/metadata_test.go @@ -21,6 +21,8 @@ package metadata import ( "reflect" "testing" + + "golang.org/x/net/context" ) func TestPairsMD(t *testing.T) { @@ -69,3 +71,55 @@ func TestJoin(t *testing.T) { } } } + +func TestAppendToOutgoingContext(t *testing.T) { + // Pre-existing metadata + ctx := NewOutgoingContext(context.Background(), Pairs("k1", "v1", "k2", "v2")) + ctx = AppendToOutgoingContext(ctx, "k1", "v3") + ctx = AppendToOutgoingContext(ctx, "k1", "v4") + md, ok := FromOutgoingContext(ctx) + if !ok { + t.Errorf("Expected MD to exist in ctx, but got none") + } + want := Pairs("k1", "v1", "k1", "v3", "k1", "v4", "k2", "v2") + if !reflect.DeepEqual(md, want) { + t.Errorf("context's metadata is %v, want %v", md, want) + } + + // No existing metadata + ctx = AppendToOutgoingContext(context.Background(), "k1", "v1") + md, ok = FromOutgoingContext(ctx) + if !ok { + t.Errorf("Expected MD to exist in ctx, but got none") + } + want = Pairs("k1", "v1") + if !reflect.DeepEqual(md, want) { + t.Errorf("context's metadata is %v, want %v", md, want) + } +} + +// Old/slow approach to adding metadata to context +func Benchmark_AddingMetadata_ContextManipulationApproach(b *testing.B) { + for n := 0; n < b.N; n++ { + ctx := context.Background() + md, _ := FromOutgoingContext(ctx) + NewOutgoingContext(ctx, Join(Pairs("k1", "v1", "k2", "v2"), md)) + } +} + +// Newer/faster approach to adding metadata to context +func BenchmarkAppendToOutgoingContext(b *testing.B) { + for n := 0; n < b.N; n++ { + AppendToOutgoingContext(context.Background(), "k1", "v1", "k2", "v2") + } +} + +func BenchmarkFromOutgoingContext(b *testing.B) { + ctx := context.Background() + ctx = NewOutgoingContext(ctx, MD{"k3": {"v3", "v4"}}) + ctx = AppendToOutgoingContext(ctx, "k1", "v1", "k2", "v2") + + for n := 0; n < b.N; n++ { + FromOutgoingContext(ctx) + } +} diff --git a/vendor/google.golang.org/grpc/resolver/resolver.go b/vendor/google.golang.org/grpc/resolver/resolver.go index df097eedf..9efcffb3a 100644 --- a/vendor/google.golang.org/grpc/resolver/resolver.go +++ b/vendor/google.golang.org/grpc/resolver/resolver.go @@ -90,9 +90,6 @@ type Address struct { // BuildOption includes additional information for the builder to create // the resolver. type BuildOption struct { - // UserOptions can be used to pass configuration between DialOptions and the - // resolver. - UserOptions interface{} } // ClientConn contains the callbacks for resolver to notify any updates diff --git a/vendor/google.golang.org/grpc/resolver_conn_wrapper.go b/vendor/google.golang.org/grpc/resolver_conn_wrapper.go index ef5d4c286..1a1591e8f 100644 --- a/vendor/google.golang.org/grpc/resolver_conn_wrapper.go +++ b/vendor/google.golang.org/grpc/resolver_conn_wrapper.go @@ -83,9 +83,7 @@ func newCCResolverWrapper(cc *ClientConn) (*ccResolverWrapper, error) { } var err error - ccr.resolver, err = rb.Build(cc.parsedTarget, ccr, resolver.BuildOption{ - UserOptions: cc.dopts.resolverBuildUserOptions, - }) + ccr.resolver, err = rb.Build(cc.parsedTarget, ccr, resolver.BuildOption{}) if err != nil { return nil, err } diff --git a/vendor/google.golang.org/grpc/resolver_test.go b/vendor/google.golang.org/grpc/resolver_test.go deleted file mode 100644 index 6aba13c1d..000000000 --- a/vendor/google.golang.org/grpc/resolver_test.go +++ /dev/null @@ -1,99 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package grpc - -import ( - "fmt" - "strings" - "testing" - "time" - - "google.golang.org/grpc/resolver" - "google.golang.org/grpc/resolver/manual" - "google.golang.org/grpc/test/leakcheck" -) - -func TestResolverServiceConfigBeforeAddressNotPanic(t *testing.T) { - defer leakcheck.Check(t) - r, rcleanup := manual.GenerateAndRegisterManualResolver() - defer rcleanup() - - cc, err := Dial(r.Scheme()+":///test.server", WithInsecure()) - if err != nil { - t.Fatalf("failed to dial: %v", err) - } - defer cc.Close() - - // SwitchBalancer before NewAddress. There was no balancer created, this - // makes sure we don't call close on nil balancerWrapper. - r.NewServiceConfig(`{"loadBalancingPolicy": "round_robin"}`) // This should not panic. - - time.Sleep(time.Second) // Sleep to make sure the service config is handled by ClientConn. -} - -func TestResolverEmptyUpdateNotPanic(t *testing.T) { - defer leakcheck.Check(t) - r, rcleanup := manual.GenerateAndRegisterManualResolver() - defer rcleanup() - - cc, err := Dial(r.Scheme()+":///test.server", WithInsecure()) - if err != nil { - t.Fatalf("failed to dial: %v", err) - } - defer cc.Close() - - // This make sure we don't create addrConn with empty address list. - r.NewAddress([]resolver.Address{}) // This should not panic. - - time.Sleep(time.Second) // Sleep to make sure the service config is handled by ClientConn. -} - -var ( - errTestResolverFailBuild = fmt.Errorf("test resolver build error") -) - -type testResolverFailBuilder struct { - buildOpt resolver.BuildOption -} - -func (r *testResolverFailBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOption) (resolver.Resolver, error) { - r.buildOpt = opts - return nil, errTestResolverFailBuild -} -func (r *testResolverFailBuilder) Scheme() string { - return "testResolverFailBuilderScheme" -} - -// Tests that options in WithResolverUserOptions are passed to resolver.Build(). -func TestResolverUserOptions(t *testing.T) { - r := &testResolverFailBuilder{} - - userOpt := "testUserOpt" - _, err := Dial("scheme:///test.server", WithInsecure(), - withResolverBuilder(r), - WithResolverUserOptions(userOpt), - ) - if err == nil || !strings.Contains(err.Error(), errTestResolverFailBuild.Error()) { - t.Fatalf("Dial with testResolverFailBuilder returns err: %v, want: %v", err, errTestResolverFailBuild) - } - - if r.buildOpt.UserOptions != userOpt { - t.Fatalf("buildOpt.UserOptions = %T %+v, want %v", r.buildOpt.UserOptions, r.buildOpt.UserOptions, userOpt) - } -} diff --git a/vendor/google.golang.org/grpc/rpc_util.go b/vendor/google.golang.org/grpc/rpc_util.go index 1a4c288b2..09245e0d6 100644 --- a/vendor/google.golang.org/grpc/rpc_util.go +++ b/vendor/google.golang.org/grpc/rpc_util.go @@ -25,6 +25,7 @@ import ( "io" "io/ioutil" "math" + "strings" "sync" "time" @@ -32,6 +33,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" "google.golang.org/grpc/encoding" + "google.golang.org/grpc/encoding/proto" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" "google.golang.org/grpc/stats" @@ -125,13 +127,13 @@ func (d *gzipDecompressor) Type() string { type callInfo struct { compressorType string failFast bool - headerMD metadata.MD - trailerMD metadata.MD - peer *peer.Peer + stream *transport.Stream traceInfo traceInfo // in trace.go maxReceiveMessageSize *int maxSendMessageSize *int creds credentials.PerRPCCredentials + contentSubtype string + codec baseCodec } func defaultCallInfo() *callInfo { @@ -172,7 +174,9 @@ func (o afterCall) after(c *callInfo) { o(c) } // for a unary RPC. func Header(md *metadata.MD) CallOption { return afterCall(func(c *callInfo) { - *md = c.headerMD + if c.stream != nil { + *md, _ = c.stream.Header() + } }) } @@ -180,16 +184,20 @@ func Header(md *metadata.MD) CallOption { // for a unary RPC. func Trailer(md *metadata.MD) CallOption { return afterCall(func(c *callInfo) { - *md = c.trailerMD + if c.stream != nil { + *md = c.stream.Trailer() + } }) } // Peer returns a CallOption that retrieves peer information for a // unary RPC. -func Peer(peer *peer.Peer) CallOption { +func Peer(p *peer.Peer) CallOption { return afterCall(func(c *callInfo) { - if c.peer != nil { - *peer = *c.peer + if c.stream != nil { + if x, ok := peer.FromContext(c.stream.Context()); ok { + *p = *x + } } }) } @@ -248,6 +256,49 @@ func UseCompressor(name string) CallOption { }) } +// CallContentSubtype returns a CallOption that will set the content-subtype +// for a call. For example, if content-subtype is "json", the Content-Type over +// the wire will be "application/grpc+json". The content-subtype is converted +// to lowercase before being included in Content-Type. See Content-Type on +// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests for +// more details. +// +// If CallCustomCodec is not also used, the content-subtype will be used to +// look up the Codec to use in the registry controlled by RegisterCodec. See +// the documention on RegisterCodec for details on registration. The lookup +// of content-subtype is case-insensitive. If no such Codec is found, the call +// will result in an error with code codes.Internal. +// +// If CallCustomCodec is also used, that Codec will be used for all request and +// response messages, with the content-subtype set to the given contentSubtype +// here for requests. +func CallContentSubtype(contentSubtype string) CallOption { + contentSubtype = strings.ToLower(contentSubtype) + return beforeCall(func(c *callInfo) error { + c.contentSubtype = contentSubtype + return nil + }) +} + +// CallCustomCodec returns a CallOption that will set the given Codec to be +// used for all request and response messages for a call. The result of calling +// String() will be used as the content-subtype in a case-insensitive manner. +// +// See Content-Type on +// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests for +// more details. Also see the documentation on RegisterCodec and +// CallContentSubtype for more details on the interaction between Codec and +// content-subtype. +// +// This function is provided for advanced users; prefer to use only +// CallContentSubtype to select a registered codec instead. +func CallCustomCodec(codec Codec) CallOption { + return beforeCall(func(c *callInfo) error { + c.codec = codec + return nil + }) +} + // The format of the payload: compressed or not? type payloadFormat uint8 @@ -263,8 +314,8 @@ type parser struct { // error types. r io.Reader - // The header of a gRPC message. Find more detail - // at https://grpc.io/docs/guides/wire.html. + // The header of a gRPC message. Find more detail at + // https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md header [5]byte } @@ -313,7 +364,7 @@ func (p *parser) recvMsg(maxReceiveMessageSize int) (pf payloadFormat, msg []byt // encode serializes msg and returns a buffer of message header and a buffer of msg. // If msg is nil, it generates the message header and an empty msg buffer. // TODO(ddyihai): eliminate extra Compressor parameter. -func encode(c Codec, msg interface{}, cp Compressor, outPayload *stats.OutPayload, compressor encoding.Compressor) ([]byte, []byte, error) { +func encode(c baseCodec, msg interface{}, cp Compressor, outPayload *stats.OutPayload, compressor encoding.Compressor) ([]byte, []byte, error) { var ( b []byte cbuf *bytes.Buffer @@ -390,7 +441,7 @@ func checkRecvPayload(pf payloadFormat, recvCompress string, haveCompressor bool // For the two compressor parameters, both should not be set, but if they are, // dc takes precedence over compressor. // TODO(dfawley): wrap the old compressor/decompressor using the new API? -func recv(p *parser, c Codec, s *transport.Stream, dc Decompressor, m interface{}, maxReceiveMessageSize int, inPayload *stats.InPayload, compressor encoding.Compressor) error { +func recv(p *parser, c baseCodec, s *transport.Stream, dc Decompressor, m interface{}, maxReceiveMessageSize int, inPayload *stats.InPayload, compressor encoding.Compressor) error { pf, d, err := p.recvMsg(maxReceiveMessageSize) if err != nil { return err @@ -485,6 +536,27 @@ func Errorf(c codes.Code, format string, a ...interface{}) error { return status.Errorf(c, format, a...) } +// setCallInfoCodec should only be called after CallOptions have been applied. +func setCallInfoCodec(c *callInfo) error { + if c.codec != nil { + // codec was already set by a CallOption; use it. + return nil + } + + if c.contentSubtype == "" { + // No codec specified in CallOptions; use proto by default. + c.codec = encoding.GetCodec(proto.Name) + return nil + } + + // c.contentSubtype is already lowercased in CallContentSubtype + c.codec = encoding.GetCodec(c.contentSubtype) + if c.codec == nil { + return status.Errorf(codes.Internal, "no codec registered for content-subtype %s", c.contentSubtype) + } + return nil +} + // The SupportPackageIsVersion variables are referenced from generated protocol // buffer files to ensure compatibility with the gRPC version used. The latest // support package version is 5. @@ -500,6 +572,6 @@ const ( ) // Version is the current grpc version. -const Version = "1.9.2" +const Version = "1.10.0" const grpcUA = "grpc-go/" + Version diff --git a/vendor/google.golang.org/grpc/rpc_util_test.go b/vendor/google.golang.org/grpc/rpc_util_test.go index 23c471e2e..6e4f85adc 100644 --- a/vendor/google.golang.org/grpc/rpc_util_test.go +++ b/vendor/google.golang.org/grpc/rpc_util_test.go @@ -27,6 +27,8 @@ import ( "github.com/golang/protobuf/proto" "google.golang.org/grpc/codes" + "google.golang.org/grpc/encoding" + protoenc "google.golang.org/grpc/encoding/proto" "google.golang.org/grpc/status" perfpb "google.golang.org/grpc/test/codec_perf" "google.golang.org/grpc/transport" @@ -110,7 +112,7 @@ func TestEncode(t *testing.T) { }{ {nil, nil, []byte{0, 0, 0, 0, 0}, []byte{}, nil}, } { - hdr, data, err := encode(protoCodec{}, test.msg, nil, nil, nil) + hdr, data, err := encode(encoding.GetCodec(protoenc.Name), test.msg, nil, nil, nil) if err != test.err || !bytes.Equal(hdr, test.hdr) || !bytes.Equal(data, test.data) { t.Fatalf("encode(_, _, %v, _) = %v, %v, %v\nwant %v, %v, %v", test.cp, hdr, data, err, test.hdr, test.data, test.err) } @@ -164,13 +166,14 @@ func TestToRPCErr(t *testing.T) { // bmEncode benchmarks encoding a Protocol Buffer message containing mSize // bytes. func bmEncode(b *testing.B, mSize int) { + cdc := encoding.GetCodec(protoenc.Name) msg := &perfpb.Buffer{Body: make([]byte, mSize)} - encodeHdr, encodeData, _ := encode(protoCodec{}, msg, nil, nil, nil) + encodeHdr, encodeData, _ := encode(cdc, msg, nil, nil, nil) encodedSz := int64(len(encodeHdr) + len(encodeData)) b.ReportAllocs() b.ResetTimer() for i := 0; i < b.N; i++ { - encode(protoCodec{}, msg, nil, nil, nil) + encode(cdc, msg, nil, nil, nil) } b.SetBytes(encodedSz) } diff --git a/vendor/google.golang.org/grpc/server.go b/vendor/google.golang.org/grpc/server.go index f65162168..0f7ff5d60 100644 --- a/vendor/google.golang.org/grpc/server.go +++ b/vendor/google.golang.org/grpc/server.go @@ -40,6 +40,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" "google.golang.org/grpc/encoding" + "google.golang.org/grpc/encoding/proto" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal" "google.golang.org/grpc/keepalive" @@ -105,7 +106,7 @@ type Server struct { type options struct { creds credentials.TransportCredentials - codec Codec + codec baseCodec cp Compressor dc Decompressor unaryInt UnaryServerInterceptor @@ -182,6 +183,8 @@ func KeepaliveEnforcementPolicy(kep keepalive.EnforcementPolicy) ServerOption { } // CustomCodec returns a ServerOption that sets a codec for message marshaling and unmarshaling. +// +// This will override any lookups by content-subtype for Codecs registered with RegisterCodec. func CustomCodec(codec Codec) ServerOption { return func(o *options) { o.codec = codec @@ -327,10 +330,6 @@ func NewServer(opt ...ServerOption) *Server { for _, o := range opt { o(&opts) } - if opts.codec == nil { - // Set the default codec. - opts.codec = protoCodec{} - } s := &Server{ lis: make(map[net.Listener]bool), opts: opts, @@ -695,7 +694,7 @@ func (s *Server) serveUsingHandler(conn net.Conn) { // available through grpc-go's HTTP/2 server, and it is currently EXPERIMENTAL // and subject to change. func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { - st, err := transport.NewServerHandlerTransport(w, r) + st, err := transport.NewServerHandlerTransport(w, r, s.opts.statsHandler) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return @@ -759,7 +758,7 @@ func (s *Server) sendResponse(t transport.ServerTransport, stream *transport.Str if s.opts.statsHandler != nil { outPayload = &stats.OutPayload{} } - hdr, data, err := encode(s.opts.codec, msg, cp, outPayload, comp) + hdr, data, err := encode(s.getCodec(stream.ContentSubtype()), msg, cp, outPayload, comp) if err != nil { grpclog.Errorln("grpc: server failed to encode response: ", err) return err @@ -904,7 +903,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. // java implementation. return status.Errorf(codes.ResourceExhausted, "grpc: received message larger than max (%d vs. %d)", len(req), s.opts.maxReceiveMessageSize) } - if err := s.opts.codec.Unmarshal(req, v); err != nil { + if err := s.getCodec(stream.ContentSubtype()).Unmarshal(req, v); err != nil { return status.Errorf(codes.Internal, "grpc: error unmarshalling request: %v", err) } if inPayload != nil { @@ -996,7 +995,7 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp t: t, s: stream, p: &parser{r: stream}, - codec: s.opts.codec, + codec: s.getCodec(stream.ContentSubtype()), maxReceiveMessageSize: s.opts.maxReceiveMessageSize, maxSendMessageSize: s.opts.maxSendMessageSize, trInfo: trInfo, @@ -1262,6 +1261,22 @@ func init() { } } +// contentSubtype must be lowercase +// cannot return nil +func (s *Server) getCodec(contentSubtype string) baseCodec { + if s.opts.codec != nil { + return s.opts.codec + } + if contentSubtype == "" { + return encoding.GetCodec(proto.Name) + } + codec := encoding.GetCodec(contentSubtype) + if codec == nil { + return encoding.GetCodec(proto.Name) + } + return codec +} + // SetHeader sets the header metadata. // When called multiple times, all the provided metadata will be merged. // All the metadata will be sent out when one of the following happens: diff --git a/vendor/google.golang.org/grpc/stats/stats_test.go b/vendor/google.golang.org/grpc/stats/stats_test.go index fef0d7c65..b6c7b998c 100644 --- a/vendor/google.golang.org/grpc/stats/stats_test.go +++ b/vendor/google.golang.org/grpc/stats/stats_test.go @@ -256,11 +256,10 @@ const ( ) type rpcConfig struct { - count int // Number of requests and responses for streaming RPCs. - success bool // Whether the RPC should succeed or return error. - failfast bool - callType rpcType // Type of RPC. - noLastRecv bool // Whether to call recv for io.EOF. When true, last recv won't be called. Only valid for streaming RPCs. + count int // Number of requests and responses for streaming RPCs. + success bool // Whether the RPC should succeed or return error. + failfast bool + callType rpcType // Type of RPC. } func (te *test) doUnaryCall(c *rpcConfig) (*testpb.SimpleRequest, *testpb.SimpleResponse, error) { @@ -313,14 +312,8 @@ func (te *test) doFullDuplexCallRoundtrip(c *rpcConfig) ([]*testpb.SimpleRequest if err = stream.CloseSend(); err != nil && err != io.EOF { return reqs, resps, err } - if !c.noLastRecv { - if _, err = stream.Recv(); err != io.EOF { - return reqs, resps, err - } - } else { - // In the case of not calling the last recv, sleep to avoid - // returning too fast to miss the remaining stats (InTrailer and End). - time.Sleep(time.Second) + if _, err = stream.Recv(); err != io.EOF { + return reqs, resps, err } return reqs, resps, nil @@ -651,7 +644,7 @@ func checkEnd(t *testing.T, d *gotData, e *expectedData) { actual, ok := status.FromError(st.Error) if !ok { - t.Fatalf("expected st.Error to be a statusError, got %T", st.Error) + t.Fatalf("expected st.Error to be a statusError, got %v (type %T)", st.Error, st.Error) } expectedStatus, _ := status.FromError(e.err) @@ -1222,20 +1215,6 @@ func TestClientStatsFullDuplexRPCError(t *testing.T) { }) } -// If the user doesn't call the last recv() on clientStream. -func TestClientStatsFullDuplexRPCNotCallingLastRecv(t *testing.T) { - count := 1 - testClientStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: true, failfast: false, callType: fullDuplexStreamRPC, noLastRecv: true}, map[int]*checkFuncWithCount{ - begin: {checkBegin, 1}, - outHeader: {checkOutHeader, 1}, - outPayload: {checkOutPayload, count}, - inHeader: {checkInHeader, 1}, - inPayload: {checkInPayload, count}, - inTrailer: {checkInTrailer, 1}, - end: {checkEnd, 1}, - }) -} - func TestTags(t *testing.T) { b := []byte{5, 2, 4, 3, 1} ctx := stats.SetTags(context.Background(), b) diff --git a/vendor/google.golang.org/grpc/status/status.go b/vendor/google.golang.org/grpc/status/status.go index d9defaebc..3a42dc6de 100644 --- a/vendor/google.golang.org/grpc/status/status.go +++ b/vendor/google.golang.org/grpc/status/status.go @@ -120,7 +120,8 @@ func FromProto(s *spb.Status) *Status { } // FromError returns a Status representing err if it was produced from this -// package, otherwise it returns nil, false. +// package. Otherwise, ok is false and a Status is returned with codes.Unknown +// and the original error message. func FromError(err error) (s *Status, ok bool) { if err == nil { return &Status{s: &spb.Status{Code: int32(codes.OK)}}, true @@ -128,7 +129,14 @@ func FromError(err error) (s *Status, ok bool) { if se, ok := err.(*statusError); ok { return se.status(), true } - return nil, false + return New(codes.Unknown, err.Error()), false +} + +// Convert is a convenience function which removes the need to handle the +// boolean return value from FromError. +func Convert(err error) *Status { + s, _ := FromError(err) + return s } // WithDetails returns a new status with the provided details messages appended to the status. diff --git a/vendor/google.golang.org/grpc/status/status_test.go b/vendor/google.golang.org/grpc/status/status_test.go index 69be8c9f6..8b74c27d6 100644 --- a/vendor/google.golang.org/grpc/status/status_test.go +++ b/vendor/google.golang.org/grpc/status/status_test.go @@ -119,6 +119,33 @@ func TestFromErrorOK(t *testing.T) { } } +func TestFromErrorUnknownError(t *testing.T) { + code, message := codes.Unknown, "unknown error" + err := errors.New("unknown error") + s, ok := FromError(err) + if ok || s.Code() != code || s.Message() != message { + t.Fatalf("FromError(%v) = %v, %v; want , false", err, s, ok, code, message) + } +} + +func TestConvertKnownError(t *testing.T) { + code, message := codes.Internal, "test description" + err := Error(code, message) + s := Convert(err) + if s.Code() != code || s.Message() != message { + t.Fatalf("Convert(%v) = %v; want ", err, s, code, message) + } +} + +func TestConvertUnknownError(t *testing.T) { + code, message := codes.Unknown, "unknown error" + err := errors.New("unknown error") + s := Convert(err) + if s.Code() != code || s.Message() != message { + t.Fatalf("Convert(%v) = %v; want ", err, s, code, message) + } +} + func TestStatus_ErrorDetails(t *testing.T) { tests := []struct { code codes.Code diff --git a/vendor/google.golang.org/grpc/stream.go b/vendor/google.golang.org/grpc/stream.go index f91381995..deb735927 100644 --- a/vendor/google.golang.org/grpc/stream.go +++ b/vendor/google.golang.org/grpc/stream.go @@ -30,7 +30,6 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/encoding" "google.golang.org/grpc/metadata" - "google.golang.org/grpc/peer" "google.golang.org/grpc/stats" "google.golang.org/grpc/status" "google.golang.org/grpc/transport" @@ -51,6 +50,8 @@ type StreamDesc struct { } // Stream defines the common interface a client or server stream has to satisfy. +// +// All errors returned from Stream are compatible with the status package. type Stream interface { // Context returns the context for this stream. Context() context.Context @@ -89,8 +90,9 @@ type ClientStream interface { // Stream.SendMsg() may return a non-nil error when something wrong happens sending // the request. The returned error indicates the status of this sending, not the final // status of the RPC. - // Always call Stream.RecvMsg() to get the final status if you care about the status of - // the RPC. + // + // Always call Stream.RecvMsg() to drain the stream and get the final + // status, otherwise there could be leaked resources. Stream } @@ -112,26 +114,28 @@ func NewClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth } func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (_ ClientStream, err error) { - var ( - t transport.ClientTransport - s *transport.Stream - done func(balancer.DoneInfo) - cancel context.CancelFunc - ) c := defaultCallInfo() mc := cc.GetMethodConfig(method) if mc.WaitForReady != nil { c.failFast = !*mc.WaitForReady } + // Possible context leak: + // The cancel function for the child context we create will only be called + // when RecvMsg returns a non-nil error, if the ClientConn is closed, or if + // an error is generated by SendMsg. + // https://github.com/grpc/grpc-go/issues/1818. + var cancel context.CancelFunc if mc.Timeout != nil && *mc.Timeout >= 0 { ctx, cancel = context.WithTimeout(ctx, *mc.Timeout) - defer func() { - if err != nil { - cancel() - } - }() + } else { + ctx, cancel = context.WithCancel(ctx) } + defer func() { + if err != nil { + cancel() + } + }() opts = append(cc.dopts.callOptions, opts...) for _, o := range opts { @@ -141,6 +145,9 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth } c.maxSendMessageSize = getMaxSize(mc.MaxReqSize, c.maxSendMessageSize, defaultClientMaxSendMessageSize) c.maxReceiveMessageSize = getMaxSize(mc.MaxRespSize, c.maxReceiveMessageSize, defaultClientMaxReceiveMessageSize) + if err := setCallInfoCodec(c); err != nil { + return nil, err + } callHdr := &transport.CallHdr{ Host: cc.authority, @@ -149,7 +156,8 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth // so we don't flush the header. // If it's client streaming, the user may never send a request or send it any // time soon, so we ask the transport to flush the header. - Flush: desc.ClientStreams, + Flush: desc.ClientStreams, + ContentSubtype: c.contentSubtype, } // Set our outgoing compression according to the UseCompressor CallOption, if @@ -214,6 +222,11 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth }() } + var ( + t transport.ClientTransport + s *transport.Stream + done func(balancer.DoneInfo) + ) for { // Check to make sure the context has expired. This will prevent us from // looping forever if an error occurs for wait-for-ready RPCs where no data @@ -232,14 +245,7 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth s, err = t.NewStream(ctx, callHdr) if err != nil { if done != nil { - doneInfo := balancer.DoneInfo{Err: err} - if _, ok := err.(transport.ConnectionError); ok { - // If error is connection error, transport was sending data on wire, - // and we are not sure if anything has been sent on wire. - // If error is not connection error, we are sure nothing has been sent. - doneInfo.BytesSent = true - } - done(doneInfo) + done(balancer.DoneInfo{Err: err}) done = nil } // In the event of any error from NewStream, we never attempted to write @@ -253,15 +259,12 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth break } - // Set callInfo.peer object from stream's context. - if peer, ok := peer.FromContext(s.Context()); ok { - c.peer = peer - } + c.stream = s cs := &clientStream{ opts: opts, c: c, desc: desc, - codec: cc.dopts.codec, + codec: c.codec, cp: cp, dc: cc.dopts.dc, comp: comp, @@ -278,29 +281,21 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth statsCtx: ctx, statsHandler: cc.dopts.copts.StatsHandler, } - // Listen on s.Context().Done() to detect cancellation and s.Done() to detect - // normal termination when there is no pending I/O operations on this stream. - go func() { - select { - case <-t.Error(): - // Incur transport error, simply exit. - case <-cc.ctx.Done(): - cs.finish(ErrClientConnClosing) - cs.closeTransportStream(ErrClientConnClosing) - case <-s.Done(): - // TODO: The trace of the RPC is terminated here when there is no pending - // I/O, which is probably not the optimal solution. - cs.finish(s.Status().Err()) - cs.closeTransportStream(nil) - case <-s.GoAway(): - cs.finish(errConnDrain) - cs.closeTransportStream(errConnDrain) - case <-s.Context().Done(): - err := s.Context().Err() - cs.finish(err) - cs.closeTransportStream(transport.ContextErr(err)) - } - }() + if desc != unaryStreamDesc { + // Listen on cc and stream contexts to cleanup when the user closes the + // ClientConn or cancels the stream context. In all other cases, an error + // should already be injected into the recv buffer by the transport, which + // the client will eventually receive, and then we will cancel the stream's + // context in clientStream.finish. + go func() { + select { + case <-cc.ctx.Done(): + cs.finish(ErrClientConnClosing) + case <-ctx.Done(): + cs.finish(toRPCErr(s.Context().Err())) + } + }() + } return cs, nil } @@ -313,20 +308,22 @@ type clientStream struct { p *parser desc *StreamDesc - codec Codec + codec baseCodec cp Compressor dc Decompressor comp encoding.Compressor decomp encoding.Compressor decompSet bool + // cancel is only called when RecvMsg() returns non-nil error, which means + // the stream finishes with error or with io.EOF. cancel context.CancelFunc tracing bool // set to EnableTracing when the clientStream is created. mu sync.Mutex done func(balancer.DoneInfo) - closed bool + sentLast bool // sent an end stream finished bool // trInfo.tr is set when the clientStream is created (if EnableTracing is true), // and is set to nil when the clientStream's finish method is called. @@ -346,9 +343,8 @@ func (cs *clientStream) Context() context.Context { func (cs *clientStream) Header() (metadata.MD, error) { m, err := cs.s.Header() if err != nil { - if _, ok := err.(transport.ConnectionError); !ok { - cs.closeTransportStream(err) - } + err = toRPCErr(err) + cs.finish(err) } return m, err } @@ -358,6 +354,7 @@ func (cs *clientStream) Trailer() metadata.MD { } func (cs *clientStream) SendMsg(m interface{}) (err error) { + // TODO: Check cs.sentLast and error if we already ended the stream. if cs.tracing { cs.mu.Lock() if cs.trInfo.tr != nil { @@ -368,26 +365,18 @@ func (cs *clientStream) SendMsg(m interface{}) (err error) { // TODO Investigate how to signal the stats handling party. // generate error stats if err != nil && err != io.EOF? defer func() { - if err != nil { - cs.finish(err) - } - if err == nil { - return - } - if err == io.EOF { - // Specialize the process for server streaming. SendMsg is only called - // once when creating the stream object. io.EOF needs to be skipped when - // the rpc is early finished (before the stream object is created.). - // TODO: It is probably better to move this into the generated code. - if !cs.desc.ClientStreams && cs.desc.ServerStreams { - err = nil - } - return + // For non-client-streaming RPCs, we return nil instead of EOF on success + // because the generated code requires it. finish is not called; RecvMsg() + // will call it with the stream's status independently. + if err == io.EOF && !cs.desc.ClientStreams { + err = nil } - if _, ok := err.(transport.ConnectionError); !ok { - cs.closeTransportStream(err) + if err != nil && err != io.EOF { + // Call finish for errors generated by this SendMsg call. (Transport + // errors are converted to an io.EOF error below; the real error will be + // returned from RecvMsg eventually in that case.) + cs.finish(err) } - err = toRPCErr(err) }() var outPayload *stats.OutPayload if cs.statsHandler != nil { @@ -399,30 +388,36 @@ func (cs *clientStream) SendMsg(m interface{}) (err error) { if err != nil { return err } - if cs.c.maxSendMessageSize == nil { - return status.Errorf(codes.Internal, "callInfo maxSendMessageSize field uninitialized(nil)") - } if len(data) > *cs.c.maxSendMessageSize { return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", len(data), *cs.c.maxSendMessageSize) } - err = cs.t.Write(cs.s, hdr, data, &transport.Options{Last: false}) - if err == nil && outPayload != nil { - outPayload.SentTime = time.Now() - cs.statsHandler.HandleRPC(cs.statsCtx, outPayload) + if !cs.desc.ClientStreams { + cs.sentLast = true } - return err + err = cs.t.Write(cs.s, hdr, data, &transport.Options{Last: !cs.desc.ClientStreams}) + if err == nil { + if outPayload != nil { + outPayload.SentTime = time.Now() + cs.statsHandler.HandleRPC(cs.statsCtx, outPayload) + } + return nil + } + return io.EOF } func (cs *clientStream) RecvMsg(m interface{}) (err error) { + defer func() { + if err != nil || !cs.desc.ServerStreams { + // err != nil or non-server-streaming indicates end of stream. + cs.finish(err) + } + }() var inPayload *stats.InPayload if cs.statsHandler != nil { inPayload = &stats.InPayload{ Client: true, } } - if cs.c.maxReceiveMessageSize == nil { - return status.Errorf(codes.Internal, "callInfo maxReceiveMessageSize field uninitialized(nil)") - } if !cs.decompSet { // Block until we receive headers containing received message encoding. if ct := cs.s.RecvCompress(); ct != "" && ct != encoding.Identity { @@ -440,98 +435,67 @@ func (cs *clientStream) RecvMsg(m interface{}) (err error) { cs.decompSet = true } err = recv(cs.p, cs.codec, cs.s, cs.dc, m, *cs.c.maxReceiveMessageSize, inPayload, cs.decomp) - defer func() { - // err != nil indicates the termination of the stream. - if err != nil { - cs.finish(err) - } - }() - if err == nil { - if cs.tracing { - cs.mu.Lock() - if cs.trInfo.tr != nil { - cs.trInfo.tr.LazyLog(&payload{sent: false, msg: m}, true) - } - cs.mu.Unlock() - } - if inPayload != nil { - cs.statsHandler.HandleRPC(cs.statsCtx, inPayload) - } - if !cs.desc.ClientStreams || cs.desc.ServerStreams { - return - } - // Special handling for client streaming rpc. - // This recv expects EOF or errors, so we don't collect inPayload. - if cs.c.maxReceiveMessageSize == nil { - return status.Errorf(codes.Internal, "callInfo maxReceiveMessageSize field uninitialized(nil)") - } - err = recv(cs.p, cs.codec, cs.s, cs.dc, m, *cs.c.maxReceiveMessageSize, nil, cs.decomp) - cs.closeTransportStream(err) - if err == nil { - return toRPCErr(errors.New("grpc: client streaming protocol violation: get , want ")) - } + if err != nil { if err == io.EOF { - if se := cs.s.Status().Err(); se != nil { - return se + if statusErr := cs.s.Status().Err(); statusErr != nil { + return statusErr } - cs.finish(err) - return nil + return io.EOF // indicates successful end of stream. } return toRPCErr(err) } - if _, ok := err.(transport.ConnectionError); !ok { - cs.closeTransportStream(err) - } - if err == io.EOF { - if statusErr := cs.s.Status().Err(); statusErr != nil { - return statusErr + if cs.tracing { + cs.mu.Lock() + if cs.trInfo.tr != nil { + cs.trInfo.tr.LazyLog(&payload{sent: false, msg: m}, true) } - // Returns io.EOF to indicate the end of the stream. - return + cs.mu.Unlock() } - return toRPCErr(err) -} - -func (cs *clientStream) CloseSend() (err error) { - err = cs.t.Write(cs.s, nil, nil, &transport.Options{Last: true}) - defer func() { - if err != nil { - cs.finish(err) - } - }() - if err == nil || err == io.EOF { + if inPayload != nil { + cs.statsHandler.HandleRPC(cs.statsCtx, inPayload) + } + if cs.desc.ServerStreams { + // Subsequent messages should be received by subsequent RecvMsg calls. return nil } - if _, ok := err.(transport.ConnectionError); !ok { - cs.closeTransportStream(err) + + // Special handling for non-server-stream rpcs. + // This recv expects EOF or errors, so we don't collect inPayload. + err = recv(cs.p, cs.codec, cs.s, cs.dc, m, *cs.c.maxReceiveMessageSize, nil, cs.decomp) + if err == nil { + return toRPCErr(errors.New("grpc: client streaming protocol violation: get , want ")) + } + if err == io.EOF { + return cs.s.Status().Err() // non-server streaming Recv returns nil on success } - err = toRPCErr(err) - return + return toRPCErr(err) } -func (cs *clientStream) closeTransportStream(err error) { - cs.mu.Lock() - if cs.closed { - cs.mu.Unlock() - return +func (cs *clientStream) CloseSend() error { + if cs.sentLast { + return nil } - cs.closed = true - cs.mu.Unlock() - cs.t.CloseStream(cs.s, err) + cs.sentLast = true + cs.t.Write(cs.s, nil, nil, &transport.Options{Last: true}) + // We ignore errors from Write and always return nil here. Any error it + // would return would also be returned by a subsequent RecvMsg call, and the + // user is supposed to always finish the stream by calling RecvMsg until it + // returns err != nil. + return nil } func (cs *clientStream) finish(err error) { + if err == io.EOF { + // Ending a stream with EOF indicates a success. + err = nil + } cs.mu.Lock() defer cs.mu.Unlock() if cs.finished { return } cs.finished = true - defer func() { - if cs.cancel != nil { - cs.cancel() - } - }() + cs.t.CloseStream(cs.s, err) for _, o := range cs.opts { o.after(cs.c) } @@ -547,18 +511,16 @@ func (cs *clientStream) finish(err error) { end := &stats.End{ Client: true, EndTime: time.Now(), - } - if err != io.EOF { - // end.Error is nil if the RPC finished successfully. - end.Error = toRPCErr(err) + Error: err, } cs.statsHandler.HandleRPC(cs.statsCtx, end) } + cs.cancel() if !cs.tracing { return } if cs.trInfo.tr != nil { - if err == nil || err == io.EOF { + if err == nil { cs.trInfo.tr.LazyPrintf("RPC: [OK]") } else { cs.trInfo.tr.LazyPrintf("RPC: [%v]", err) @@ -593,7 +555,7 @@ type serverStream struct { t transport.ServerTransport s *transport.Stream p *parser - codec Codec + codec baseCodec cp Compressor dc Decompressor diff --git a/vendor/google.golang.org/grpc/test/end2end_test.go b/vendor/google.golang.org/grpc/test/end2end_test.go index 140673efd..6a5831821 100644 --- a/vendor/google.golang.org/grpc/test/end2end_test.go +++ b/vendor/google.golang.org/grpc/test/end2end_test.go @@ -705,7 +705,7 @@ func (te *test) clientConn() *grpc.ClientConn { opts = append(opts, grpc.WithPerRPCCredentials(te.perRPCCreds)) } if te.customCodec != nil { - opts = append(opts, grpc.WithCodec(te.customCodec)) + opts = append(opts, grpc.WithDefaultCallOptions(grpc.CallCustomCodec(te.customCodec))) } if !te.nonBlockingDial && te.srvAddr != "" { // Only do a blocking dial if server is up. @@ -925,7 +925,7 @@ func testServerGoAwayPendingRPC(t *testing.T, e env) { cc := te.clientConn() tc := testpb.NewTestServiceClient(cc) - ctx, cancel := context.WithCancel(context.Background()) + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) stream, err := tc.FullDuplexCall(ctx, grpc.FailFast(false)) if err != nil { t.Fatalf("%v.FullDuplexCall(_) = _, %v, want ", tc, err) @@ -1164,10 +1164,22 @@ func testConcurrentServerStopAndGoAway(t *testing.T, e env) { ResponseParameters: respParam, Payload: payload, } - if err := stream.Send(req); err == nil { - if _, err := stream.Recv(); err == nil { - t.Fatalf("%v.Recv() = _, %v, want _, ", stream, err) + sendStart := time.Now() + for { + if err := stream.Send(req); err == io.EOF { + // stream.Send should eventually send io.EOF + break + } else if err != nil { + // Send should never return a transport-level error. + t.Fatalf("stream.Send(%v) = %v; want ", req, err) } + if time.Since(sendStart) > 2*time.Second { + t.Fatalf("stream.Send(_) did not return io.EOF after 2s") + } + time.Sleep(time.Millisecond) + } + if _, err := stream.Recv(); err == nil || err == io.EOF { + t.Fatalf("%v.Recv() = _, %v, want _, ", stream, err) } <-ch awaitNewConnLogOutput() @@ -1190,7 +1202,9 @@ func testClientConnCloseAfterGoAwayWithActiveStream(t *testing.T, e env) { cc := te.clientConn() tc := testpb.NewTestServiceClient(cc) - if _, err := tc.FullDuplexCall(context.Background()); err != nil { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + if _, err := tc.FullDuplexCall(ctx); err != nil { t.Fatalf("%v.FullDuplexCall(_) = _, %v, want _, ", tc, err) } done := make(chan struct{}) @@ -1808,6 +1822,80 @@ func TestServiceConfigMaxMsgSize(t *testing.T) { } } +// Reading from a streaming RPC may fail with context canceled if timeout was +// set by service config (https://github.com/grpc/grpc-go/issues/1818). This +// test makes sure read from streaming RPC doesn't fail in this case. +func TestStreamingRPCWithTimeoutInServiceConfigRecv(t *testing.T) { + te := testServiceConfigSetup(t, tcpClearRREnv) + te.startServer(&testServer{security: tcpClearRREnv.security}) + defer te.tearDown() + r, rcleanup := manual.GenerateAndRegisterManualResolver() + defer rcleanup() + + te.resolverScheme = r.Scheme() + te.nonBlockingDial = true + fmt.Println("1") + cc := te.clientConn() + fmt.Println("10") + tc := testpb.NewTestServiceClient(cc) + + r.NewAddress([]resolver.Address{{Addr: te.srvAddr}}) + r.NewServiceConfig(`{ + "methodConfig": [ + { + "name": [ + { + "service": "grpc.testing.TestService", + "method": "FullDuplexCall" + } + ], + "waitForReady": true, + "timeout": "10s" + } + ] + }`) + // Make sure service config has been processed by grpc. + for { + if cc.GetMethodConfig("/grpc.testing.TestService/FullDuplexCall").Timeout != nil { + break + } + time.Sleep(time.Millisecond) + } + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + stream, err := tc.FullDuplexCall(ctx, grpc.FailFast(false)) + if err != nil { + t.Fatalf("TestService/FullDuplexCall(_) = _, %v, want ", err) + } + + payload, err := newPayload(testpb.PayloadType_COMPRESSABLE, 0) + if err != nil { + t.Fatalf("failed to newPayload: %v", err) + } + req := &testpb.StreamingOutputCallRequest{ + ResponseType: testpb.PayloadType_COMPRESSABLE, + ResponseParameters: []*testpb.ResponseParameters{{Size: 0}}, + Payload: payload, + } + if err := stream.Send(req); err != nil { + t.Fatalf("stream.Send(%v) = %v, want ", req, err) + } + stream.CloseSend() + time.Sleep(time.Second) + // Sleep 1 second before recv to make sure the final status is received + // before the recv. + if _, err := stream.Recv(); err != nil { + t.Fatalf("stream.Recv = _, %v, want _, ", err) + } + // Keep reading to drain the stream. + for { + if _, err := stream.Recv(); err != nil { + break + } + } +} + func TestMaxMsgSizeClientDefault(t *testing.T) { defer leakcheck.Check(t) for _, e := range listTestEnv() { @@ -2260,24 +2348,6 @@ func testHealthCheckServingStatus(t *testing.T, e env) { } -func TestErrorChanNoIO(t *testing.T) { - defer leakcheck.Check(t) - for _, e := range listTestEnv() { - testErrorChanNoIO(t, e) - } -} - -func testErrorChanNoIO(t *testing.T, e env) { - te := newTest(t, e) - te.startServer(&testServer{security: e.security}) - defer te.tearDown() - - tc := testpb.NewTestServiceClient(te.clientConn()) - if _, err := tc.FullDuplexCall(context.Background()); err != nil { - t.Fatalf("%v.FullDuplexCall(_) = _, %v, want ", tc, err) - } -} - func TestEmptyUnaryWithUserAgent(t *testing.T) { defer leakcheck.Check(t) for _, e := range listTestEnv() { @@ -2607,6 +2677,7 @@ func testMetadataUnaryRPC(t *testing.T, e env) { delete(header, "trailer") // RFC 2616 says server SHOULD (but optional) declare trailers delete(header, "date") // the Date header is also optional delete(header, "user-agent") + delete(header, "content-type") } if !reflect.DeepEqual(header, testMetadata) { t.Fatalf("Received header metadata %v, want %v", header, testMetadata) @@ -2723,6 +2794,7 @@ func testSetAndSendHeaderUnaryRPC(t *testing.T, e env) { t.Fatalf("TestService.UnaryCall(%v, _, _, _) = _, %v; want _, ", ctx, err) } delete(header, "user-agent") + delete(header, "content-type") expectedHeader := metadata.Join(testMetadata, testMetadata2) if !reflect.DeepEqual(header, expectedHeader) { t.Fatalf("Received header metadata %v, want %v", header, expectedHeader) @@ -2767,6 +2839,7 @@ func testMultipleSetHeaderUnaryRPC(t *testing.T, e env) { t.Fatalf("TestService.UnaryCall(%v, _, _, _) = _, %v; want _, ", ctx, err) } delete(header, "user-agent") + delete(header, "content-type") expectedHeader := metadata.Join(testMetadata, testMetadata2) if !reflect.DeepEqual(header, expectedHeader) { t.Fatalf("Received header metadata %v, want %v", header, expectedHeader) @@ -2810,6 +2883,7 @@ func testMultipleSetHeaderUnaryRPCError(t *testing.T, e env) { t.Fatalf("TestService.UnaryCall(%v, _, _, _) = _, %v; want _, ", ctx, err) } delete(header, "user-agent") + delete(header, "content-type") expectedHeader := metadata.Join(testMetadata, testMetadata2) if !reflect.DeepEqual(header, expectedHeader) { t.Fatalf("Received header metadata %v, want %v", header, expectedHeader) @@ -2854,6 +2928,7 @@ func testSetAndSendHeaderStreamingRPC(t *testing.T, e env) { t.Fatalf("%v.Header() = _, %v, want _, ", stream, err) } delete(header, "user-agent") + delete(header, "content-type") expectedHeader := metadata.Join(testMetadata, testMetadata2) if !reflect.DeepEqual(header, expectedHeader) { t.Fatalf("Received header metadata %v, want %v", header, expectedHeader) @@ -2917,6 +2992,7 @@ func testMultipleSetHeaderStreamingRPC(t *testing.T, e env) { t.Fatalf("%v.Header() = _, %v, want _, ", stream, err) } delete(header, "user-agent") + delete(header, "content-type") expectedHeader := metadata.Join(testMetadata, testMetadata2) if !reflect.DeepEqual(header, expectedHeader) { t.Fatalf("Received header metadata %v, want %v", header, expectedHeader) @@ -2975,6 +3051,7 @@ func testMultipleSetHeaderStreamingRPCError(t *testing.T, e env) { t.Fatalf("%v.Header() = _, %v, want _, ", stream, err) } delete(header, "user-agent") + delete(header, "content-type") expectedHeader := metadata.Join(testMetadata, testMetadata2) if !reflect.DeepEqual(header, expectedHeader) { t.Fatalf("Received header metadata %v, want %v", header, expectedHeader) @@ -3335,6 +3412,7 @@ func testMetadataStreamingRPC(t *testing.T, e env) { } delete(headerMD, "trailer") // ignore if present delete(headerMD, "user-agent") + delete(headerMD, "content-type") if err != nil || !reflect.DeepEqual(testMetadata, headerMD) { t.Errorf("#1 %v.Header() = %v, %v, want %v, ", stream, headerMD, err, testMetadata) } @@ -3342,6 +3420,7 @@ func testMetadataStreamingRPC(t *testing.T, e env) { headerMD, err = stream.Header() delete(headerMD, "trailer") // ignore if present delete(headerMD, "user-agent") + delete(headerMD, "content-type") if err != nil || !reflect.DeepEqual(testMetadata, headerMD) { t.Errorf("#2 %v.Header() = %v, %v, want %v, ", stream, headerMD, err, testMetadata) } @@ -3728,22 +3807,24 @@ func testStreamsQuotaRecovery(t *testing.T, e env) { cc := te.clientConn() tc := testpb.NewTestServiceClient(cc) - if _, err := tc.StreamingInputCall(context.Background()); err != nil { - t.Fatalf("%v.StreamingInputCall(_) = _, %v, want _, ", tc, err) + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + if _, err := tc.StreamingInputCall(ctx); err != nil { + t.Fatalf("tc.StreamingInputCall(_) = _, %v, want _, ", err) } // Loop until the new max stream setting is effective. for { ctx, cancel := context.WithTimeout(context.Background(), 50*time.Millisecond) - defer cancel() _, err := tc.StreamingInputCall(ctx) + cancel() if err == nil { - time.Sleep(50 * time.Millisecond) + time.Sleep(5 * time.Millisecond) continue } if status.Code(err) == codes.DeadlineExceeded { break } - t.Fatalf("%v.StreamingInputCall(_) = _, %v, want _, %s", tc, err, codes.DeadlineExceeded) + t.Fatalf("tc.StreamingInputCall(_) = _, %v, want _, %s", err, codes.DeadlineExceeded) } var wg sync.WaitGroup @@ -3765,11 +3846,19 @@ func testStreamsQuotaRecovery(t *testing.T, e env) { ctx, cancel := context.WithTimeout(context.Background(), 10*time.Millisecond) defer cancel() if _, err := tc.UnaryCall(ctx, req, grpc.FailFast(false)); status.Code(err) != codes.DeadlineExceeded { - t.Errorf("TestService/UnaryCall(_, _) = _, %v, want _, %s", err, codes.DeadlineExceeded) + t.Errorf("tc.UnaryCall(_, _) = _, %v, want _, %s", err, codes.DeadlineExceeded) } }() } wg.Wait() + + cancel() + // A new stream should be allowed after canceling the first one. + ctx, cancel = context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + if _, err := tc.StreamingInputCall(ctx); err != nil { + t.Fatalf("tc.StreamingInputCall(_) = _, %v, want _, %v", err, nil) + } } func TestCompressServerHasNoSupport(t *testing.T) { @@ -4090,6 +4179,7 @@ type funcServer struct { testpb.TestServiceServer unaryCall func(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) streamingInputCall func(stream testpb.TestService_StreamingInputCallServer) error + fullDuplexCall func(stream testpb.TestService_FullDuplexCallServer) error } func (s *funcServer) UnaryCall(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { @@ -4100,6 +4190,10 @@ func (s *funcServer) StreamingInputCall(stream testpb.TestService_StreamingInput return s.streamingInputCall(stream) } +func (s *funcServer) FullDuplexCall(stream testpb.TestService_FullDuplexCallServer) error { + return s.fullDuplexCall(stream) +} + func TestClientRequestBodyErrorUnexpectedEOF(t *testing.T) { defer leakcheck.Check(t) for _, e := range listTestEnv() { @@ -4221,6 +4315,76 @@ func testClientRequestBodyErrorCancelStreamingInput(t *testing.T, e env) { }) } +func TestClientResourceExhaustedCancelFullDuplex(t *testing.T) { + defer leakcheck.Check(t) + for _, e := range listTestEnv() { + if e.httpHandler { + // httpHandler write won't be blocked on flow control window. + continue + } + testClientResourceExhaustedCancelFullDuplex(t, e) + } +} + +func testClientResourceExhaustedCancelFullDuplex(t *testing.T, e env) { + te := newTest(t, e) + recvErr := make(chan error, 1) + ts := &funcServer{fullDuplexCall: func(stream testpb.TestService_FullDuplexCallServer) error { + defer close(recvErr) + _, err := stream.Recv() + if err != nil { + return status.Errorf(codes.Internal, "stream.Recv() got error: %v, want ", err) + } + // create a payload that's larger than the default flow control window. + payload, err := newPayload(testpb.PayloadType_COMPRESSABLE, 10) + if err != nil { + return err + } + resp := &testpb.StreamingOutputCallResponse{ + Payload: payload, + } + ce := make(chan error) + go func() { + var err error + for { + if err = stream.Send(resp); err != nil { + break + } + } + ce <- err + }() + select { + case err = <-ce: + case <-time.After(10 * time.Second): + err = errors.New("10s timeout reached") + } + recvErr <- err + return err + }} + te.startServer(ts) + defer te.tearDown() + // set a low limit on receive message size to error with Resource Exhausted on + // client side when server send a large message. + te.maxClientReceiveMsgSize = newInt(10) + cc := te.clientConn() + tc := testpb.NewTestServiceClient(cc) + stream, err := tc.FullDuplexCall(context.Background()) + if err != nil { + t.Fatalf("%v.FullDuplexCall(_) = _, %v, want ", tc, err) + } + req := &testpb.StreamingOutputCallRequest{} + if err := stream.Send(req); err != nil { + t.Fatalf("%v.Send(%v) = %v, want ", stream, req, err) + } + if _, err := stream.Recv(); status.Code(err) != codes.ResourceExhausted { + t.Fatalf("%v.Recv() = _, %v, want _, error code: %s", stream, err, codes.ResourceExhausted) + } + err = <-recvErr + if status.Code(err) != codes.Canceled { + t.Fatalf("server got error %v, want error code: %s", err, codes.Canceled) + } +} + type clientTimeoutCreds struct { timeoutReturned bool } @@ -5832,3 +5996,47 @@ func TestServeExitsWhenListenerClosed(t *testing.T) { t.Fatalf("Serve did not return after %v", timeout) } } + +func TestClientDoesntDeadlockWhileWritingErrornousLargeMessages(t *testing.T) { + defer leakcheck.Check(t) + for _, e := range listTestEnv() { + if e.httpHandler { + continue + } + testClientDoesntDeadlockWhileWritingErrornousLargeMessages(t, e) + } +} + +func testClientDoesntDeadlockWhileWritingErrornousLargeMessages(t *testing.T, e env) { + te := newTest(t, e) + te.userAgent = testAppUA + smallSize := 1024 + te.maxServerReceiveMsgSize = &smallSize + te.startServer(&testServer{security: e.security}) + defer te.tearDown() + tc := testpb.NewTestServiceClient(te.clientConn()) + payload, err := newPayload(testpb.PayloadType_COMPRESSABLE, 1048576) + if err != nil { + t.Fatal(err) + } + req := &testpb.SimpleRequest{ + ResponseType: testpb.PayloadType_COMPRESSABLE, + Payload: payload, + } + var wg sync.WaitGroup + for i := 0; i < 10; i++ { + wg.Add(1) + go func() { + defer wg.Done() + for j := 0; j < 100; j++ { + ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(time.Second*10)) + defer cancel() + if _, err := tc.UnaryCall(ctx, req); status.Code(err) != codes.ResourceExhausted { + t.Errorf("TestService/UnaryCall(_,_) = _. %v, want code: %s", err, codes.ResourceExhausted) + return + } + } + }() + } + wg.Wait() +} diff --git a/vendor/google.golang.org/grpc/transport/handler_server.go b/vendor/google.golang.org/grpc/transport/handler_server.go index 27c4ebb5f..451d7e629 100644 --- a/vendor/google.golang.org/grpc/transport/handler_server.go +++ b/vendor/google.golang.org/grpc/transport/handler_server.go @@ -40,20 +40,24 @@ import ( "google.golang.org/grpc/credentials" "google.golang.org/grpc/metadata" "google.golang.org/grpc/peer" + "google.golang.org/grpc/stats" "google.golang.org/grpc/status" ) // NewServerHandlerTransport returns a ServerTransport handling gRPC // from inside an http.Handler. It requires that the http Server // supports HTTP/2. -func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request) (ServerTransport, error) { +func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request, stats stats.Handler) (ServerTransport, error) { if r.ProtoMajor != 2 { return nil, errors.New("gRPC requires HTTP/2") } if r.Method != "POST" { return nil, errors.New("invalid gRPC request method") } - if !validContentType(r.Header.Get("Content-Type")) { + contentType := r.Header.Get("Content-Type") + // TODO: do we assume contentType is lowercase? we did before + contentSubtype, validContentType := contentSubtype(contentType) + if !validContentType { return nil, errors.New("invalid gRPC request content-type") } if _, ok := w.(http.Flusher); !ok { @@ -64,10 +68,13 @@ func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request) (ServerTr } st := &serverHandlerTransport{ - rw: w, - req: r, - closedCh: make(chan struct{}), - writes: make(chan func()), + rw: w, + req: r, + closedCh: make(chan struct{}), + writes: make(chan func()), + contentType: contentType, + contentSubtype: contentSubtype, + stats: stats, } if v := r.Header.Get("grpc-timeout"); v != "" { @@ -79,7 +86,7 @@ func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request) (ServerTr st.timeout = to } - var metakv []string + metakv := []string{"content-type", contentType} if r.Host != "" { metakv = append(metakv, ":authority", r.Host) } @@ -126,6 +133,14 @@ type serverHandlerTransport struct { // block concurrent WriteStatus calls // e.g. grpc/(*serverStream).SendMsg/RecvMsg writeStatusMu sync.Mutex + + // we just mirror the request content-type + contentType string + // we store both contentType and contentSubtype so we don't keep recreating them + // TODO make sure this is consistent across handler_server and http2_server + contentSubtype string + + stats stats.Handler } func (ht *serverHandlerTransport) Close() error { @@ -219,6 +234,9 @@ func (ht *serverHandlerTransport) WriteStatus(s *Stream, st *status.Status) erro }) if err == nil { // transport has not been closed + if ht.stats != nil { + ht.stats.HandleRPC(s.Context(), &stats.OutTrailer{}) + } ht.Close() close(ht.writes) } @@ -235,7 +253,7 @@ func (ht *serverHandlerTransport) writeCommonHeaders(s *Stream) { h := ht.rw.Header() h["Date"] = nil // suppress Date to make tests happy; TODO: restore - h.Set("Content-Type", "application/grpc") + h.Set("Content-Type", ht.contentType) // Predeclare trailers we'll set later in WriteStatus (after the body). // This is a SHOULD in the HTTP RFC, and the way you add (known) @@ -263,7 +281,7 @@ func (ht *serverHandlerTransport) Write(s *Stream, hdr []byte, data []byte, opts } func (ht *serverHandlerTransport) WriteHeader(s *Stream, md metadata.MD) error { - return ht.do(func() { + err := ht.do(func() { ht.writeCommonHeaders(s) h := ht.rw.Header() for k, vv := range md { @@ -279,6 +297,13 @@ func (ht *serverHandlerTransport) WriteHeader(s *Stream, md metadata.MD) error { ht.rw.WriteHeader(200) ht.rw.(http.Flusher).Flush() }) + + if err == nil { + if ht.stats != nil { + ht.stats.HandleRPC(s.Context(), &stats.OutHeader{}) + } + } + return err } func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream), traceCtx func(context.Context, string) context.Context) { @@ -313,13 +338,14 @@ func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream), trace req := ht.req s := &Stream{ - id: 0, // irrelevant - requestRead: func(int) {}, - cancel: cancel, - buf: newRecvBuffer(), - st: ht, - method: req.URL.Path, - recvCompress: req.Header.Get("grpc-encoding"), + id: 0, // irrelevant + requestRead: func(int) {}, + cancel: cancel, + buf: newRecvBuffer(), + st: ht, + method: req.URL.Path, + recvCompress: req.Header.Get("grpc-encoding"), + contentSubtype: ht.contentSubtype, } pr := &peer.Peer{ Addr: ht.RemoteAddr(), @@ -330,6 +356,15 @@ func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream), trace ctx = metadata.NewIncomingContext(ctx, ht.headerMD) ctx = peer.NewContext(ctx, pr) s.ctx = newContextWithStream(ctx, s) + if ht.stats != nil { + s.ctx = ht.stats.TagRPC(s.ctx, &stats.RPCTagInfo{FullMethodName: s.method}) + inHeader := &stats.InHeader{ + FullMethod: s.method, + RemoteAddr: ht.RemoteAddr(), + Compression: s.recvCompress, + } + ht.stats.HandleRPC(s.ctx, inHeader) + } s.trReader = &transportReader{ reader: &recvBufferReader{ctx: s.ctx, recv: s.buf}, windowHandler: func(int) {}, diff --git a/vendor/google.golang.org/grpc/transport/handler_server_test.go b/vendor/google.golang.org/grpc/transport/handler_server_test.go index 8505e1a7f..3261b8e3d 100644 --- a/vendor/google.golang.org/grpc/transport/handler_server_test.go +++ b/vendor/google.golang.org/grpc/transport/handler_server_test.go @@ -199,9 +199,10 @@ func TestHandlerTransport_NewServerHandlerTransport(t *testing.T) { }, check: func(ht *serverHandlerTransport, tt *testCase) error { want := metadata.MD{ - "meta-bar": {"bar-val1", "bar-val2"}, - "user-agent": {"x/y a/b"}, - "meta-foo": {"foo-val"}, + "meta-bar": {"bar-val1", "bar-val2"}, + "user-agent": {"x/y a/b"}, + "meta-foo": {"foo-val"}, + "content-type": {"application/grpc"}, } if !reflect.DeepEqual(ht.headerMD, want) { @@ -217,7 +218,7 @@ func TestHandlerTransport_NewServerHandlerTransport(t *testing.T) { if tt.modrw != nil { rw = tt.modrw(rw) } - got, gotErr := NewServerHandlerTransport(rw, tt.req) + got, gotErr := NewServerHandlerTransport(rw, tt.req, nil) if (gotErr != nil) != (tt.wantErr != "") || (gotErr != nil && gotErr.Error() != tt.wantErr) { t.Errorf("%s: error = %v; want %q", tt.name, gotErr, tt.wantErr) continue @@ -271,7 +272,7 @@ func newHandleStreamTest(t *testing.T) *handleStreamTest { Body: bodyr, } rw := newTestHandlerResponseWriter().(testHandlerResponseWriter) - ht, err := NewServerHandlerTransport(rw, req) + ht, err := NewServerHandlerTransport(rw, req, nil) if err != nil { t.Fatal(err) } @@ -356,7 +357,7 @@ func TestHandlerTransport_HandleStreams_Timeout(t *testing.T) { Body: bodyr, } rw := newTestHandlerResponseWriter().(testHandlerResponseWriter) - ht, err := NewServerHandlerTransport(rw, req) + ht, err := NewServerHandlerTransport(rw, req, nil) if err != nil { t.Fatal(err) } diff --git a/vendor/google.golang.org/grpc/transport/http2_client.go b/vendor/google.golang.org/grpc/transport/http2_client.go index b7f1f5481..56b434ef3 100644 --- a/vendor/google.golang.org/grpc/transport/http2_client.go +++ b/vendor/google.golang.org/grpc/transport/http2_client.go @@ -314,15 +314,16 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts Conne func (t *http2Client) newStream(ctx context.Context, callHdr *CallHdr) *Stream { // TODO(zhaoq): Handle uint32 overflow of Stream.id. s := &Stream{ - id: t.nextID, - done: make(chan struct{}), - goAway: make(chan struct{}), - method: callHdr.Method, - sendCompress: callHdr.SendCompress, - buf: newRecvBuffer(), - fc: &inFlow{limit: uint32(t.initialWindowSize)}, - sendQuotaPool: newQuotaPool(int(t.streamSendQuota)), - headerChan: make(chan struct{}), + id: t.nextID, + done: make(chan struct{}), + goAway: make(chan struct{}), + method: callHdr.Method, + sendCompress: callHdr.SendCompress, + buf: newRecvBuffer(), + fc: &inFlow{limit: uint32(t.initialWindowSize)}, + sendQuotaPool: newQuotaPool(int(t.streamSendQuota)), + headerChan: make(chan struct{}), + contentSubtype: callHdr.ContentSubtype, } t.nextID += 2 s.requestRead = func(n int) { @@ -380,7 +381,11 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Strea for _, c := range t.creds { data, err := c.GetRequestMetadata(ctx, audience) if err != nil { - return nil, streamErrorf(codes.Internal, "transport: %v", err) + if _, ok := status.FromError(err); ok { + return nil, err + } + + return nil, streamErrorf(codes.Unauthenticated, "transport: %v", err) } for k, v := range data { // Capital header names are illegal in HTTP/2. @@ -434,7 +439,7 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Strea headerFields = append(headerFields, hpack.HeaderField{Name: ":scheme", Value: t.scheme}) headerFields = append(headerFields, hpack.HeaderField{Name: ":path", Value: callHdr.Method}) headerFields = append(headerFields, hpack.HeaderField{Name: ":authority", Value: callHdr.Host}) - headerFields = append(headerFields, hpack.HeaderField{Name: "content-type", Value: "application/grpc"}) + headerFields = append(headerFields, hpack.HeaderField{Name: "content-type", Value: contentType(callHdr.ContentSubtype)}) headerFields = append(headerFields, hpack.HeaderField{Name: "user-agent", Value: t.userAgent}) headerFields = append(headerFields, hpack.HeaderField{Name: "te", Value: "trailers"}) @@ -459,7 +464,22 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Strea if b := stats.OutgoingTrace(ctx); b != nil { headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-trace-bin", Value: encodeBinHeader(b)}) } - if md, ok := metadata.FromOutgoingContext(ctx); ok { + + if md, added, ok := metadata.FromOutgoingContextRaw(ctx); ok { + var k string + for _, vv := range added { + for i, v := range vv { + if i%2 == 0 { + k = v + continue + } + // HTTP doesn't allow you to set pseudoheaders after non pseudoheaders were set. + if isReservedHeader(k) { + continue + } + headerFields = append(headerFields, hpack.HeaderField{Name: strings.ToLower(k), Value: encodeMetadataHeader(k, v)}) + } + } for k, vv := range md { // HTTP doesn't allow you to set pseudoheaders after non pseudoheaders were set. if isReservedHeader(k) { @@ -576,7 +596,7 @@ func (t *http2Client) CloseStream(s *Stream, err error) { } s.state = streamDone s.mu.Unlock() - if _, ok := err.(StreamError); ok { + if err != nil && !rstStream { rstStream = true rstError = http2.ErrCodeCancel } @@ -696,6 +716,8 @@ func (t *http2Client) Write(s *Stream, hdr []byte, data []byte, opts *Options) e } ltq, _, err := t.localSendQuota.get(size, s.waiters) if err != nil { + // Add the acquired quota back to transport. + t.sendQuotaPool.add(tq) return err } // even if ltq is smaller than size we don't adjust size since @@ -1113,8 +1135,9 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { s.mu.Lock() if !s.headerDone { - // Headers frame is not actually a trailers-only frame. if !endStream { + // Headers frame is not actually a trailers-only frame. + isHeader = true s.recvCompress = state.encoding if len(state.mdata) > 0 { s.header = state.mdata @@ -1122,7 +1145,6 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { } close(s.headerChan) s.headerDone = true - isHeader = true } if !endStream || s.state == streamDone { s.mu.Unlock() diff --git a/vendor/google.golang.org/grpc/transport/http2_server.go b/vendor/google.golang.org/grpc/transport/http2_server.go index 6d252c53a..24c2c7e18 100644 --- a/vendor/google.golang.org/grpc/transport/http2_server.go +++ b/vendor/google.golang.org/grpc/transport/http2_server.go @@ -281,12 +281,13 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( buf := newRecvBuffer() s := &Stream{ - id: streamID, - st: t, - buf: buf, - fc: &inFlow{limit: uint32(t.initialWindowSize)}, - recvCompress: state.encoding, - method: state.method, + id: streamID, + st: t, + buf: buf, + fc: &inFlow{limit: uint32(t.initialWindowSize)}, + recvCompress: state.encoding, + method: state.method, + contentSubtype: state.contentSubtype, } if frame.StreamEnded() { @@ -730,7 +731,7 @@ func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error { // first and create a slice of that exact size. headerFields := make([]hpack.HeaderField, 0, 2) // at least :status, content-type will be there if none else. headerFields = append(headerFields, hpack.HeaderField{Name: ":status", Value: "200"}) - headerFields = append(headerFields, hpack.HeaderField{Name: "content-type", Value: "application/grpc"}) + headerFields = append(headerFields, hpack.HeaderField{Name: "content-type", Value: contentType(s.contentSubtype)}) if s.sendCompress != "" { headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-encoding", Value: s.sendCompress}) } @@ -749,9 +750,9 @@ func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error { endStream: false, }) if t.stats != nil { - outHeader := &stats.OutHeader{ - //WireLength: // TODO(mmukhi): Revisit this later, if needed. - } + // Note: WireLength is not set in outHeader. + // TODO(mmukhi): Revisit this later, if needed. + outHeader := &stats.OutHeader{} t.stats.HandleRPC(s.Context(), outHeader) } return nil @@ -792,7 +793,7 @@ func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error { headerFields := make([]hpack.HeaderField, 0, 2) // grpc-status and grpc-message will be there if none else. if !headersSent { headerFields = append(headerFields, hpack.HeaderField{Name: ":status", Value: "200"}) - headerFields = append(headerFields, hpack.HeaderField{Name: "content-type", Value: "application/grpc"}) + headerFields = append(headerFields, hpack.HeaderField{Name: "content-type", Value: contentType(s.contentSubtype)}) } headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-status", Value: strconv.Itoa(int(st.Code()))}) headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-message", Value: encodeGrpcMessage(st.Message())}) @@ -842,10 +843,6 @@ func (t *http2Server) Write(s *Stream, hdr []byte, data []byte, opts *Options) e var writeHeaderFrame bool s.mu.Lock() - if s.state == streamDone { - s.mu.Unlock() - return streamErrorf(codes.Unknown, "the stream has been done") - } if !s.headerOk { writeHeaderFrame = true } @@ -891,6 +888,8 @@ func (t *http2Server) Write(s *Stream, hdr []byte, data []byte, opts *Options) e } ltq, _, err := t.localSendQuota.get(size, s.waiters) if err != nil { + // Add the acquired quota back to transport. + t.sendQuotaPool.add(tq) return err } // even if ltq is smaller than size we don't adjust size since, diff --git a/vendor/google.golang.org/grpc/transport/http_util.go b/vendor/google.golang.org/grpc/transport/http_util.go index 39f878cfd..344767731 100644 --- a/vendor/google.golang.org/grpc/transport/http_util.go +++ b/vendor/google.golang.org/grpc/transport/http_util.go @@ -46,6 +46,12 @@ const ( // http2IOBufSize specifies the buffer size for sending frames. defaultWriteBufSize = 32 * 1024 defaultReadBufSize = 32 * 1024 + // baseContentType is the base content-type for gRPC. This is a valid + // content-type on it's own, but can also include a content-subtype such as + // "proto" as a suffix after "+" or ";". See + // https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests + // for more details. + baseContentType = "application/grpc" ) var ( @@ -111,9 +117,10 @@ type decodeState struct { timeout time.Duration method string // key-value metadata map from the peer. - mdata map[string][]string - statsTags []byte - statsTrace []byte + mdata map[string][]string + statsTags []byte + statsTrace []byte + contentSubtype string } // isReservedHeader checks whether hdr belongs to HTTP2 headers @@ -149,17 +156,44 @@ func isWhitelistedPseudoHeader(hdr string) bool { } } -func validContentType(t string) bool { - e := "application/grpc" - if !strings.HasPrefix(t, e) { - return false +// contentSubtype returns the content-subtype for the given content-type. The +// given content-type must be a valid content-type that starts with +// "application/grpc". A content-subtype will follow "application/grpc" after a +// "+" or ";". See +// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests for +// more details. +// +// If contentType is not a valid content-type for gRPC, the boolean +// will be false, otherwise true. If content-type == "application/grpc", +// "application/grpc+", or "application/grpc;", the boolean will be true, +// but no content-subtype will be returned. +// +// contentType is assumed to be lowercase already. +func contentSubtype(contentType string) (string, bool) { + if contentType == baseContentType { + return "", true + } + if !strings.HasPrefix(contentType, baseContentType) { + return "", false + } + // guaranteed since != baseContentType and has baseContentType prefix + switch contentType[len(baseContentType)] { + case '+', ';': + // this will return true for "application/grpc+" or "application/grpc;" + // which the previous validContentType function tested to be valid, so we + // just say that no content-subtype is specified in this case + return contentType[len(baseContentType)+1:], true + default: + return "", false } - // Support variations on the content-type - // (e.g. "application/grpc+blah", "application/grpc;blah"). - if len(t) > len(e) && t[len(e)] != '+' && t[len(e)] != ';' { - return false +} + +// contentSubtype is assumed to be lowercase +func contentType(contentSubtype string) string { + if contentSubtype == "" { + return baseContentType } - return true + return baseContentType + "+" + contentSubtype } func (d *decodeState) status() *status.Status { @@ -247,9 +281,16 @@ func (d *decodeState) addMetadata(k, v string) { func (d *decodeState) processHeaderField(f hpack.HeaderField) error { switch f.Name { case "content-type": - if !validContentType(f.Value) { + contentSubtype, validContentType := contentSubtype(f.Value) + if !validContentType { return streamErrorf(codes.FailedPrecondition, "transport: received the unexpected content-type %q", f.Value) } + d.contentSubtype = contentSubtype + // TODO: do we want to propagate the whole content-type in the metadata, + // or come up with a way to just propagate the content-subtype if it was set? + // ie {"content-type": "application/grpc+proto"} or {"content-subtype": "proto"} + // in the metadata? + d.addMetadata(f.Name, f.Value) case "grpc-encoding": d.encoding = f.Value case "grpc-status": diff --git a/vendor/google.golang.org/grpc/transport/http_util_test.go b/vendor/google.golang.org/grpc/transport/http_util_test.go index 4ebb23905..c3754781d 100644 --- a/vendor/google.golang.org/grpc/transport/http_util_test.go +++ b/vendor/google.golang.org/grpc/transport/http_util_test.go @@ -72,24 +72,25 @@ func TestTimeoutDecode(t *testing.T) { } } -func TestValidContentType(t *testing.T) { +func TestContentSubtype(t *testing.T) { tests := []struct { - h string - want bool + contentType string + want string + wantValid bool }{ - {"application/grpc", true}, - {"application/grpc+", true}, - {"application/grpc+blah", true}, - {"application/grpc;", true}, - {"application/grpc;blah", true}, - {"application/grpcd", false}, - {"application/grpd", false}, - {"application/grp", false}, + {"application/grpc", "", true}, + {"application/grpc+", "", true}, + {"application/grpc+blah", "blah", true}, + {"application/grpc;", "", true}, + {"application/grpc;blah", "blah", true}, + {"application/grpcd", "", false}, + {"application/grpd", "", false}, + {"application/grp", "", false}, } for _, tt := range tests { - got := validContentType(tt.h) - if got != tt.want { - t.Errorf("validContentType(%q) = %v; want %v", tt.h, got, tt.want) + got, gotValid := contentSubtype(tt.contentType) + if got != tt.want || gotValid != tt.wantValid { + t.Errorf("contentSubtype(%q) = (%v, %v); want (%v, %v)", tt.contentType, got, gotValid, tt.want, tt.wantValid) } } } diff --git a/vendor/google.golang.org/grpc/transport/transport.go b/vendor/google.golang.org/grpc/transport/transport.go index 2e7bcaeaa..e68f89ec4 100644 --- a/vendor/google.golang.org/grpc/transport/transport.go +++ b/vendor/google.golang.org/grpc/transport/transport.go @@ -246,6 +246,10 @@ type Stream struct { bytesReceived bool // indicates whether any bytes have been received on this stream unprocessed bool // set if the server sends a refused stream or GOAWAY including this stream + + // contentSubtype is the content-subtype for requests. + // this must be lowercase or the behavior is undefined. + contentSubtype string } func (s *Stream) waitOnHeader() error { @@ -321,6 +325,15 @@ func (s *Stream) ServerTransport() ServerTransport { return s.st } +// ContentSubtype returns the content-subtype for a request. For example, a +// content-subtype of "proto" will result in a content-type of +// "application/grpc+proto". This will always be lowercase. See +// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests for +// more details. +func (s *Stream) ContentSubtype() string { + return s.contentSubtype +} + // Context returns the context of the stream. func (s *Stream) Context() context.Context { return s.ctx @@ -553,6 +566,14 @@ type CallHdr struct { // for performance purposes. // If it's false, new stream will never be flushed. Flush bool + + // ContentSubtype specifies the content-subtype for a request. For example, a + // content-subtype of "proto" will result in a content-type of + // "application/grpc+proto". The value of ContentSubtype must be all + // lowercase, otherwise the behavior is undefined. See + // https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests + // for more details. + ContentSubtype string } // ClientTransport is the common interface for all gRPC client-side transport @@ -676,13 +697,13 @@ func (e ConnectionError) Origin() error { var ( // ErrConnClosing indicates that the transport is closing. ErrConnClosing = connectionErrorf(true, nil, "transport is closing") - // errStreamDrain indicates that the stream is rejected by the server because - // the server stops accepting new RPCs. - // TODO: delete this error; it is no longer necessary. - errStreamDrain = streamErrorf(codes.Unavailable, "the server stops accepting new RPCs") + // errStreamDrain indicates that the stream is rejected because the + // connection is draining. This could be caused by goaway or balancer + // removing the address. + errStreamDrain = streamErrorf(codes.Unavailable, "the connection is draining") // StatusGoAway indicates that the server sent a GOAWAY that included this // stream's ID in unprocessed RPCs. - statusGoAway = status.New(codes.Unavailable, "the server stopped accepting new RPCs") + statusGoAway = status.New(codes.Unavailable, "the stream is rejected because server is draining the connection") ) // TODO: See if we can replace StreamError with status package errors. diff --git a/vendor/gopkg.in/yaml.v2/.travis.yml b/vendor/gopkg.in/yaml.v2/.travis.yml index 004172a2e..9f556934d 100644 --- a/vendor/gopkg.in/yaml.v2/.travis.yml +++ b/vendor/gopkg.in/yaml.v2/.travis.yml @@ -4,6 +4,9 @@ go: - 1.4 - 1.5 - 1.6 + - 1.7 + - 1.8 + - 1.9 - tip go_import_path: gopkg.in/yaml.v2 diff --git a/vendor/gopkg.in/yaml.v2/NOTICE b/vendor/gopkg.in/yaml.v2/NOTICE new file mode 100644 index 000000000..866d74a7a --- /dev/null +++ b/vendor/gopkg.in/yaml.v2/NOTICE @@ -0,0 +1,13 @@ +Copyright 2011-2016 Canonical Ltd. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/vendor/gopkg.in/yaml.v2/apic.go b/vendor/gopkg.in/yaml.v2/apic.go index 95ec014e8..3e24a0d7d 100644 --- a/vendor/gopkg.in/yaml.v2/apic.go +++ b/vendor/gopkg.in/yaml.v2/apic.go @@ -2,7 +2,6 @@ package yaml import ( "io" - "os" ) func yaml_insert_token(parser *yaml_parser_t, pos int, token *yaml_token_t) { @@ -48,9 +47,9 @@ func yaml_string_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err return n, nil } -// File read handler. -func yaml_file_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) { - return parser.input_file.Read(buffer) +// Reader read handler. +func yaml_reader_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) { + return parser.input_reader.Read(buffer) } // Set a string input. @@ -64,12 +63,12 @@ func yaml_parser_set_input_string(parser *yaml_parser_t, input []byte) { } // Set a file input. -func yaml_parser_set_input_file(parser *yaml_parser_t, file *os.File) { +func yaml_parser_set_input_reader(parser *yaml_parser_t, r io.Reader) { if parser.read_handler != nil { panic("must set the input source only once") } - parser.read_handler = yaml_file_read_handler - parser.input_file = file + parser.read_handler = yaml_reader_read_handler + parser.input_reader = r } // Set the source encoding. @@ -81,14 +80,13 @@ func yaml_parser_set_encoding(parser *yaml_parser_t, encoding yaml_encoding_t) { } // Create a new emitter object. -func yaml_emitter_initialize(emitter *yaml_emitter_t) bool { +func yaml_emitter_initialize(emitter *yaml_emitter_t) { *emitter = yaml_emitter_t{ buffer: make([]byte, output_buffer_size), raw_buffer: make([]byte, 0, output_raw_buffer_size), states: make([]yaml_emitter_state_t, 0, initial_stack_size), events: make([]yaml_event_t, 0, initial_queue_size), } - return true } // Destroy an emitter object. @@ -102,9 +100,10 @@ func yaml_string_write_handler(emitter *yaml_emitter_t, buffer []byte) error { return nil } -// File write handler. -func yaml_file_write_handler(emitter *yaml_emitter_t, buffer []byte) error { - _, err := emitter.output_file.Write(buffer) +// yaml_writer_write_handler uses emitter.output_writer to write the +// emitted text. +func yaml_writer_write_handler(emitter *yaml_emitter_t, buffer []byte) error { + _, err := emitter.output_writer.Write(buffer) return err } @@ -118,12 +117,12 @@ func yaml_emitter_set_output_string(emitter *yaml_emitter_t, output_buffer *[]by } // Set a file output. -func yaml_emitter_set_output_file(emitter *yaml_emitter_t, file io.Writer) { +func yaml_emitter_set_output_writer(emitter *yaml_emitter_t, w io.Writer) { if emitter.write_handler != nil { panic("must set the output target only once") } - emitter.write_handler = yaml_file_write_handler - emitter.output_file = file + emitter.write_handler = yaml_writer_write_handler + emitter.output_writer = w } // Set the output encoding. @@ -252,41 +251,41 @@ func yaml_emitter_set_break(emitter *yaml_emitter_t, line_break yaml_break_t) { // // Create STREAM-START. -func yaml_stream_start_event_initialize(event *yaml_event_t, encoding yaml_encoding_t) bool { +func yaml_stream_start_event_initialize(event *yaml_event_t, encoding yaml_encoding_t) { *event = yaml_event_t{ typ: yaml_STREAM_START_EVENT, encoding: encoding, } - return true } // Create STREAM-END. -func yaml_stream_end_event_initialize(event *yaml_event_t) bool { +func yaml_stream_end_event_initialize(event *yaml_event_t) { *event = yaml_event_t{ typ: yaml_STREAM_END_EVENT, } - return true } // Create DOCUMENT-START. -func yaml_document_start_event_initialize(event *yaml_event_t, version_directive *yaml_version_directive_t, - tag_directives []yaml_tag_directive_t, implicit bool) bool { +func yaml_document_start_event_initialize( + event *yaml_event_t, + version_directive *yaml_version_directive_t, + tag_directives []yaml_tag_directive_t, + implicit bool, +) { *event = yaml_event_t{ typ: yaml_DOCUMENT_START_EVENT, version_directive: version_directive, tag_directives: tag_directives, implicit: implicit, } - return true } // Create DOCUMENT-END. -func yaml_document_end_event_initialize(event *yaml_event_t, implicit bool) bool { +func yaml_document_end_event_initialize(event *yaml_event_t, implicit bool) { *event = yaml_event_t{ typ: yaml_DOCUMENT_END_EVENT, implicit: implicit, } - return true } ///* @@ -348,7 +347,7 @@ func yaml_sequence_end_event_initialize(event *yaml_event_t) bool { } // Create MAPPING-START. -func yaml_mapping_start_event_initialize(event *yaml_event_t, anchor, tag []byte, implicit bool, style yaml_mapping_style_t) bool { +func yaml_mapping_start_event_initialize(event *yaml_event_t, anchor, tag []byte, implicit bool, style yaml_mapping_style_t) { *event = yaml_event_t{ typ: yaml_MAPPING_START_EVENT, anchor: anchor, @@ -356,15 +355,13 @@ func yaml_mapping_start_event_initialize(event *yaml_event_t, anchor, tag []byte implicit: implicit, style: yaml_style_t(style), } - return true } // Create MAPPING-END. -func yaml_mapping_end_event_initialize(event *yaml_event_t) bool { +func yaml_mapping_end_event_initialize(event *yaml_event_t) { *event = yaml_event_t{ typ: yaml_MAPPING_END_EVENT, } - return true } // Destroy an event object. diff --git a/vendor/gopkg.in/yaml.v2/decode.go b/vendor/gopkg.in/yaml.v2/decode.go index e85eb2e3f..c8eac1642 100644 --- a/vendor/gopkg.in/yaml.v2/decode.go +++ b/vendor/gopkg.in/yaml.v2/decode.go @@ -4,6 +4,7 @@ import ( "encoding" "encoding/base64" "fmt" + "io" "math" "reflect" "strconv" @@ -22,19 +23,22 @@ type node struct { kind int line, column int tag string - value string - implicit bool - children []*node - anchors map[string]*node + // For an alias node, alias holds the resolved alias. + alias *node + value string + implicit bool + children []*node + anchors map[string]*node } // ---------------------------------------------------------------------------- // Parser, produces a node tree out of a libyaml event stream. type parser struct { - parser yaml_parser_t - event yaml_event_t - doc *node + parser yaml_parser_t + event yaml_event_t + doc *node + doneInit bool } func newParser(b []byte) *parser { @@ -42,21 +46,30 @@ func newParser(b []byte) *parser { if !yaml_parser_initialize(&p.parser) { panic("failed to initialize YAML emitter") } - if len(b) == 0 { b = []byte{'\n'} } - yaml_parser_set_input_string(&p.parser, b) + return &p +} - p.skip() - if p.event.typ != yaml_STREAM_START_EVENT { - panic("expected stream start event, got " + strconv.Itoa(int(p.event.typ))) +func newParserFromReader(r io.Reader) *parser { + p := parser{} + if !yaml_parser_initialize(&p.parser) { + panic("failed to initialize YAML emitter") } - p.skip() + yaml_parser_set_input_reader(&p.parser, r) return &p } +func (p *parser) init() { + if p.doneInit { + return + } + p.expect(yaml_STREAM_START_EVENT) + p.doneInit = true +} + func (p *parser) destroy() { if p.event.typ != yaml_NO_EVENT { yaml_event_delete(&p.event) @@ -64,16 +77,35 @@ func (p *parser) destroy() { yaml_parser_delete(&p.parser) } -func (p *parser) skip() { - if p.event.typ != yaml_NO_EVENT { - if p.event.typ == yaml_STREAM_END_EVENT { - failf("attempted to go past the end of stream; corrupted value?") +// expect consumes an event from the event stream and +// checks that it's of the expected type. +func (p *parser) expect(e yaml_event_type_t) { + if p.event.typ == yaml_NO_EVENT { + if !yaml_parser_parse(&p.parser, &p.event) { + p.fail() } - yaml_event_delete(&p.event) + } + if p.event.typ == yaml_STREAM_END_EVENT { + failf("attempted to go past the end of stream; corrupted value?") + } + if p.event.typ != e { + p.parser.problem = fmt.Sprintf("expected %s event but got %s", e, p.event.typ) + p.fail() + } + yaml_event_delete(&p.event) + p.event.typ = yaml_NO_EVENT +} + +// peek peeks at the next event in the event stream, +// puts the results into p.event and returns the event type. +func (p *parser) peek() yaml_event_type_t { + if p.event.typ != yaml_NO_EVENT { + return p.event.typ } if !yaml_parser_parse(&p.parser, &p.event) { p.fail() } + return p.event.typ } func (p *parser) fail() { @@ -103,7 +135,8 @@ func (p *parser) anchor(n *node, anchor []byte) { } func (p *parser) parse() *node { - switch p.event.typ { + p.init() + switch p.peek() { case yaml_SCALAR_EVENT: return p.scalar() case yaml_ALIAS_EVENT: @@ -118,7 +151,7 @@ func (p *parser) parse() *node { // Happens when attempting to decode an empty buffer. return nil default: - panic("attempted to parse unknown event: " + strconv.Itoa(int(p.event.typ))) + panic("attempted to parse unknown event: " + p.event.typ.String()) } } @@ -134,19 +167,20 @@ func (p *parser) document() *node { n := p.node(documentNode) n.anchors = make(map[string]*node) p.doc = n - p.skip() + p.expect(yaml_DOCUMENT_START_EVENT) n.children = append(n.children, p.parse()) - if p.event.typ != yaml_DOCUMENT_END_EVENT { - panic("expected end of document event but got " + strconv.Itoa(int(p.event.typ))) - } - p.skip() + p.expect(yaml_DOCUMENT_END_EVENT) return n } func (p *parser) alias() *node { n := p.node(aliasNode) n.value = string(p.event.anchor) - p.skip() + n.alias = p.doc.anchors[n.value] + if n.alias == nil { + failf("unknown anchor '%s' referenced", n.value) + } + p.expect(yaml_ALIAS_EVENT) return n } @@ -156,29 +190,29 @@ func (p *parser) scalar() *node { n.tag = string(p.event.tag) n.implicit = p.event.implicit p.anchor(n, p.event.anchor) - p.skip() + p.expect(yaml_SCALAR_EVENT) return n } func (p *parser) sequence() *node { n := p.node(sequenceNode) p.anchor(n, p.event.anchor) - p.skip() - for p.event.typ != yaml_SEQUENCE_END_EVENT { + p.expect(yaml_SEQUENCE_START_EVENT) + for p.peek() != yaml_SEQUENCE_END_EVENT { n.children = append(n.children, p.parse()) } - p.skip() + p.expect(yaml_SEQUENCE_END_EVENT) return n } func (p *parser) mapping() *node { n := p.node(mappingNode) p.anchor(n, p.event.anchor) - p.skip() - for p.event.typ != yaml_MAPPING_END_EVENT { + p.expect(yaml_MAPPING_START_EVENT) + for p.peek() != yaml_MAPPING_END_EVENT { n.children = append(n.children, p.parse(), p.parse()) } - p.skip() + p.expect(yaml_MAPPING_END_EVENT) return n } @@ -187,7 +221,7 @@ func (p *parser) mapping() *node { type decoder struct { doc *node - aliases map[string]bool + aliases map[*node]bool mapType reflect.Type terrors []string strict bool @@ -198,11 +232,13 @@ var ( durationType = reflect.TypeOf(time.Duration(0)) defaultMapType = reflect.TypeOf(map[interface{}]interface{}{}) ifaceType = defaultMapType.Elem() + timeType = reflect.TypeOf(time.Time{}) + ptrTimeType = reflect.TypeOf(&time.Time{}) ) func newDecoder(strict bool) *decoder { d := &decoder{mapType: defaultMapType, strict: strict} - d.aliases = make(map[string]bool) + d.aliases = make(map[*node]bool) return d } @@ -308,16 +344,13 @@ func (d *decoder) document(n *node, out reflect.Value) (good bool) { } func (d *decoder) alias(n *node, out reflect.Value) (good bool) { - an, ok := d.doc.anchors[n.value] - if !ok { - failf("unknown anchor '%s' referenced", n.value) - } - if d.aliases[n.value] { + if d.aliases[n] { + // TODO this could actually be allowed in some circumstances. failf("anchor '%s' value contains itself", n.value) } - d.aliases[n.value] = true - good = d.unmarshal(an, out) - delete(d.aliases, n.value) + d.aliases[n] = true + good = d.unmarshal(n.alias, out) + delete(d.aliases, n) return good } @@ -329,7 +362,7 @@ func resetMap(out reflect.Value) { } } -func (d *decoder) scalar(n *node, out reflect.Value) (good bool) { +func (d *decoder) scalar(n *node, out reflect.Value) bool { var tag string var resolved interface{} if n.tag == "" && !n.implicit { @@ -353,9 +386,26 @@ func (d *decoder) scalar(n *node, out reflect.Value) (good bool) { } return true } - if s, ok := resolved.(string); ok && out.CanAddr() { - if u, ok := out.Addr().Interface().(encoding.TextUnmarshaler); ok { - err := u.UnmarshalText([]byte(s)) + if resolvedv := reflect.ValueOf(resolved); out.Type() == resolvedv.Type() { + // We've resolved to exactly the type we want, so use that. + out.Set(resolvedv) + return true + } + // Perhaps we can use the value as a TextUnmarshaler to + // set its value. + if out.CanAddr() { + u, ok := out.Addr().Interface().(encoding.TextUnmarshaler) + if ok { + var text []byte + if tag == yaml_BINARY_TAG { + text = []byte(resolved.(string)) + } else { + // We let any value be unmarshaled into TextUnmarshaler. + // That might be more lax than we'd like, but the + // TextUnmarshaler itself should bowl out any dubious values. + text = []byte(n.value) + } + err := u.UnmarshalText(text) if err != nil { fail(err) } @@ -366,46 +416,53 @@ func (d *decoder) scalar(n *node, out reflect.Value) (good bool) { case reflect.String: if tag == yaml_BINARY_TAG { out.SetString(resolved.(string)) - good = true - } else if resolved != nil { + return true + } + if resolved != nil { out.SetString(n.value) - good = true + return true } case reflect.Interface: if resolved == nil { out.Set(reflect.Zero(out.Type())) + } else if tag == yaml_TIMESTAMP_TAG { + // It looks like a timestamp but for backward compatibility + // reasons we set it as a string, so that code that unmarshals + // timestamp-like values into interface{} will continue to + // see a string and not a time.Time. + out.Set(reflect.ValueOf(n.value)) } else { out.Set(reflect.ValueOf(resolved)) } - good = true + return true case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: switch resolved := resolved.(type) { case int: if !out.OverflowInt(int64(resolved)) { out.SetInt(int64(resolved)) - good = true + return true } case int64: if !out.OverflowInt(resolved) { out.SetInt(resolved) - good = true + return true } case uint64: if resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) { out.SetInt(int64(resolved)) - good = true + return true } case float64: if resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) { out.SetInt(int64(resolved)) - good = true + return true } case string: if out.Type() == durationType { d, err := time.ParseDuration(resolved) if err == nil { out.SetInt(int64(d)) - good = true + return true } } } @@ -414,44 +471,49 @@ func (d *decoder) scalar(n *node, out reflect.Value) (good bool) { case int: if resolved >= 0 && !out.OverflowUint(uint64(resolved)) { out.SetUint(uint64(resolved)) - good = true + return true } case int64: if resolved >= 0 && !out.OverflowUint(uint64(resolved)) { out.SetUint(uint64(resolved)) - good = true + return true } case uint64: if !out.OverflowUint(uint64(resolved)) { out.SetUint(uint64(resolved)) - good = true + return true } case float64: if resolved <= math.MaxUint64 && !out.OverflowUint(uint64(resolved)) { out.SetUint(uint64(resolved)) - good = true + return true } } case reflect.Bool: switch resolved := resolved.(type) { case bool: out.SetBool(resolved) - good = true + return true } case reflect.Float32, reflect.Float64: switch resolved := resolved.(type) { case int: out.SetFloat(float64(resolved)) - good = true + return true case int64: out.SetFloat(float64(resolved)) - good = true + return true case uint64: out.SetFloat(float64(resolved)) - good = true + return true case float64: out.SetFloat(resolved) - good = true + return true + } + case reflect.Struct: + if resolvedv := reflect.ValueOf(resolved); out.Type() == resolvedv.Type() { + out.Set(resolvedv) + return true } case reflect.Ptr: if out.Type().Elem() == reflect.TypeOf(resolved) { @@ -459,13 +521,11 @@ func (d *decoder) scalar(n *node, out reflect.Value) (good bool) { elem := reflect.New(out.Type().Elem()) elem.Elem().Set(reflect.ValueOf(resolved)) out.Set(elem) - good = true + return true } } - if !good { - d.terror(n, tag, out) - } - return good + d.terror(n, tag, out) + return false } func settableValueOf(i interface{}) reflect.Value { @@ -561,7 +621,7 @@ func (d *decoder) mapping(n *node, out reflect.Value) (good bool) { } e := reflect.New(et).Elem() if d.unmarshal(n.children[i+1], e) { - out.SetMapIndex(k, e) + d.setMapIndex(n.children[i+1], out, k, e) } } } @@ -569,6 +629,14 @@ func (d *decoder) mapping(n *node, out reflect.Value) (good bool) { return true } +func (d *decoder) setMapIndex(n *node, out, k, v reflect.Value) { + if d.strict && out.MapIndex(k) != zeroValue { + d.terrors = append(d.terrors, fmt.Sprintf("line %d: key %#v already set in map", n.line+1, k.Interface())) + return + } + out.SetMapIndex(k, v) +} + func (d *decoder) mappingSlice(n *node, out reflect.Value) (good bool) { outt := out.Type() if outt.Elem() != mapItemType { @@ -616,6 +684,10 @@ func (d *decoder) mappingStruct(n *node, out reflect.Value) (good bool) { elemType = inlineMap.Type().Elem() } + var doneFields []bool + if d.strict { + doneFields = make([]bool, len(sinfo.FieldsList)) + } for i := 0; i < l; i += 2 { ni := n.children[i] if isMerge(ni) { @@ -626,6 +698,13 @@ func (d *decoder) mappingStruct(n *node, out reflect.Value) (good bool) { continue } if info, ok := sinfo.FieldsMap[name.String()]; ok { + if d.strict { + if doneFields[info.Id] { + d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s already set in type %s", ni.line+1, name.String(), out.Type())) + continue + } + doneFields[info.Id] = true + } var field reflect.Value if info.Inline == nil { field = out.Field(info.Num) @@ -639,9 +718,9 @@ func (d *decoder) mappingStruct(n *node, out reflect.Value) (good bool) { } value := reflect.New(elemType).Elem() d.unmarshal(n.children[i+1], value) - inlineMap.SetMapIndex(name, value) + d.setMapIndex(n.children[i+1], inlineMap, name, value) } else if d.strict { - d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s not found in struct %s", ni.line+1, name.String(), out.Type())) + d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s not found in type %s", ni.line+1, name.String(), out.Type())) } } return true diff --git a/vendor/gopkg.in/yaml.v2/decode_test.go b/vendor/gopkg.in/yaml.v2/decode_test.go index e5366c261..7e1e8b336 100644 --- a/vendor/gopkg.in/yaml.v2/decode_test.go +++ b/vendor/gopkg.in/yaml.v2/decode_test.go @@ -2,13 +2,14 @@ package yaml_test import ( "errors" - . "gopkg.in/check.v1" - "gopkg.in/yaml.v2" + "io" "math" - "net" "reflect" "strings" "time" + + . "gopkg.in/check.v1" + "gopkg.in/yaml.v2" ) var unmarshalIntTest = 123 @@ -19,8 +20,9 @@ var unmarshalTests = []struct { }{ { "", - &struct{}{}, - }, { + (*struct{})(nil), + }, + { "{}", &struct{}{}, }, { "v: hi", @@ -425,13 +427,6 @@ var unmarshalTests = []struct { }, { "a: &a [1, 2]\nb: *a", &struct{ B []int }{[]int{1, 2}}, - }, { - "b: *a\na: &a {c: 1}", - &struct { - A, B struct { - C int - } - }{struct{ C int }{1}, struct{ C int }{1}}, }, // Bug #1133337 @@ -517,6 +512,18 @@ var unmarshalTests = []struct { map[string]interface{}{"a": "50cent_of_dollar"}, }, + // issue #295 (allow scalars with colons in flow mappings and sequences) + { + "a: {b: https://github.com/go-yaml/yaml}", + map[string]interface{}{"a": map[interface{}]interface{}{ + "b": "https://github.com/go-yaml/yaml", + }}, + }, + { + "a: [https://github.com/go-yaml/yaml]", + map[string]interface{}{"a": []interface{}{"https://github.com/go-yaml/yaml"}}, + }, + // Duration { "a: 3s", @@ -568,11 +575,80 @@ var unmarshalTests = []struct { // Support encoding.TextUnmarshaler. { "a: 1.2.3.4\n", - map[string]net.IP{"a": net.IPv4(1, 2, 3, 4)}, + map[string]textUnmarshaler{"a": textUnmarshaler{S: "1.2.3.4"}}, }, { "a: 2015-02-24T18:19:39Z\n", - map[string]time.Time{"a": time.Unix(1424801979, 0).In(time.UTC)}, + map[string]textUnmarshaler{"a": textUnmarshaler{"2015-02-24T18:19:39Z"}}, + }, + + // Timestamps + { + // Date only. + "a: 2015-01-01\n", + map[string]time.Time{"a": time.Date(2015, 1, 1, 0, 0, 0, 0, time.UTC)}, + }, + { + // RFC3339 + "a: 2015-02-24T18:19:39.12Z\n", + map[string]time.Time{"a": time.Date(2015, 2, 24, 18, 19, 39, .12e9, time.UTC)}, + }, + { + // RFC3339 with short dates. + "a: 2015-2-3T3:4:5Z", + map[string]time.Time{"a": time.Date(2015, 2, 3, 3, 4, 5, 0, time.UTC)}, + }, + { + // ISO8601 lower case t + "a: 2015-02-24t18:19:39Z\n", + map[string]time.Time{"a": time.Date(2015, 2, 24, 18, 19, 39, 0, time.UTC)}, + }, + { + // space separate, no time zone + "a: 2015-02-24 18:19:39\n", + map[string]time.Time{"a": time.Date(2015, 2, 24, 18, 19, 39, 0, time.UTC)}, + }, + // Some cases not currently handled. Uncomment these when + // the code is fixed. + // { + // // space separated with time zone + // "a: 2001-12-14 21:59:43.10 -5", + // map[string]interface{}{"a": time.Date(2001, 12, 14, 21, 59, 43, .1e9, time.UTC)}, + // }, + // { + // // arbitrary whitespace between fields + // "a: 2001-12-14 \t\t \t21:59:43.10 \t Z", + // map[string]interface{}{"a": time.Date(2001, 12, 14, 21, 59, 43, .1e9, time.UTC)}, + // }, + { + // explicit string tag + "a: !!str 2015-01-01", + map[string]interface{}{"a": "2015-01-01"}, + }, + { + // explicit timestamp tag on quoted string + "a: !!timestamp \"2015-01-01\"", + map[string]time.Time{"a": time.Date(2015, 1, 1, 0, 0, 0, 0, time.UTC)}, + }, + { + // explicit timestamp tag on unquoted string + "a: !!timestamp 2015-01-01", + map[string]time.Time{"a": time.Date(2015, 1, 1, 0, 0, 0, 0, time.UTC)}, + }, + { + // quoted string that's a valid timestamp + "a: \"2015-01-01\"", + map[string]interface{}{"a": "2015-01-01"}, + }, + { + // explicit timestamp tag into interface. + "a: !!timestamp \"2015-01-01\"", + map[string]interface{}{"a": "2015-01-01"}, + }, + { + // implicit timestamp tag into interface. + "a: 2015-01-01", + map[string]interface{}{"a": "2015-01-01"}, }, // Encode empty lists as zero-length slices. @@ -611,6 +687,21 @@ var unmarshalTests = []struct { "a: 123456E1\n", M{"a": "123456E1"}, }, + // yaml-test-suite 3GZX: Spec Example 7.1. Alias Nodes + { + "First occurrence: &anchor Foo\nSecond occurrence: *anchor\nOverride anchor: &anchor Bar\nReuse anchor: *anchor\n", + map[interface{}]interface{}{ + "Reuse anchor": "Bar", + "First occurrence": "Foo", + "Second occurrence": "Foo", + "Override anchor": "Bar", + }, + }, + // Single document with garbage following it. + { + "---\nhello\n...\n}not yaml", + "hello", + }, } type M map[interface{}]interface{} @@ -628,29 +719,87 @@ func (s *S) TestUnmarshal(c *C) { for i, item := range unmarshalTests { c.Logf("test %d: %q", i, item.data) t := reflect.ValueOf(item.value).Type() - var value interface{} - switch t.Kind() { - case reflect.Map: - value = reflect.MakeMap(t).Interface() - case reflect.String: - value = reflect.New(t).Interface() - case reflect.Ptr: - value = reflect.New(t.Elem()).Interface() - default: - c.Fatalf("missing case for %s", t) + value := reflect.New(t) + err := yaml.Unmarshal([]byte(item.data), value.Interface()) + if _, ok := err.(*yaml.TypeError); !ok { + c.Assert(err, IsNil) + } + c.Assert(value.Elem().Interface(), DeepEquals, item.value, Commentf("error: %v", err)) + } +} + +func (s *S) TestDecoderSingleDocument(c *C) { + // Test that Decoder.Decode works as expected on + // all the unmarshal tests. + for i, item := range unmarshalTests { + c.Logf("test %d: %q", i, item.data) + if item.data == "" { + // Behaviour differs when there's no YAML. + continue } - err := yaml.Unmarshal([]byte(item.data), value) + t := reflect.ValueOf(item.value).Type() + value := reflect.New(t) + err := yaml.NewDecoder(strings.NewReader(item.data)).Decode(value.Interface()) if _, ok := err.(*yaml.TypeError); !ok { c.Assert(err, IsNil) } - if t.Kind() == reflect.String { - c.Assert(*value.(*string), Equals, item.value) - } else { - c.Assert(value, DeepEquals, item.value) + c.Assert(value.Elem().Interface(), DeepEquals, item.value) + } +} + +var decoderTests = []struct { + data string + values []interface{} +}{{ + "", + nil, +}, { + "a: b", + []interface{}{ + map[interface{}]interface{}{"a": "b"}, + }, +}, { + "---\na: b\n...\n", + []interface{}{ + map[interface{}]interface{}{"a": "b"}, + }, +}, { + "---\n'hello'\n...\n---\ngoodbye\n...\n", + []interface{}{ + "hello", + "goodbye", + }, +}} + +func (s *S) TestDecoder(c *C) { + for i, item := range decoderTests { + c.Logf("test %d: %q", i, item.data) + var values []interface{} + dec := yaml.NewDecoder(strings.NewReader(item.data)) + for { + var value interface{} + err := dec.Decode(&value) + if err == io.EOF { + break + } + c.Assert(err, IsNil) + values = append(values, value) } + c.Assert(values, DeepEquals, item.values) } } +type errReader struct{} + +func (errReader) Read([]byte) (int, error) { + return 0, errors.New("some read error") +} + +func (s *S) TestDecoderReadError(c *C) { + err := yaml.NewDecoder(errReader{}).Decode(&struct{}{}) + c.Assert(err, ErrorMatches, `yaml: input error: some read error`) +} + func (s *S) TestUnmarshalNaN(c *C) { value := map[string]interface{}{} err := yaml.Unmarshal([]byte("notanum: .NaN"), &value) @@ -670,17 +819,27 @@ var unmarshalErrorTests = []struct { {"a: !!binary ==", "yaml: !!binary value contains invalid base64 data"}, {"{[.]}", `yaml: invalid map key: \[\]interface \{\}\{"\."\}`}, {"{{.}}", `yaml: invalid map key: map\[interface\ \{\}\]interface \{\}\{".":interface \{\}\(nil\)\}`}, + {"b: *a\na: &a {c: 1}", `yaml: unknown anchor 'a' referenced`}, {"%TAG !%79! tag:yaml.org,2002:\n---\nv: !%79!int '1'", "yaml: did not find expected whitespace"}, } func (s *S) TestUnmarshalErrors(c *C) { - for _, item := range unmarshalErrorTests { + for i, item := range unmarshalErrorTests { + c.Logf("test %d: %q", i, item.data) var value interface{} err := yaml.Unmarshal([]byte(item.data), &value) c.Assert(err, ErrorMatches, item.error, Commentf("Partial unmarshal: %#v", value)) } } +func (s *S) TestDecoderErrors(c *C) { + for _, item := range unmarshalErrorTests { + var value interface{} + err := yaml.NewDecoder(strings.NewReader(item.data)).Decode(&value) + c.Assert(err, ErrorMatches, item.error, Commentf("Partial unmarshal: %#v", value)) + } +} + var unmarshalerTests = []struct { data, tag string value interface{} @@ -991,15 +1150,96 @@ func (s *S) TestUnmarshalSliceOnPreset(c *C) { c.Assert(v.A, DeepEquals, []int{2}) } +var unmarshalStrictTests = []struct { + data string + value interface{} + error string +}{{ + data: "a: 1\nc: 2\n", + value: struct{ A, B int }{A: 1}, + error: `yaml: unmarshal errors:\n line 2: field c not found in type struct { A int; B int }`, +}, { + data: "a: 1\nb: 2\na: 3\n", + value: struct{ A, B int }{A: 3, B: 2}, + error: `yaml: unmarshal errors:\n line 3: field a already set in type struct { A int; B int }`, +}, { + data: "c: 3\na: 1\nb: 2\nc: 4\n", + value: struct { + A int + inlineB `yaml:",inline"` + }{ + A: 1, + inlineB: inlineB{ + B: 2, + inlineC: inlineC{ + C: 4, + }, + }, + }, + error: `yaml: unmarshal errors:\n line 4: field c already set in type struct { A int; yaml_test.inlineB "yaml:\\",inline\\"" }`, +}, { + data: "c: 0\na: 1\nb: 2\nc: 1\n", + value: struct { + A int + inlineB `yaml:",inline"` + }{ + A: 1, + inlineB: inlineB{ + B: 2, + inlineC: inlineC{ + C: 1, + }, + }, + }, + error: `yaml: unmarshal errors:\n line 4: field c already set in type struct { A int; yaml_test.inlineB "yaml:\\",inline\\"" }`, +}, { + data: "c: 1\na: 1\nb: 2\nc: 3\n", + value: struct { + A int + M map[string]interface{} `yaml:",inline"` + }{ + A: 1, + M: map[string]interface{}{ + "b": 2, + "c": 3, + }, + }, + error: `yaml: unmarshal errors:\n line 4: key "c" already set in map`, +}, { + data: "a: 1\n9: 2\nnull: 3\n9: 4", + value: map[interface{}]interface{}{ + "a": 1, + nil: 3, + 9: 4, + }, + error: `yaml: unmarshal errors:\n line 4: key 9 already set in map`, +}} + func (s *S) TestUnmarshalStrict(c *C) { - v := struct{ A, B int }{} - - err := yaml.UnmarshalStrict([]byte("a: 1\nb: 2"), &v) - c.Check(err, IsNil) - err = yaml.Unmarshal([]byte("a: 1\nb: 2\nc: 3"), &v) - c.Check(err, IsNil) - err = yaml.UnmarshalStrict([]byte("a: 1\nb: 2\nc: 3"), &v) - c.Check(err, ErrorMatches, "yaml: unmarshal errors:\n line 3: field c not found in struct struct { A int; B int }") + for i, item := range unmarshalStrictTests { + c.Logf("test %d: %q", i, item.data) + // First test that normal Unmarshal unmarshals to the expected value. + t := reflect.ValueOf(item.value).Type() + value := reflect.New(t) + err := yaml.Unmarshal([]byte(item.data), value.Interface()) + c.Assert(err, Equals, nil) + c.Assert(value.Elem().Interface(), DeepEquals, item.value) + + // Then test that UnmarshalStrict fails on the same thing. + t = reflect.ValueOf(item.value).Type() + value = reflect.New(t) + err = yaml.UnmarshalStrict([]byte(item.data), value.Interface()) + c.Assert(err, ErrorMatches, item.error) + } +} + +type textUnmarshaler struct { + S string +} + +func (t *textUnmarshaler) UnmarshalText(s []byte) error { + t.S = string(s) + return nil } //var data []byte diff --git a/vendor/gopkg.in/yaml.v2/emitterc.go b/vendor/gopkg.in/yaml.v2/emitterc.go index dcaf502f0..cf0db118a 100644 --- a/vendor/gopkg.in/yaml.v2/emitterc.go +++ b/vendor/gopkg.in/yaml.v2/emitterc.go @@ -2,6 +2,7 @@ package yaml import ( "bytes" + "fmt" ) // Flush the buffer if needed. @@ -664,7 +665,7 @@ func yaml_emitter_emit_node(emitter *yaml_emitter_t, event *yaml_event_t, return yaml_emitter_emit_mapping_start(emitter, event) default: return yaml_emitter_set_emitter_error(emitter, - "expected SCALAR, SEQUENCE-START, MAPPING-START, or ALIAS") + fmt.Sprintf("expected SCALAR, SEQUENCE-START, MAPPING-START, or ALIAS, but got %v", event.typ)) } } diff --git a/vendor/gopkg.in/yaml.v2/encode.go b/vendor/gopkg.in/yaml.v2/encode.go index 84f849955..1e730eff6 100644 --- a/vendor/gopkg.in/yaml.v2/encode.go +++ b/vendor/gopkg.in/yaml.v2/encode.go @@ -3,12 +3,14 @@ package yaml import ( "encoding" "fmt" + "io" "reflect" "regexp" "sort" "strconv" "strings" "time" + "unicode/utf8" ) type encoder struct { @@ -16,25 +18,39 @@ type encoder struct { event yaml_event_t out []byte flow bool + // doneInit holds whether the initial stream_start_event has been + // emitted. + doneInit bool } -func newEncoder() (e *encoder) { - e = &encoder{} - e.must(yaml_emitter_initialize(&e.emitter)) +func newEncoder() *encoder { + e := &encoder{} + yaml_emitter_initialize(&e.emitter) yaml_emitter_set_output_string(&e.emitter, &e.out) yaml_emitter_set_unicode(&e.emitter, true) - e.must(yaml_stream_start_event_initialize(&e.event, yaml_UTF8_ENCODING)) - e.emit() - e.must(yaml_document_start_event_initialize(&e.event, nil, nil, true)) - e.emit() return e } -func (e *encoder) finish() { - e.must(yaml_document_end_event_initialize(&e.event, true)) +func newEncoderWithWriter(w io.Writer) *encoder { + e := &encoder{} + yaml_emitter_initialize(&e.emitter) + yaml_emitter_set_output_writer(&e.emitter, w) + yaml_emitter_set_unicode(&e.emitter, true) + return e +} + +func (e *encoder) init() { + if e.doneInit { + return + } + yaml_stream_start_event_initialize(&e.event, yaml_UTF8_ENCODING) e.emit() + e.doneInit = true +} + +func (e *encoder) finish() { e.emitter.open_ended = false - e.must(yaml_stream_end_event_initialize(&e.event)) + yaml_stream_end_event_initialize(&e.event) e.emit() } @@ -44,9 +60,7 @@ func (e *encoder) destroy() { func (e *encoder) emit() { // This will internally delete the e.event value. - if !yaml_emitter_emit(&e.emitter, &e.event) && e.event.typ != yaml_DOCUMENT_END_EVENT && e.event.typ != yaml_STREAM_END_EVENT { - e.must(false) - } + e.must(yaml_emitter_emit(&e.emitter, &e.event)) } func (e *encoder) must(ok bool) { @@ -59,13 +73,28 @@ func (e *encoder) must(ok bool) { } } +func (e *encoder) marshalDoc(tag string, in reflect.Value) { + e.init() + yaml_document_start_event_initialize(&e.event, nil, nil, true) + e.emit() + e.marshal(tag, in) + yaml_document_end_event_initialize(&e.event, true) + e.emit() +} + func (e *encoder) marshal(tag string, in reflect.Value) { - if !in.IsValid() { + if !in.IsValid() || in.Kind() == reflect.Ptr && in.IsNil() { e.nilv() return } iface := in.Interface() - if m, ok := iface.(Marshaler); ok { + switch m := iface.(type) { + case time.Time, *time.Time: + // Although time.Time implements TextMarshaler, + // we don't want to treat it as a string for YAML + // purposes because YAML has special support for + // timestamps. + case Marshaler: v, err := m.MarshalYAML() if err != nil { fail(err) @@ -75,30 +104,33 @@ func (e *encoder) marshal(tag string, in reflect.Value) { return } in = reflect.ValueOf(v) - } else if m, ok := iface.(encoding.TextMarshaler); ok { + case encoding.TextMarshaler: text, err := m.MarshalText() if err != nil { fail(err) } in = reflect.ValueOf(string(text)) + case nil: + e.nilv() + return } switch in.Kind() { case reflect.Interface: - if in.IsNil() { - e.nilv() - } else { - e.marshal(tag, in.Elem()) - } + e.marshal(tag, in.Elem()) case reflect.Map: e.mapv(tag, in) case reflect.Ptr: - if in.IsNil() { - e.nilv() + if in.Type() == ptrTimeType { + e.timev(tag, in.Elem()) } else { e.marshal(tag, in.Elem()) } case reflect.Struct: - e.structv(tag, in) + if in.Type() == timeType { + e.timev(tag, in) + } else { + e.structv(tag, in) + } case reflect.Slice: if in.Type().Elem() == mapItemType { e.itemsv(tag, in) @@ -191,10 +223,10 @@ func (e *encoder) mappingv(tag string, f func()) { e.flow = false style = yaml_FLOW_MAPPING_STYLE } - e.must(yaml_mapping_start_event_initialize(&e.event, nil, []byte(tag), implicit, style)) + yaml_mapping_start_event_initialize(&e.event, nil, []byte(tag), implicit, style) e.emit() f() - e.must(yaml_mapping_end_event_initialize(&e.event)) + yaml_mapping_end_event_initialize(&e.event) e.emit() } @@ -240,23 +272,36 @@ var base60float = regexp.MustCompile(`^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+(?:\.[0 func (e *encoder) stringv(tag string, in reflect.Value) { var style yaml_scalar_style_t s := in.String() - rtag, rs := resolve("", s) - if rtag == yaml_BINARY_TAG { - if tag == "" || tag == yaml_STR_TAG { - tag = rtag - s = rs.(string) - } else if tag == yaml_BINARY_TAG { + canUsePlain := true + switch { + case !utf8.ValidString(s): + if tag == yaml_BINARY_TAG { failf("explicitly tagged !!binary data must be base64-encoded") - } else { + } + if tag != "" { failf("cannot marshal invalid UTF-8 data as %s", shortTag(tag)) } + // It can't be encoded directly as YAML so use a binary tag + // and encode it as base64. + tag = yaml_BINARY_TAG + s = encodeBase64(s) + case tag == "": + // Check to see if it would resolve to a specific + // tag when encoded unquoted. If it doesn't, + // there's no need to quote it. + rtag, _ := resolve("", s) + canUsePlain = rtag == yaml_STR_TAG && !isBase60Float(s) } - if tag == "" && (rtag != yaml_STR_TAG || isBase60Float(s)) { - style = yaml_DOUBLE_QUOTED_SCALAR_STYLE - } else if strings.Contains(s, "\n") { + // Note: it's possible for user code to emit invalid YAML + // if they explicitly specify a tag and a string containing + // text that's incompatible with that tag. + switch { + case strings.Contains(s, "\n"): style = yaml_LITERAL_SCALAR_STYLE - } else { + case canUsePlain: style = yaml_PLAIN_SCALAR_STYLE + default: + style = yaml_DOUBLE_QUOTED_SCALAR_STYLE } e.emitScalar(s, "", tag, style) } @@ -281,9 +326,16 @@ func (e *encoder) uintv(tag string, in reflect.Value) { e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) } +func (e *encoder) timev(tag string, in reflect.Value) { + t := in.Interface().(time.Time) + if tag == "" { + tag = yaml_TIMESTAMP_TAG + } + e.emitScalar(t.Format(time.RFC3339Nano), "", tag, yaml_PLAIN_SCALAR_STYLE) +} + func (e *encoder) floatv(tag string, in reflect.Value) { - // FIXME: Handle 64 bits here. - s := strconv.FormatFloat(float64(in.Float()), 'g', -1, 32) + s := strconv.FormatFloat(in.Float(), 'g', -1, 64) switch s { case "+Inf": s = ".inf" diff --git a/vendor/gopkg.in/yaml.v2/encode_test.go b/vendor/gopkg.in/yaml.v2/encode_test.go index 84099bd38..2e7841146 100644 --- a/vendor/gopkg.in/yaml.v2/encode_test.go +++ b/vendor/gopkg.in/yaml.v2/encode_test.go @@ -1,16 +1,18 @@ package yaml_test import ( + "bytes" "fmt" "math" "strconv" "strings" "time" - . "gopkg.in/check.v1" - "gopkg.in/yaml.v2" "net" "os" + + . "gopkg.in/check.v1" + "gopkg.in/yaml.v2" ) var marshalIntTest = 123 @@ -22,6 +24,9 @@ var marshalTests = []struct { { nil, "null\n", + }, { + (*marshalerType)(nil), + "null\n", }, { &struct{}{}, "{}\n", @@ -197,6 +202,25 @@ var marshalTests = []struct { }{1, 0}, "a: 1\n", }, + { + &struct { + T1 time.Time "t1,omitempty" + T2 time.Time "t2,omitempty" + T3 *time.Time "t3,omitempty" + T4 *time.Time "t4,omitempty" + }{ + T2: time.Date(2018, 1, 9, 10, 40, 47, 0, time.UTC), + T4: newTime(time.Date(2098, 1, 9, 10, 40, 47, 0, time.UTC)), + }, + "t2: !!timestamp 2018-01-09T10:40:47Z\nt4: !!timestamp 2098-01-09T10:40:47Z\n", + }, + // Nil interface that implements Marshaler. + { + map[string]yaml.Marshaler{ + "a": nil, + }, + "a: null\n", + }, // Flow flag { @@ -302,9 +326,19 @@ var marshalTests = []struct { map[string]net.IP{"a": net.IPv4(1, 2, 3, 4)}, "a: 1.2.3.4\n", }, + // time.Time gets a timestamp tag. + { + map[string]time.Time{"a": time.Date(2015, 2, 24, 18, 19, 39, 0, time.UTC)}, + "a: !!timestamp 2015-02-24T18:19:39Z\n", + }, { - map[string]time.Time{"a": time.Unix(1424801979, 0)}, - "a: 2015-02-24T18:19:39Z\n", + map[string]*time.Time{"a": newTime(time.Date(2015, 2, 24, 18, 19, 39, 0, time.UTC))}, + "a: !!timestamp 2015-02-24T18:19:39Z\n", + }, + // Ensure timestamp-like strings are quoted. + { + map[string]string{"a": "2015-02-24T18:19:39Z"}, + "a: \"2015-02-24T18:19:39Z\"\n", }, // Ensure strings containing ": " are quoted (reported as PR #43, but not reproducible). @@ -327,13 +361,51 @@ var marshalTests = []struct { func (s *S) TestMarshal(c *C) { defer os.Setenv("TZ", os.Getenv("TZ")) os.Setenv("TZ", "UTC") - for _, item := range marshalTests { + for i, item := range marshalTests { + c.Logf("test %d: %q", i, item.data) data, err := yaml.Marshal(item.value) c.Assert(err, IsNil) c.Assert(string(data), Equals, item.data) } } +func (s *S) TestEncoderSingleDocument(c *C) { + for i, item := range marshalTests { + c.Logf("test %d. %q", i, item.data) + var buf bytes.Buffer + enc := yaml.NewEncoder(&buf) + err := enc.Encode(item.value) + c.Assert(err, Equals, nil) + err = enc.Close() + c.Assert(err, Equals, nil) + c.Assert(buf.String(), Equals, item.data) + } +} + +func (s *S) TestEncoderMultipleDocuments(c *C) { + var buf bytes.Buffer + enc := yaml.NewEncoder(&buf) + err := enc.Encode(map[string]string{"a": "b"}) + c.Assert(err, Equals, nil) + err = enc.Encode(map[string]string{"c": "d"}) + c.Assert(err, Equals, nil) + err = enc.Close() + c.Assert(err, Equals, nil) + c.Assert(buf.String(), Equals, "a: b\n---\nc: d\n") +} + +func (s *S) TestEncoderWriteError(c *C) { + enc := yaml.NewEncoder(errorWriter{}) + err := enc.Encode(map[string]string{"a": "b"}) + c.Assert(err, ErrorMatches, `yaml: write error: some write error`) // Data not flushed yet +} + +type errorWriter struct{} + +func (errorWriter) Write([]byte) (int, error) { + return 0, fmt.Errorf("some write error") +} + var marshalErrorTests = []struct { value interface{} error string @@ -499,3 +571,7 @@ func (s *S) TestSortedOutput(c *C) { last = index } } + +func newTime(t time.Time) *time.Time { + return &t +} diff --git a/vendor/gopkg.in/yaml.v2/go.mod b/vendor/gopkg.in/yaml.v2/go.mod new file mode 100644 index 000000000..1934e8769 --- /dev/null +++ b/vendor/gopkg.in/yaml.v2/go.mod @@ -0,0 +1,5 @@ +module "gopkg.in/yaml.v2" + +require ( + "gopkg.in/check.v1" v0.0.0-20161208181325-20d25e280405 +) diff --git a/vendor/gopkg.in/yaml.v2/resolve.go b/vendor/gopkg.in/yaml.v2/resolve.go index 232313cc0..ea90bd5e0 100644 --- a/vendor/gopkg.in/yaml.v2/resolve.go +++ b/vendor/gopkg.in/yaml.v2/resolve.go @@ -6,7 +6,7 @@ import ( "regexp" "strconv" "strings" - "unicode/utf8" + "time" ) type resolveMapItem struct { @@ -75,7 +75,7 @@ func longTag(tag string) string { func resolvableTag(tag string) bool { switch tag { - case "", yaml_STR_TAG, yaml_BOOL_TAG, yaml_INT_TAG, yaml_FLOAT_TAG, yaml_NULL_TAG: + case "", yaml_STR_TAG, yaml_BOOL_TAG, yaml_INT_TAG, yaml_FLOAT_TAG, yaml_NULL_TAG, yaml_TIMESTAMP_TAG: return true } return false @@ -125,6 +125,15 @@ func resolve(tag string, in string) (rtag string, out interface{}) { case 'D', 'S': // Int, float, or timestamp. + // Only try values as a timestamp if the value is unquoted or there's an explicit + // !!timestamp tag. + if tag == "" || tag == yaml_TIMESTAMP_TAG { + t, ok := parseTimestamp(in) + if ok { + return yaml_TIMESTAMP_TAG, t + } + } + plain := strings.Replace(in, "_", "", -1) intv, err := strconv.ParseInt(plain, 0, 64) if err == nil { @@ -167,19 +176,11 @@ func resolve(tag string, in string) (rtag string, out interface{}) { } } } - // XXX Handle timestamps here. - default: panic("resolveTable item not yet handled: " + string(rune(hint)) + " (with " + in + ")") } } - if tag == yaml_BINARY_TAG { - return yaml_BINARY_TAG, in - } - if utf8.ValidString(in) { - return yaml_STR_TAG, in - } - return yaml_BINARY_TAG, encodeBase64(in) + return yaml_STR_TAG, in } // encodeBase64 encodes s as base64 that is broken up into multiple lines @@ -206,3 +207,39 @@ func encodeBase64(s string) string { } return string(out[:k]) } + +// This is a subset of the formats allowed by the regular expression +// defined at http://yaml.org/type/timestamp.html. +var allowedTimestampFormats = []string{ + "2006-1-2T15:4:5Z07:00", + "2006-1-2t15:4:5Z07:00", // RFC3339 with lower-case "t". + "2006-1-2 15:4:5", // space separated with no time zone + "2006-1-2", // date only + // Notable exception: time.Parse cannot handle: "2001-12-14 21:59:43.10 -5" + // from the set of examples. +} + +// parseTimestamp parses s as a timestamp string and +// returns the timestamp and reports whether it succeeded. +// Timestamp formats are defined at http://yaml.org/type/timestamp.html +func parseTimestamp(s string) (time.Time, bool) { + // TODO write code to check all the formats supported by + // http://yaml.org/type/timestamp.html instead of using time.Parse. + + // Quick check: all date formats start with YYYY-. + i := 0 + for ; i < len(s); i++ { + if c := s[i]; c < '0' || c > '9' { + break + } + } + if i != 4 || i == len(s) || s[i] != '-' { + return time.Time{}, false + } + for _, format := range allowedTimestampFormats { + if t, err := time.Parse(format, s); err == nil { + return t, true + } + } + return time.Time{}, false +} diff --git a/vendor/gopkg.in/yaml.v2/scannerc.go b/vendor/gopkg.in/yaml.v2/scannerc.go index 074484455..492a9845d 100644 --- a/vendor/gopkg.in/yaml.v2/scannerc.go +++ b/vendor/gopkg.in/yaml.v2/scannerc.go @@ -2592,19 +2592,10 @@ func yaml_parser_scan_plain_scalar(parser *yaml_parser_t, token *yaml_token_t) b // Consume non-blank characters. for !is_blankz(parser.buffer, parser.buffer_pos) { - // Check for 'x:x' in the flow context. TODO: Fix the test "spec-08-13". - if parser.flow_level > 0 && - parser.buffer[parser.buffer_pos] == ':' && - !is_blankz(parser.buffer, parser.buffer_pos+1) { - yaml_parser_set_scanner_error(parser, "while scanning a plain scalar", - start_mark, "found unexpected ':'") - return false - } - // Check for indicators that may end a plain scalar. if (parser.buffer[parser.buffer_pos] == ':' && is_blankz(parser.buffer, parser.buffer_pos+1)) || (parser.flow_level > 0 && - (parser.buffer[parser.buffer_pos] == ',' || parser.buffer[parser.buffer_pos] == ':' || + (parser.buffer[parser.buffer_pos] == ',' || parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == '[' || parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '{' || parser.buffer[parser.buffer_pos] == '}')) { diff --git a/vendor/gopkg.in/yaml.v2/writerc.go b/vendor/gopkg.in/yaml.v2/writerc.go index 190362f25..a2dde608c 100644 --- a/vendor/gopkg.in/yaml.v2/writerc.go +++ b/vendor/gopkg.in/yaml.v2/writerc.go @@ -18,72 +18,9 @@ func yaml_emitter_flush(emitter *yaml_emitter_t) bool { return true } - // If the output encoding is UTF-8, we don't need to recode the buffer. - if emitter.encoding == yaml_UTF8_ENCODING { - if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil { - return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) - } - emitter.buffer_pos = 0 - return true - } - - // Recode the buffer into the raw buffer. - var low, high int - if emitter.encoding == yaml_UTF16LE_ENCODING { - low, high = 0, 1 - } else { - high, low = 1, 0 - } - - pos := 0 - for pos < emitter.buffer_pos { - // See the "reader.c" code for more details on UTF-8 encoding. Note - // that we assume that the buffer contains a valid UTF-8 sequence. - - // Read the next UTF-8 character. - octet := emitter.buffer[pos] - - var w int - var value rune - switch { - case octet&0x80 == 0x00: - w, value = 1, rune(octet&0x7F) - case octet&0xE0 == 0xC0: - w, value = 2, rune(octet&0x1F) - case octet&0xF0 == 0xE0: - w, value = 3, rune(octet&0x0F) - case octet&0xF8 == 0xF0: - w, value = 4, rune(octet&0x07) - } - for k := 1; k < w; k++ { - octet = emitter.buffer[pos+k] - value = (value << 6) + (rune(octet) & 0x3F) - } - pos += w - - // Write the character. - if value < 0x10000 { - var b [2]byte - b[high] = byte(value >> 8) - b[low] = byte(value & 0xFF) - emitter.raw_buffer = append(emitter.raw_buffer, b[0], b[1]) - } else { - // Write the character using a surrogate pair (check "reader.c"). - var b [4]byte - value -= 0x10000 - b[high] = byte(0xD8 + (value >> 18)) - b[low] = byte((value >> 10) & 0xFF) - b[high+2] = byte(0xDC + ((value >> 8) & 0xFF)) - b[low+2] = byte(value & 0xFF) - emitter.raw_buffer = append(emitter.raw_buffer, b[0], b[1], b[2], b[3]) - } - } - - // Write the raw buffer. - if err := emitter.write_handler(emitter, emitter.raw_buffer); err != nil { + if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil { return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) } emitter.buffer_pos = 0 - emitter.raw_buffer = emitter.raw_buffer[:0] return true } diff --git a/vendor/gopkg.in/yaml.v2/yaml.go b/vendor/gopkg.in/yaml.v2/yaml.go index 5e3c2daee..483aae587 100644 --- a/vendor/gopkg.in/yaml.v2/yaml.go +++ b/vendor/gopkg.in/yaml.v2/yaml.go @@ -9,6 +9,7 @@ package yaml import ( "errors" "fmt" + "io" "reflect" "strings" "sync" @@ -81,12 +82,58 @@ func Unmarshal(in []byte, out interface{}) (err error) { } // UnmarshalStrict is like Unmarshal except that any fields that are found -// in the data that do not have corresponding struct members will result in +// in the data that do not have corresponding struct members, or mapping +// keys that are duplicates, will result in // an error. func UnmarshalStrict(in []byte, out interface{}) (err error) { return unmarshal(in, out, true) } +// A Decorder reads and decodes YAML values from an input stream. +type Decoder struct { + strict bool + parser *parser +} + +// NewDecoder returns a new decoder that reads from r. +// +// The decoder introduces its own buffering and may read +// data from r beyond the YAML values requested. +func NewDecoder(r io.Reader) *Decoder { + return &Decoder{ + parser: newParserFromReader(r), + } +} + +// SetStrict sets whether strict decoding behaviour is enabled when +// decoding items in the data (see UnmarshalStrict). By default, decoding is not strict. +func (dec *Decoder) SetStrict(strict bool) { + dec.strict = strict +} + +// Decode reads the next YAML-encoded value from its input +// and stores it in the value pointed to by v. +// +// See the documentation for Unmarshal for details about the +// conversion of YAML into a Go value. +func (dec *Decoder) Decode(v interface{}) (err error) { + d := newDecoder(dec.strict) + defer handleErr(&err) + node := dec.parser.parse() + if node == nil { + return io.EOF + } + out := reflect.ValueOf(v) + if out.Kind() == reflect.Ptr && !out.IsNil() { + out = out.Elem() + } + d.unmarshal(node, out) + if len(d.terrors) > 0 { + return &TypeError{d.terrors} + } + return nil +} + func unmarshal(in []byte, out interface{}, strict bool) (err error) { defer handleErr(&err) d := newDecoder(strict) @@ -125,7 +172,10 @@ func unmarshal(in []byte, out interface{}, strict bool) (err error) { // // omitempty Only include the field if it's not set to the zero // value for the type or to empty slices or maps. -// Does not apply to zero valued structs. +// Zero valued structs will be omitted if all their public +// fields are zero, unless they implement an IsZero +// method (see the IsZeroer interface type), in which +// case the field will be included if that method returns true. // // flow Marshal using a flow style (useful for structs, // sequences and maps). @@ -150,12 +200,47 @@ func Marshal(in interface{}) (out []byte, err error) { defer handleErr(&err) e := newEncoder() defer e.destroy() - e.marshal("", reflect.ValueOf(in)) + e.marshalDoc("", reflect.ValueOf(in)) e.finish() out = e.out return } +// An Encoder writes YAML values to an output stream. +type Encoder struct { + encoder *encoder +} + +// NewEncoder returns a new encoder that writes to w. +// The Encoder should be closed after use to flush all data +// to w. +func NewEncoder(w io.Writer) *Encoder { + return &Encoder{ + encoder: newEncoderWithWriter(w), + } +} + +// Encode writes the YAML encoding of v to the stream. +// If multiple items are encoded to the stream, the +// second and subsequent document will be preceded +// with a "---" document separator, but the first will not. +// +// See the documentation for Marshal for details about the conversion of Go +// values to YAML. +func (e *Encoder) Encode(v interface{}) (err error) { + defer handleErr(&err) + e.encoder.marshalDoc("", reflect.ValueOf(v)) + return nil +} + +// Close closes the encoder by writing any remaining data. +// It does not write a stream terminating string "...". +func (e *Encoder) Close() (err error) { + defer handleErr(&err) + e.encoder.finish() + return nil +} + func handleErr(err *error) { if v := recover(); v != nil { if e, ok := v.(yamlError); ok { @@ -211,6 +296,9 @@ type fieldInfo struct { Num int OmitEmpty bool Flow bool + // Id holds the unique field identifier, so we can cheaply + // check for field duplicates without maintaining an extra map. + Id int // Inline holds the field index if the field is part of an inlined struct. Inline []int @@ -290,6 +378,7 @@ func getStructInfo(st reflect.Type) (*structInfo, error) { } else { finfo.Inline = append([]int{i}, finfo.Inline...) } + finfo.Id = len(fieldsList) fieldsMap[finfo.Key] = finfo fieldsList = append(fieldsList, finfo) } @@ -311,11 +400,16 @@ func getStructInfo(st reflect.Type) (*structInfo, error) { return nil, errors.New(msg) } + info.Id = len(fieldsList) fieldsList = append(fieldsList, info) fieldsMap[info.Key] = info } - sinfo = &structInfo{fieldsMap, fieldsList, inlineMap} + sinfo = &structInfo{ + FieldsMap: fieldsMap, + FieldsList: fieldsList, + InlineMap: inlineMap, + } fieldMapMutex.Lock() structMap[st] = sinfo @@ -323,8 +417,23 @@ func getStructInfo(st reflect.Type) (*structInfo, error) { return sinfo, nil } +// IsZeroer is used to check whether an object is zero to +// determine whether it should be omitted when marshaling +// with the omitempty flag. One notable implementation +// is time.Time. +type IsZeroer interface { + IsZero() bool +} + func isZero(v reflect.Value) bool { - switch v.Kind() { + kind := v.Kind() + if z, ok := v.Interface().(IsZeroer); ok { + if (kind == reflect.Ptr || kind == reflect.Interface) && v.IsNil() { + return true + } + return z.IsZero() + } + switch kind { case reflect.String: return len(v.String()) == 0 case reflect.Interface, reflect.Ptr: diff --git a/vendor/gopkg.in/yaml.v2/yamlh.go b/vendor/gopkg.in/yaml.v2/yamlh.go index 3caeca049..e25cee563 100644 --- a/vendor/gopkg.in/yaml.v2/yamlh.go +++ b/vendor/gopkg.in/yaml.v2/yamlh.go @@ -1,6 +1,7 @@ package yaml import ( + "fmt" "io" ) @@ -239,6 +240,27 @@ const ( yaml_MAPPING_END_EVENT // A MAPPING-END event. ) +var eventStrings = []string{ + yaml_NO_EVENT: "none", + yaml_STREAM_START_EVENT: "stream start", + yaml_STREAM_END_EVENT: "stream end", + yaml_DOCUMENT_START_EVENT: "document start", + yaml_DOCUMENT_END_EVENT: "document end", + yaml_ALIAS_EVENT: "alias", + yaml_SCALAR_EVENT: "scalar", + yaml_SEQUENCE_START_EVENT: "sequence start", + yaml_SEQUENCE_END_EVENT: "sequence end", + yaml_MAPPING_START_EVENT: "mapping start", + yaml_MAPPING_END_EVENT: "mapping end", +} + +func (e yaml_event_type_t) String() string { + if e < 0 || int(e) >= len(eventStrings) { + return fmt.Sprintf("unknown event %d", e) + } + return eventStrings[e] +} + // The event structure. type yaml_event_t struct { @@ -521,9 +543,9 @@ type yaml_parser_t struct { read_handler yaml_read_handler_t // Read handler. - input_file io.Reader // File input data. - input []byte // String input data. - input_pos int + input_reader io.Reader // File input data. + input []byte // String input data. + input_pos int eof bool // EOF flag @@ -632,7 +654,7 @@ type yaml_emitter_t struct { write_handler yaml_write_handler_t // Write handler. output_buffer *[]byte // String output data. - output_file io.Writer // File output data. + output_writer io.Writer // File output data. buffer []byte // The working buffer. buffer_pos int // The current position of the buffer. diff --git a/vendor/k8s.io/api/Godeps/Godeps.json b/vendor/k8s.io/api/Godeps/Godeps.json index 3cf524402..21f3babad 100644 --- a/vendor/k8s.io/api/Godeps/Godeps.json +++ b/vendor/k8s.io/api/Godeps/Godeps.json @@ -1,150 +1,170 @@ { - "ImportPath": "k8s.io/api", - "GoVersion": "go1.9", - "GodepVersion": "v79", - "Packages": [ - "./..." - ], - "Deps": [ - { - "ImportPath": "github.com/gogo/protobuf/proto", - "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" - }, - { - "ImportPath": "github.com/gogo/protobuf/sortkeys", - "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" - }, - { - "ImportPath": "github.com/golang/glog", - "Rev": "44145f04b68cf362d9c4df2182967c2275eaefed" - }, - { - "ImportPath": "github.com/google/gofuzz", - "Rev": "44d81051d367757e1c7c6a5a86423ece9afcf63c" - }, - { - "ImportPath": "github.com/spf13/pflag", - "Rev": "4c012f6dcd9546820e378d0bdda4d8fc772cdfea" - }, - { - "ImportPath": "golang.org/x/net/http2", - "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" - }, - { - "ImportPath": "golang.org/x/net/http2/hpack", - "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" - }, - { - "ImportPath": "golang.org/x/net/idna", - "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" - }, - { - "ImportPath": "golang.org/x/net/lex/httplex", - "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" - }, - { - "ImportPath": "golang.org/x/text/secure/bidirule", - "Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01" - }, - { - "ImportPath": "golang.org/x/text/transform", - "Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01" - }, - { - "ImportPath": "golang.org/x/text/unicode/bidi", - "Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01" - }, - { - "ImportPath": "golang.org/x/text/unicode/norm", - "Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01" - }, - { - "ImportPath": "gopkg.in/inf.v0", - "Rev": "3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4" - }, - { - "ImportPath": "k8s.io/apimachinery/pkg/api/resource", - "Rev": "4a62c19bf7bf4a3fdb2afb0b347553362d5c7684" - }, - { - "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1", - "Rev": "4a62c19bf7bf4a3fdb2afb0b347553362d5c7684" - }, - { - "ImportPath": "k8s.io/apimachinery/pkg/conversion", - "Rev": "4a62c19bf7bf4a3fdb2afb0b347553362d5c7684" - }, - { - "ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams", - "Rev": "4a62c19bf7bf4a3fdb2afb0b347553362d5c7684" - }, - { - "ImportPath": "k8s.io/apimachinery/pkg/fields", - "Rev": "4a62c19bf7bf4a3fdb2afb0b347553362d5c7684" - }, - { - "ImportPath": "k8s.io/apimachinery/pkg/labels", - "Rev": "4a62c19bf7bf4a3fdb2afb0b347553362d5c7684" - }, - { - "ImportPath": "k8s.io/apimachinery/pkg/runtime", - "Rev": "4a62c19bf7bf4a3fdb2afb0b347553362d5c7684" - }, - { - "ImportPath": "k8s.io/apimachinery/pkg/runtime/schema", - "Rev": "4a62c19bf7bf4a3fdb2afb0b347553362d5c7684" - }, - { - "ImportPath": "k8s.io/apimachinery/pkg/selection", - "Rev": "4a62c19bf7bf4a3fdb2afb0b347553362d5c7684" - }, - { - "ImportPath": "k8s.io/apimachinery/pkg/types", - "Rev": "4a62c19bf7bf4a3fdb2afb0b347553362d5c7684" - }, - { - "ImportPath": "k8s.io/apimachinery/pkg/util/errors", - "Rev": "4a62c19bf7bf4a3fdb2afb0b347553362d5c7684" - }, - { - "ImportPath": "k8s.io/apimachinery/pkg/util/intstr", - "Rev": "4a62c19bf7bf4a3fdb2afb0b347553362d5c7684" - }, - { - "ImportPath": "k8s.io/apimachinery/pkg/util/json", - "Rev": "4a62c19bf7bf4a3fdb2afb0b347553362d5c7684" - }, - { - "ImportPath": "k8s.io/apimachinery/pkg/util/net", - "Rev": "4a62c19bf7bf4a3fdb2afb0b347553362d5c7684" - }, - { - "ImportPath": "k8s.io/apimachinery/pkg/util/runtime", - "Rev": "4a62c19bf7bf4a3fdb2afb0b347553362d5c7684" - }, - { - "ImportPath": "k8s.io/apimachinery/pkg/util/sets", - "Rev": "4a62c19bf7bf4a3fdb2afb0b347553362d5c7684" - }, - { - "ImportPath": "k8s.io/apimachinery/pkg/util/validation", - "Rev": "4a62c19bf7bf4a3fdb2afb0b347553362d5c7684" - }, - { - "ImportPath": "k8s.io/apimachinery/pkg/util/validation/field", - "Rev": "4a62c19bf7bf4a3fdb2afb0b347553362d5c7684" - }, - { - "ImportPath": "k8s.io/apimachinery/pkg/util/wait", - "Rev": "4a62c19bf7bf4a3fdb2afb0b347553362d5c7684" - }, - { - "ImportPath": "k8s.io/apimachinery/pkg/watch", - "Rev": "4a62c19bf7bf4a3fdb2afb0b347553362d5c7684" - }, - { - "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect", - "Rev": "4a62c19bf7bf4a3fdb2afb0b347553362d5c7684" - } - ] + "ImportPath": "k8s.io/api", + "GoVersion": "go1.9", + "GodepVersion": "v79", + "Packages": [ + "./..." + ], + "Deps": [ + { + "ImportPath": "github.com/gogo/protobuf/proto", + "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" + }, + { + "ImportPath": "github.com/gogo/protobuf/sortkeys", + "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" + }, + { + "ImportPath": "github.com/golang/glog", + "Rev": "44145f04b68cf362d9c4df2182967c2275eaefed" + }, + { + "ImportPath": "github.com/google/gofuzz", + "Rev": "44d81051d367757e1c7c6a5a86423ece9afcf63c" + }, + { + "ImportPath": "github.com/spf13/pflag", + "Rev": "4c012f6dcd9546820e378d0bdda4d8fc772cdfea" + }, + { + "ImportPath": "golang.org/x/net/http2", + "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" + }, + { + "ImportPath": "golang.org/x/net/http2/hpack", + "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" + }, + { + "ImportPath": "golang.org/x/net/idna", + "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" + }, + { + "ImportPath": "golang.org/x/net/lex/httplex", + "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" + }, + { + "ImportPath": "golang.org/x/text/secure/bidirule", + "Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01" + }, + { + "ImportPath": "golang.org/x/text/transform", + "Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01" + }, + { + "ImportPath": "golang.org/x/text/unicode/bidi", + "Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01" + }, + { + "ImportPath": "golang.org/x/text/unicode/norm", + "Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01" + }, + { + "ImportPath": "gopkg.in/inf.v0", + "Rev": "3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/api/resource", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/conversion", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/fields", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/labels", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/runtime", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/runtime/schema", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/selection", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/types", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/util/errors", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/util/intstr", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/util/json", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/util/net", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/util/runtime", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/util/sets", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/util/validation", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/util/validation/field", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/util/wait", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/watch", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/api/resource", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/runtime", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/runtime/schema", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/types", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + }, + { + "ImportPath": "k8s.io/apimachinery/pkg/util/intstr", + "Rev": "302974c03f7e50f16561ba237db776ab93594ef6" + } + ] } diff --git a/vendor/k8s.io/apimachinery/Godeps/Godeps.json b/vendor/k8s.io/apimachinery/Godeps/Godeps.json index 5ba1aa546..9c5e1932f 100644 --- a/vendor/k8s.io/apimachinery/Godeps/Godeps.json +++ b/vendor/k8s.io/apimachinery/Godeps/Godeps.json @@ -1,178 +1,178 @@ { - "ImportPath": "k8s.io/apimachinery", - "GoVersion": "go1.9", - "GodepVersion": "v79", - "Packages": [ - "./..." - ], - "Deps": [ - { - "ImportPath": "github.com/davecgh/go-spew/spew", - "Rev": "782f4967f2dc4564575ca782fe2d04090b5faca8" - }, - { - "ImportPath": "github.com/docker/spdystream", - "Rev": "449fdfce4d962303d702fec724ef0ad181c92528" - }, - { - "ImportPath": "github.com/docker/spdystream/spdy", - "Rev": "449fdfce4d962303d702fec724ef0ad181c92528" - }, - { - "ImportPath": "github.com/elazarl/goproxy", - "Rev": "c4fc26588b6ef8af07a191fcb6476387bdd46711" - }, - { - "ImportPath": "github.com/evanphx/json-patch", - "Rev": "944e07253867aacae43c04b2e6a239005443f33a" - }, - { - "ImportPath": "github.com/ghodss/yaml", - "Rev": "73d445a93680fa1a78ae23a5839bad48f32ba1ee" - }, - { - "ImportPath": "github.com/gogo/protobuf/proto", - "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" - }, - { - "ImportPath": "github.com/gogo/protobuf/sortkeys", - "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" - }, - { - "ImportPath": "github.com/golang/glog", - "Rev": "44145f04b68cf362d9c4df2182967c2275eaefed" - }, - { - "ImportPath": "github.com/golang/groupcache/lru", - "Rev": "02826c3e79038b59d737d3b1c0a1d937f71a4433" - }, - { - "ImportPath": "github.com/golang/protobuf/proto", - "Rev": "1643683e1b54a9e88ad26d98f81400c8c9d9f4f9" - }, - { - "ImportPath": "github.com/golang/protobuf/ptypes", - "Rev": "1643683e1b54a9e88ad26d98f81400c8c9d9f4f9" - }, - { - "ImportPath": "github.com/golang/protobuf/ptypes/any", - "Rev": "1643683e1b54a9e88ad26d98f81400c8c9d9f4f9" - }, - { - "ImportPath": "github.com/golang/protobuf/ptypes/duration", - "Rev": "1643683e1b54a9e88ad26d98f81400c8c9d9f4f9" - }, - { - "ImportPath": "github.com/golang/protobuf/ptypes/timestamp", - "Rev": "1643683e1b54a9e88ad26d98f81400c8c9d9f4f9" - }, - { - "ImportPath": "github.com/google/gofuzz", - "Rev": "44d81051d367757e1c7c6a5a86423ece9afcf63c" - }, - { - "ImportPath": "github.com/googleapis/gnostic/OpenAPIv2", - "Rev": "0c5108395e2debce0d731cf0287ddf7242066aba" - }, - { - "ImportPath": "github.com/googleapis/gnostic/compiler", - "Rev": "0c5108395e2debce0d731cf0287ddf7242066aba" - }, - { - "ImportPath": "github.com/googleapis/gnostic/extensions", - "Rev": "0c5108395e2debce0d731cf0287ddf7242066aba" - }, - { - "ImportPath": "github.com/hashicorp/golang-lru", - "Rev": "a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4" - }, - { - "ImportPath": "github.com/hashicorp/golang-lru/simplelru", - "Rev": "a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4" - }, - { - "ImportPath": "github.com/json-iterator/go", - "Rev": "13f86432b882000a51c6e610c620974462691a97" - }, - { - "ImportPath": "github.com/mxk/go-flowrate/flowrate", - "Rev": "cca7078d478f8520f85629ad7c68962d31ed7682" - }, - { - "ImportPath": "github.com/pborman/uuid", - "Rev": "ca53cad383cad2479bbba7f7a1a05797ec1386e4" - }, - { - "ImportPath": "github.com/pmezard/go-difflib/difflib", - "Rev": "d8ed2627bdf02c080bf22230dbb337003b7aba2d" - }, - { - "ImportPath": "github.com/spf13/pflag", - "Rev": "4c012f6dcd9546820e378d0bdda4d8fc772cdfea" - }, - { - "ImportPath": "github.com/stretchr/testify/assert", - "Rev": "f6abca593680b2315d2075e0f5e2a9751e3f431a" - }, - { - "ImportPath": "github.com/stretchr/testify/require", - "Rev": "f6abca593680b2315d2075e0f5e2a9751e3f431a" - }, - { - "ImportPath": "golang.org/x/net/html", - "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" - }, - { - "ImportPath": "golang.org/x/net/html/atom", - "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" - }, - { - "ImportPath": "golang.org/x/net/http2", - "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" - }, - { - "ImportPath": "golang.org/x/net/http2/hpack", - "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" - }, - { - "ImportPath": "golang.org/x/net/idna", - "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" - }, - { - "ImportPath": "golang.org/x/net/lex/httplex", - "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" - }, - { - "ImportPath": "golang.org/x/net/websocket", - "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" - }, - { - "ImportPath": "golang.org/x/text/secure/bidirule", - "Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01" - }, - { - "ImportPath": "golang.org/x/text/transform", - "Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01" - }, - { - "ImportPath": "golang.org/x/text/unicode/bidi", - "Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01" - }, - { - "ImportPath": "golang.org/x/text/unicode/norm", - "Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01" - }, - { - "ImportPath": "gopkg.in/inf.v0", - "Rev": "3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4" - }, - { - "ImportPath": "gopkg.in/yaml.v2", - "Rev": "670d4cfef0544295bc27a114dbac37980d83185a" - }, - { - "ImportPath": "k8s.io/kube-openapi/pkg/util/proto", - "Rev": "a07b7bbb58e7fdc5144f8d7046331d29fc9ad3b3" - } - ] + "ImportPath": "k8s.io/apimachinery", + "GoVersion": "go1.9", + "GodepVersion": "v79", + "Packages": [ + "./..." + ], + "Deps": [ + { + "ImportPath": "github.com/davecgh/go-spew/spew", + "Rev": "782f4967f2dc4564575ca782fe2d04090b5faca8" + }, + { + "ImportPath": "github.com/docker/spdystream", + "Rev": "449fdfce4d962303d702fec724ef0ad181c92528" + }, + { + "ImportPath": "github.com/docker/spdystream/spdy", + "Rev": "449fdfce4d962303d702fec724ef0ad181c92528" + }, + { + "ImportPath": "github.com/elazarl/goproxy", + "Rev": "c4fc26588b6ef8af07a191fcb6476387bdd46711" + }, + { + "ImportPath": "github.com/evanphx/json-patch", + "Rev": "944e07253867aacae43c04b2e6a239005443f33a" + }, + { + "ImportPath": "github.com/ghodss/yaml", + "Rev": "73d445a93680fa1a78ae23a5839bad48f32ba1ee" + }, + { + "ImportPath": "github.com/gogo/protobuf/proto", + "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" + }, + { + "ImportPath": "github.com/gogo/protobuf/sortkeys", + "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" + }, + { + "ImportPath": "github.com/golang/glog", + "Rev": "44145f04b68cf362d9c4df2182967c2275eaefed" + }, + { + "ImportPath": "github.com/golang/groupcache/lru", + "Rev": "02826c3e79038b59d737d3b1c0a1d937f71a4433" + }, + { + "ImportPath": "github.com/golang/protobuf/proto", + "Rev": "1643683e1b54a9e88ad26d98f81400c8c9d9f4f9" + }, + { + "ImportPath": "github.com/golang/protobuf/ptypes", + "Rev": "1643683e1b54a9e88ad26d98f81400c8c9d9f4f9" + }, + { + "ImportPath": "github.com/golang/protobuf/ptypes/any", + "Rev": "1643683e1b54a9e88ad26d98f81400c8c9d9f4f9" + }, + { + "ImportPath": "github.com/golang/protobuf/ptypes/duration", + "Rev": "1643683e1b54a9e88ad26d98f81400c8c9d9f4f9" + }, + { + "ImportPath": "github.com/golang/protobuf/ptypes/timestamp", + "Rev": "1643683e1b54a9e88ad26d98f81400c8c9d9f4f9" + }, + { + "ImportPath": "github.com/google/gofuzz", + "Rev": "44d81051d367757e1c7c6a5a86423ece9afcf63c" + }, + { + "ImportPath": "github.com/googleapis/gnostic/OpenAPIv2", + "Rev": "0c5108395e2debce0d731cf0287ddf7242066aba" + }, + { + "ImportPath": "github.com/googleapis/gnostic/compiler", + "Rev": "0c5108395e2debce0d731cf0287ddf7242066aba" + }, + { + "ImportPath": "github.com/googleapis/gnostic/extensions", + "Rev": "0c5108395e2debce0d731cf0287ddf7242066aba" + }, + { + "ImportPath": "github.com/hashicorp/golang-lru", + "Rev": "a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4" + }, + { + "ImportPath": "github.com/hashicorp/golang-lru/simplelru", + "Rev": "a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4" + }, + { + "ImportPath": "github.com/json-iterator/go", + "Rev": "13f86432b882000a51c6e610c620974462691a97" + }, + { + "ImportPath": "github.com/mxk/go-flowrate/flowrate", + "Rev": "cca7078d478f8520f85629ad7c68962d31ed7682" + }, + { + "ImportPath": "github.com/pborman/uuid", + "Rev": "ca53cad383cad2479bbba7f7a1a05797ec1386e4" + }, + { + "ImportPath": "github.com/pmezard/go-difflib/difflib", + "Rev": "d8ed2627bdf02c080bf22230dbb337003b7aba2d" + }, + { + "ImportPath": "github.com/spf13/pflag", + "Rev": "4c012f6dcd9546820e378d0bdda4d8fc772cdfea" + }, + { + "ImportPath": "github.com/stretchr/testify/assert", + "Rev": "f6abca593680b2315d2075e0f5e2a9751e3f431a" + }, + { + "ImportPath": "github.com/stretchr/testify/require", + "Rev": "f6abca593680b2315d2075e0f5e2a9751e3f431a" + }, + { + "ImportPath": "golang.org/x/net/html", + "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" + }, + { + "ImportPath": "golang.org/x/net/html/atom", + "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" + }, + { + "ImportPath": "golang.org/x/net/http2", + "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" + }, + { + "ImportPath": "golang.org/x/net/http2/hpack", + "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" + }, + { + "ImportPath": "golang.org/x/net/idna", + "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" + }, + { + "ImportPath": "golang.org/x/net/lex/httplex", + "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" + }, + { + "ImportPath": "golang.org/x/net/websocket", + "Rev": "1c05540f6879653db88113bc4a2b70aec4bd491f" + }, + { + "ImportPath": "golang.org/x/text/secure/bidirule", + "Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01" + }, + { + "ImportPath": "golang.org/x/text/transform", + "Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01" + }, + { + "ImportPath": "golang.org/x/text/unicode/bidi", + "Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01" + }, + { + "ImportPath": "golang.org/x/text/unicode/norm", + "Rev": "b19bf474d317b857955b12035d2c5acb57ce8b01" + }, + { + "ImportPath": "gopkg.in/inf.v0", + "Rev": "3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4" + }, + { + "ImportPath": "gopkg.in/yaml.v2", + "Rev": "670d4cfef0544295bc27a114dbac37980d83185a" + }, + { + "ImportPath": "k8s.io/kube-openapi/pkg/util/proto", + "Rev": "50ae88d24ede7b8bad68e23c805b5d3da5c8abaf" + } + ] } diff --git a/vendor/k8s.io/apimachinery/Godeps/OWNERS b/vendor/k8s.io/apimachinery/Godeps/OWNERS new file mode 100644 index 000000000..3d49f3060 --- /dev/null +++ b/vendor/k8s.io/apimachinery/Godeps/OWNERS @@ -0,0 +1,2 @@ +approvers: +- dep-approvers diff --git a/vendor/k8s.io/apimachinery/pkg/api/errors/BUILD b/vendor/k8s.io/apimachinery/pkg/api/errors/BUILD index 384b432bd..785e9d8a6 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/errors/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/api/errors/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["errors_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/api/errors", deps = [ "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", diff --git a/vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS b/vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS index af32c1fdf..dc6a4c724 100755 --- a/vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS +++ b/vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS @@ -16,7 +16,6 @@ reviewers: - janetkuo - tallclair - eparis -- timothysc - dims - hongchaodeng - krousey diff --git a/vendor/k8s.io/apimachinery/pkg/api/meta/BUILD b/vendor/k8s.io/apimachinery/pkg/api/meta/BUILD index 29be07874..a02a1fb5b 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/meta/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/api/meta/BUILD @@ -15,7 +15,6 @@ go_test( "restmapper_test.go", ], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/api/meta", deps = [ "//vendor/github.com/google/gofuzz:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", @@ -65,6 +64,9 @@ filegroup( filegroup( name = "all-srcs", - srcs = [":package-srcs"], + srcs = [ + ":package-srcs", + "//staging/src/k8s.io/apimachinery/pkg/api/meta/table:all-srcs", + ], tags = ["automanaged"], ) diff --git a/vendor/k8s.io/apimachinery/pkg/api/meta/restmapper_test.go b/vendor/k8s.io/apimachinery/pkg/api/meta/restmapper_test.go index 292c4149e..1b1c70d65 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/meta/restmapper_test.go +++ b/vendor/k8s.io/apimachinery/pkg/api/meta/restmapper_test.go @@ -507,7 +507,7 @@ func TestRESTMapperResourceSingularizer(t *testing.T) { {Kind: "lowercase", Plural: "lowercases", Singular: "lowercase"}, // TODO this test is broken. This updates to reflect actual behavior. Kinds are expected to be singular - // old (incorrect), coment: Don't add extra s if the original object is already plural + // old (incorrect), comment: Don't add extra s if the original object is already plural {Kind: "lowercases", Plural: "lowercaseses", Singular: "lowercases"}, } for i, testCase := range testCases { diff --git a/vendor/k8s.io/apimachinery/pkg/api/meta/table/BUILD b/vendor/k8s.io/apimachinery/pkg/api/meta/table/BUILD new file mode 100644 index 000000000..e3ffd2493 --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/api/meta/table/BUILD @@ -0,0 +1,29 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = ["table.go"], + importpath = "k8s.io/apimachinery/pkg/api/meta/table", + visibility = ["//visibility:public"], + deps = [ + "//vendor/k8s.io/apimachinery/pkg/api/meta:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", + "//vendor/k8s.io/apimachinery/pkg/util/duration:go_default_library", + ], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/vendor/k8s.io/apimachinery/pkg/api/meta/table/table.go b/vendor/k8s.io/apimachinery/pkg/api/meta/table/table.go new file mode 100644 index 000000000..a0097a4e2 --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/api/meta/table/table.go @@ -0,0 +1,71 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package table + +import ( + "time" + + "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + metav1beta1 "k8s.io/apimachinery/pkg/apis/meta/v1beta1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/util/duration" +) + +// MetaToTableRow converts a list or object into one or more table rows. The provided rowFn is invoked for +// each accessed item, with name and age being passed to each. +func MetaToTableRow(obj runtime.Object, rowFn func(obj runtime.Object, m metav1.Object, name, age string) ([]interface{}, error)) ([]metav1beta1.TableRow, error) { + if meta.IsListType(obj) { + rows := make([]metav1beta1.TableRow, 0, 16) + err := meta.EachListItem(obj, func(obj runtime.Object) error { + nestedRows, err := MetaToTableRow(obj, rowFn) + if err != nil { + return err + } + rows = append(rows, nestedRows...) + return nil + }) + if err != nil { + return nil, err + } + return rows, nil + } + + rows := make([]metav1beta1.TableRow, 0, 1) + m, err := meta.Accessor(obj) + if err != nil { + return nil, err + } + row := metav1beta1.TableRow{ + Object: runtime.RawExtension{Object: obj}, + } + row.Cells, err = rowFn(obj, m, m.GetName(), translateTimestamp(m.GetCreationTimestamp())) + if err != nil { + return nil, err + } + rows = append(rows, row) + return rows, nil +} + +// translateTimestamp returns the elapsed time since timestamp in +// human-readable approximation. +func translateTimestamp(timestamp metav1.Time) string { + if timestamp.IsZero() { + return "" + } + return duration.ShortHumanDuration(time.Now().Sub(timestamp.Time)) +} diff --git a/vendor/k8s.io/apimachinery/pkg/api/resource/BUILD b/vendor/k8s.io/apimachinery/pkg/api/resource/BUILD index 2ae763853..57f85fb24 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/resource/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/api/resource/BUILD @@ -16,7 +16,6 @@ go_test( "scale_int_test.go", ], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/api/resource", deps = [ "//vendor/github.com/google/gofuzz:go_default_library", "//vendor/github.com/spf13/pflag:go_default_library", @@ -47,7 +46,6 @@ go_library( go_test( name = "go_default_xtest", srcs = ["quantity_example_test.go"], - importpath = "k8s.io/apimachinery/pkg/api/resource_test", deps = ["//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library"], ) diff --git a/vendor/k8s.io/apimachinery/pkg/api/resource/OWNERS b/vendor/k8s.io/apimachinery/pkg/api/resource/OWNERS index 342ff2914..c430067f3 100755 --- a/vendor/k8s.io/apimachinery/pkg/api/resource/OWNERS +++ b/vendor/k8s.io/apimachinery/pkg/api/resource/OWNERS @@ -9,7 +9,6 @@ reviewers: - janetkuo - tallclair - eparis -- timothysc - jbeda - xiang90 - mbohlool diff --git a/vendor/k8s.io/apimachinery/pkg/api/resource/scale_int_test.go b/vendor/k8s.io/apimachinery/pkg/api/resource/scale_int_test.go index 50d91060a..b150fa514 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/resource/scale_int_test.go +++ b/vendor/k8s.io/apimachinery/pkg/api/resource/scale_int_test.go @@ -45,7 +45,7 @@ func TestScaledValueInternal(t *testing.T) { {big.NewInt(1), 3, 0, 1}, // large scaled value does not lose precision {big.NewInt(0).Sub(maxInt64, bigOne), 1, 0, (math.MaxInt64-1)/10 + 1}, - // large intermidiate result. + // large intermediate result. {big.NewInt(1).Exp(big.NewInt(10), big.NewInt(100), nil), 100, 0, 1}, // scale up diff --git a/vendor/k8s.io/apimachinery/pkg/api/resource/zz_generated.deepcopy.go b/vendor/k8s.io/apimachinery/pkg/api/resource/zz_generated.deepcopy.go index 186d9007e..fc36d9811 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/resource/zz_generated.deepcopy.go +++ b/vendor/k8s.io/apimachinery/pkg/api/resource/zz_generated.deepcopy.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This file was autogenerated by deepcopy-gen. Do not edit it manually! +// Code generated by deepcopy-gen. DO NOT EDIT. package resource diff --git a/vendor/k8s.io/apimachinery/pkg/api/testing/fuzzer/BUILD b/vendor/k8s.io/apimachinery/pkg/api/testing/fuzzer/BUILD index 00a56d250..ee7b37e1e 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/testing/fuzzer/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/api/testing/fuzzer/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["valuefuzz_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/api/testing/fuzzer", ) go_library( diff --git a/vendor/k8s.io/apimachinery/pkg/api/validation/BUILD b/vendor/k8s.io/apimachinery/pkg/api/validation/BUILD index 8f6cd93d4..2c6a0aa3d 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/validation/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/api/validation/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["objectmeta_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/api/validation", deps = [ "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/validation/field:go_default_library", diff --git a/vendor/k8s.io/apimachinery/pkg/api/validation/path/BUILD b/vendor/k8s.io/apimachinery/pkg/api/validation/path/BUILD index 33546216a..ddc17e79e 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/validation/path/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/api/validation/path/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["name_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/api/validation/path", ) go_library( diff --git a/vendor/k8s.io/apimachinery/pkg/apimachinery/BUILD b/vendor/k8s.io/apimachinery/pkg/apimachinery/BUILD index 90d016fab..b1071fb46 100644 --- a/vendor/k8s.io/apimachinery/pkg/apimachinery/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/apimachinery/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["types_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/apimachinery", deps = ["//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library"], ) diff --git a/vendor/k8s.io/apimachinery/pkg/apimachinery/announced/BUILD b/vendor/k8s.io/apimachinery/pkg/apimachinery/announced/BUILD index 27734e8f5..ea31914f7 100644 --- a/vendor/k8s.io/apimachinery/pkg/apimachinery/announced/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/apimachinery/announced/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["announced_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/apimachinery/announced", deps = ["//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library"], ) diff --git a/vendor/k8s.io/apimachinery/pkg/apimachinery/announced/announced.go b/vendor/k8s.io/apimachinery/pkg/apimachinery/announced/announced.go index 2c8568c1f..4e38cc8c5 100644 --- a/vendor/k8s.io/apimachinery/pkg/apimachinery/announced/announced.go +++ b/vendor/k8s.io/apimachinery/pkg/apimachinery/announced/announced.go @@ -35,7 +35,7 @@ import ( // // (Right now APIRegistrationManager has separate 'registration' and 'enabled' // concepts-- APIGroupFactory is going to take over the former function; -// they will overlap untill the refactoring is finished.) +// they will overlap until the refactoring is finished.) // // The key is the group name. After initialization, this should be treated as // read-only. It is implemented as a map from group name to group factory, and diff --git a/vendor/k8s.io/apimachinery/pkg/apimachinery/registered/BUILD b/vendor/k8s.io/apimachinery/pkg/apimachinery/registered/BUILD index 873b34838..ba02a0938 100644 --- a/vendor/k8s.io/apimachinery/pkg/apimachinery/registered/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/apimachinery/registered/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["registered_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/apimachinery/registered", deps = [ "//vendor/k8s.io/apimachinery/pkg/apimachinery:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/fuzzer/fuzzer.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/fuzzer/fuzzer.go index d41744af4..54fab9c02 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/fuzzer/fuzzer.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/fuzzer/fuzzer.go @@ -221,7 +221,7 @@ func v1FuzzerFuncs(codecs runtimeserializer.CodecFactory) []interface{} { if j.MatchExpressions != nil { // NB: the label selector parser code sorts match expressions by key, and sorts the values, - // so we need to make sure ours are sorted as well here to preserve round-trip comparision. + // so we need to make sure ours are sorted as well here to preserve round-trip comparison. // In practice, not sorting doesn't hurt anything... for i := range j.MatchExpressions { diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/BUILD b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/BUILD index defc85ac3..edb9a6ac6 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/BUILD @@ -13,7 +13,6 @@ go_test( "roundtrip_test.go", ], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/apis/meta/internalversion", deps = [ "//vendor/k8s.io/apimachinery/pkg/api/testing/roundtrip:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/fuzzer:go_default_library", diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go index 247577b0c..c3fd40a90 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This file was autogenerated by conversion-gen. Do not edit it manually! +// Code generated by conversion-gen. DO NOT EDIT. package internalversion diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go index 2bc1c3f96..e4e5b017b 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This file was autogenerated by deepcopy-gen. Do not edit it manually! +// Code generated by deepcopy-gen. DO NOT EDIT. package internalversion @@ -57,9 +57,8 @@ func (in *List) DeepCopy() *List { func (in *List) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -102,7 +101,6 @@ func (in *ListOptions) DeepCopy() *ListOptions { func (in *ListOptions) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/BUILD b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/BUILD index 1c49035bb..186db1871 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/BUILD @@ -19,7 +19,6 @@ go_test( "types_test.go", ], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/apis/meta/v1", deps = [ "//vendor/github.com/ghodss/yaml:go_default_library", "//vendor/github.com/json-iterator/go:go_default_library", @@ -95,7 +94,6 @@ filegroup( go_test( name = "go_default_xtest", srcs = ["conversion_test.go"], - importpath = "k8s.io/apimachinery/pkg/apis/meta/v1_test", deps = [ "//vendor/k8s.io/apimachinery/pkg/api/equality:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/OWNERS b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/OWNERS index 7f5eb5860..cdb125a0d 100755 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/OWNERS +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/OWNERS @@ -16,7 +16,6 @@ reviewers: - janetkuo - justinsb - ncdc -- timothysc - soltysh - dims - madhusudancs diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/BUILD b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/BUILD index 4f3bf562d..22c1acee0 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/BUILD @@ -13,7 +13,6 @@ go_test( "unstructured_list_test.go", ], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured", deps = [ "//vendor/github.com/stretchr/testify/assert:go_default_library", "//vendor/github.com/stretchr/testify/require:go_default_library", diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/zz_generated.deepcopy.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/zz_generated.deepcopy.go index e3bae45ec..1c185139f 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/zz_generated.deepcopy.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/zz_generated.deepcopy.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This file was autogenerated by deepcopy-gen. Do not edit it manually! +// Code generated by deepcopy-gen. DO NOT EDIT. package unstructured @@ -35,9 +35,8 @@ func (in *Unstructured) DeepCopyInto(out *Unstructured) { func (in *Unstructured) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -51,7 +50,6 @@ func (in *UnstructuredList) DeepCopyInto(out *UnstructuredList) { func (in *UnstructuredList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/BUILD b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/BUILD index 436ae33a5..b7dbe0ad9 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["validation_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/apis/meta/v1/validation", deps = ["//vendor/k8s.io/apimachinery/pkg/util/validation/field:go_default_library"], ) diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go index 2aa209025..73308d86e 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This file was autogenerated by deepcopy-gen. Do not edit it manually! +// Code generated by deepcopy-gen. DO NOT EDIT. package v1 @@ -57,9 +57,8 @@ func (in *APIGroup) DeepCopy() *APIGroup { func (in *APIGroup) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -90,9 +89,8 @@ func (in *APIGroupList) DeepCopy() *APIGroupList { func (in *APIGroupList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -154,9 +152,8 @@ func (in *APIResourceList) DeepCopy() *APIResourceList { func (in *APIResourceList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -190,9 +187,8 @@ func (in *APIVersions) DeepCopy() *APIVersions { func (in *APIVersions) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -252,9 +248,8 @@ func (in *DeleteOptions) DeepCopy() *DeleteOptions { func (in *DeleteOptions) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -294,9 +289,8 @@ func (in *ExportOptions) DeepCopy() *ExportOptions { func (in *ExportOptions) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -320,9 +314,8 @@ func (in *GetOptions) DeepCopy() *GetOptions { func (in *GetOptions) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -568,9 +561,8 @@ func (in *List) DeepCopy() *List { func (in *List) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -619,9 +611,8 @@ func (in *ListOptions) DeepCopy() *ListOptions { func (in *ListOptions) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MicroTime. @@ -643,8 +634,7 @@ func (in *ObjectMeta) DeepCopyInto(out *ObjectMeta) { if *in == nil { *out = nil } else { - *out = new(Time) - (*in).DeepCopyInto(*out) + *out = (*in).DeepCopy() } } if in.DeletionGracePeriodSeconds != nil { @@ -847,9 +837,8 @@ func (in *Status) DeepCopy() *Status { func (in *Status) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -915,6 +904,26 @@ func (in *Timestamp) DeepCopy() *Timestamp { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in Verbs) DeepCopyInto(out *Verbs) { + { + in := &in + *out = make(Verbs, len(*in)) + copy(*out, *in) + return + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Verbs. +func (in Verbs) DeepCopy() Verbs { + if in == nil { + return nil + } + out := new(Verbs) + in.DeepCopyInto(out) + return *out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *WatchEvent) DeepCopyInto(out *WatchEvent) { *out = *in @@ -936,7 +945,6 @@ func (in *WatchEvent) DeepCopy() *WatchEvent { func (in *WatchEvent) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.defaults.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.defaults.go index 88d7af085..40d9ab00e 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.defaults.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.defaults.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This file was autogenerated by defaulter-gen. Do not edit it manually! +// Code generated by defaulter-gen. DO NOT EDIT. package v1 diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/zz_generated.deepcopy.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/zz_generated.deepcopy.go index a1f58daa3..226995a21 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/zz_generated.deepcopy.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/zz_generated.deepcopy.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This file was autogenerated by deepcopy-gen. Do not edit it manually! +// Code generated by deepcopy-gen. DO NOT EDIT. package v1beta1 @@ -46,9 +46,8 @@ func (in *PartialObjectMetadata) DeepCopy() *PartialObjectMetadata { func (in *PartialObjectMetadata) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -84,9 +83,8 @@ func (in *PartialObjectMetadataList) DeepCopy() *PartialObjectMetadataList { func (in *PartialObjectMetadataList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -123,9 +121,8 @@ func (in *Table) DeepCopy() *Table { func (in *Table) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -165,9 +162,8 @@ func (in *TableOptions) DeepCopy() *TableOptions { func (in *TableOptions) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/zz_generated.defaults.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/zz_generated.defaults.go index b61dda74c..544e569dc 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/zz_generated.defaults.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/zz_generated.defaults.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This file was autogenerated by defaulter-gen. Do not edit it manually! +// Code generated by defaulter-gen. DO NOT EDIT. package v1beta1 diff --git a/vendor/k8s.io/apimachinery/pkg/apis/testapigroup/install/BUILD b/vendor/k8s.io/apimachinery/pkg/apis/testapigroup/install/BUILD index b2107d46f..7e3e76d5d 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/testapigroup/install/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/apis/testapigroup/install/BUILD @@ -23,7 +23,6 @@ go_test( name = "go_default_test", srcs = ["roundtrip_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/apis/testapigroup/install", deps = [ "//vendor/k8s.io/apimachinery/pkg/api/testing/roundtrip:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/testapigroup/fuzzer:go_default_library", diff --git a/vendor/k8s.io/apimachinery/pkg/apis/testapigroup/v1/zz_generated.conversion.go b/vendor/k8s.io/apimachinery/pkg/apis/testapigroup/v1/zz_generated.conversion.go index 67f5f803e..117a75f32 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/testapigroup/v1/zz_generated.conversion.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/testapigroup/v1/zz_generated.conversion.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This file was autogenerated by conversion-gen. Do not edit it manually! +// Code generated by conversion-gen. DO NOT EDIT. package v1 diff --git a/vendor/k8s.io/apimachinery/pkg/apis/testapigroup/v1/zz_generated.deepcopy.go b/vendor/k8s.io/apimachinery/pkg/apis/testapigroup/v1/zz_generated.deepcopy.go index d10f8865a..4b2a9b4f4 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/testapigroup/v1/zz_generated.deepcopy.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/testapigroup/v1/zz_generated.deepcopy.go @@ -16,12 +16,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This file was autogenerated by deepcopy-gen. Do not edit it manually! +// Code generated by deepcopy-gen. DO NOT EDIT. package v1 import ( - meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -49,9 +48,8 @@ func (in *Carp) DeepCopy() *Carp { func (in *Carp) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -101,9 +99,8 @@ func (in *CarpList) DeepCopy() *CarpList { func (in *CarpList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -162,8 +159,7 @@ func (in *CarpStatus) DeepCopyInto(out *CarpStatus) { if *in == nil { *out = nil } else { - *out = new(meta_v1.Time) - (*in).DeepCopyInto(*out) + *out = (*in).DeepCopy() } } return diff --git a/vendor/k8s.io/apimachinery/pkg/apis/testapigroup/v1/zz_generated.defaults.go b/vendor/k8s.io/apimachinery/pkg/apis/testapigroup/v1/zz_generated.defaults.go index 88d7af085..40d9ab00e 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/testapigroup/v1/zz_generated.defaults.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/testapigroup/v1/zz_generated.defaults.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This file was autogenerated by defaulter-gen. Do not edit it manually! +// Code generated by defaulter-gen. DO NOT EDIT. package v1 diff --git a/vendor/k8s.io/apimachinery/pkg/apis/testapigroup/zz_generated.deepcopy.go b/vendor/k8s.io/apimachinery/pkg/apis/testapigroup/zz_generated.deepcopy.go index 77a7bcae8..341030abd 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/testapigroup/zz_generated.deepcopy.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/testapigroup/zz_generated.deepcopy.go @@ -16,12 +16,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This file was autogenerated by deepcopy-gen. Do not edit it manually! +// Code generated by deepcopy-gen. DO NOT EDIT. package testapigroup import ( - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -49,9 +48,8 @@ func (in *Carp) DeepCopy() *Carp { func (in *Carp) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -101,9 +99,8 @@ func (in *CarpList) DeepCopy() *CarpList { func (in *CarpList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -162,8 +159,7 @@ func (in *CarpStatus) DeepCopyInto(out *CarpStatus) { if *in == nil { *out = nil } else { - *out = new(v1.Time) - (*in).DeepCopyInto(*out) + *out = (*in).DeepCopy() } } return diff --git a/vendor/k8s.io/apimachinery/pkg/conversion/BUILD b/vendor/k8s.io/apimachinery/pkg/conversion/BUILD index 653418164..0d2cee729 100644 --- a/vendor/k8s.io/apimachinery/pkg/conversion/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/conversion/BUILD @@ -13,7 +13,6 @@ go_test( "helper_test.go", ], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/conversion", deps = [ "//vendor/github.com/google/gofuzz:go_default_library", "//vendor/github.com/spf13/pflag:go_default_library", diff --git a/vendor/k8s.io/apimachinery/pkg/conversion/converter_test.go b/vendor/k8s.io/apimachinery/pkg/conversion/converter_test.go index 57f51c253..5373c8098 100644 --- a/vendor/k8s.io/apimachinery/pkg/conversion/converter_test.go +++ b/vendor/k8s.io/apimachinery/pkg/conversion/converter_test.go @@ -343,7 +343,7 @@ func TestConverter_GeneratedConversionOverriden(t *testing.T) { t.Fatalf("unexpected error %v", err) } if err := c.RegisterGeneratedConversionFunc(func(in *A, out *B, s Scope) error { - return fmt.Errorf("generated function should be overriden") + return fmt.Errorf("generated function should be overridden") }); err != nil { t.Fatalf("unexpected error %v", err) } @@ -360,12 +360,12 @@ func TestConverter_WithConversionOverriden(t *testing.T) { type B struct{} c := NewConverter(DefaultNameFunc) if err := c.RegisterConversionFunc(func(in *A, out *B, s Scope) error { - return fmt.Errorf("conversion function should be overriden") + return fmt.Errorf("conversion function should be overridden") }); err != nil { t.Fatalf("unexpected error %v", err) } if err := c.RegisterGeneratedConversionFunc(func(in *A, out *B, s Scope) error { - return fmt.Errorf("generated function should be overriden") + return fmt.Errorf("generated function should be overridden") }); err != nil { t.Fatalf("unexpected error %v", err) } @@ -378,7 +378,7 @@ func TestConverter_WithConversionOverriden(t *testing.T) { a := A{} b := B{} - if err := c.Convert(&a, &b, 0, nil); err == nil || err.Error() != "conversion function should be overriden" { + if err := c.Convert(&a, &b, 0, nil); err == nil || err.Error() != "conversion function should be overridden" { t.Errorf("unexpected error: %v", err) } if err := newc.Convert(&a, &b, 0, nil); err != nil { diff --git a/vendor/k8s.io/apimachinery/pkg/conversion/queryparams/BUILD b/vendor/k8s.io/apimachinery/pkg/conversion/queryparams/BUILD index 8b871ab12..81bacef70 100644 --- a/vendor/k8s.io/apimachinery/pkg/conversion/queryparams/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/conversion/queryparams/BUILD @@ -18,7 +18,6 @@ go_library( go_test( name = "go_default_xtest", srcs = ["convert_test.go"], - importpath = "k8s.io/apimachinery/pkg/conversion/queryparams_test", deps = [ "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/conversion/queryparams:go_default_library", diff --git a/vendor/k8s.io/apimachinery/pkg/fields/BUILD b/vendor/k8s.io/apimachinery/pkg/fields/BUILD index addb286a2..383448e0f 100644 --- a/vendor/k8s.io/apimachinery/pkg/fields/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/fields/BUILD @@ -13,7 +13,6 @@ go_test( "selector_test.go", ], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/fields", ) go_library( diff --git a/vendor/k8s.io/apimachinery/pkg/fields/selector.go b/vendor/k8s.io/apimachinery/pkg/fields/selector.go index 273e9a2c1..3785d8c2f 100644 --- a/vendor/k8s.io/apimachinery/pkg/fields/selector.go +++ b/vendor/k8s.io/apimachinery/pkg/fields/selector.go @@ -396,7 +396,7 @@ const ( var termOperators = []string{notEqualOperator, doubleEqualOperator, equalOperator} // splitTerm returns the lhs, operator, and rhs parsed from the given term, along with an indicator of whether the parse was successful. -// no escaping of special characters is supported in the lhs value, so the first occurance of a recognized operator is used as the split point. +// no escaping of special characters is supported in the lhs value, so the first occurrence of a recognized operator is used as the split point. // the literal rhs is returned, and the caller is responsible for applying any desired unescaping. func splitTerm(term string) (lhs, op, rhs string, ok bool) { for i := range term { diff --git a/vendor/k8s.io/apimachinery/pkg/labels/BUILD b/vendor/k8s.io/apimachinery/pkg/labels/BUILD index dc6af2643..a78764f72 100644 --- a/vendor/k8s.io/apimachinery/pkg/labels/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/labels/BUILD @@ -13,7 +13,6 @@ go_test( "selector_test.go", ], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/labels", deps = [ "//vendor/k8s.io/apimachinery/pkg/selection:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library", diff --git a/vendor/k8s.io/apimachinery/pkg/labels/zz_generated.deepcopy.go b/vendor/k8s.io/apimachinery/pkg/labels/zz_generated.deepcopy.go index d22cddbff..a536f9ec9 100644 --- a/vendor/k8s.io/apimachinery/pkg/labels/zz_generated.deepcopy.go +++ b/vendor/k8s.io/apimachinery/pkg/labels/zz_generated.deepcopy.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This file was autogenerated by deepcopy-gen. Do not edit it manually! +// Code generated by deepcopy-gen. DO NOT EDIT. package labels diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/BUILD b/vendor/k8s.io/apimachinery/pkg/runtime/BUILD index ab87922aa..7a53fbc41 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/runtime/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["swagger_doc_generator_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/runtime", ) go_library( @@ -57,7 +56,6 @@ go_test( "extension_test.go", "scheme_test.go", ], - importpath = "k8s.io/apimachinery/pkg/runtime_test", deps = [ "//vendor/github.com/google/gofuzz:go_default_library", "//vendor/github.com/spf13/pflag:go_default_library", diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/codec.go b/vendor/k8s.io/apimachinery/pkg/runtime/codec.go index 5b3080aa5..10dc12cca 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/codec.go +++ b/vendor/k8s.io/apimachinery/pkg/runtime/codec.go @@ -281,7 +281,7 @@ func (disabledGroupVersioner) KindForGroupVersionKinds(kinds []schema.GroupVersi // GroupVersioners implements GroupVersioner and resolves to the first exact match for any kind. type GroupVersioners []GroupVersioner -// KindForGroupVersionKinds returns the first match of any of the group versioners, or false if no match occured. +// KindForGroupVersionKinds returns the first match of any of the group versioners, or false if no match occurred. func (gvs GroupVersioners) KindForGroupVersionKinds(kinds []schema.GroupVersionKind) (schema.GroupVersionKind, bool) { for _, gv := range gvs { target, ok := gv.KindForGroupVersionKinds(kinds) diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/schema/BUILD b/vendor/k8s.io/apimachinery/pkg/runtime/schema/BUILD index 91ead696c..e81977218 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/schema/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/runtime/schema/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["group_version_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/runtime/schema", ) go_library( diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go b/vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go index 1a9bba106..da642fa73 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go +++ b/vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go @@ -36,6 +36,21 @@ func ParseResourceArg(arg string) (*GroupVersionResource, GroupResource) { return gvr, ParseGroupResource(arg) } +// ParseKindArg takes the common style of string which may be either `Kind.group.com` or `Kind.version.group.com` +// and parses it out into both possibilities. This code takes no responsibility for knowing which representation was intended +// but with a knowledge of all GroupKinds, calling code can take a very good guess. If there are only two segments, then +// `*GroupVersionResource` is nil. +// `Kind.group.com` -> `group=com, version=group, kind=Kind` and `group=group.com, kind=Kind` +func ParseKindArg(arg string) (*GroupVersionKind, GroupKind) { + var gvk *GroupVersionKind + if strings.Count(arg, ".") >= 2 { + s := strings.SplitN(arg, ".", 3) + gvk = &GroupVersionKind{Group: s[2], Version: s[1], Kind: s[0]} + } + + return gvk, ParseGroupKind(arg) +} + // GroupResource specifies a Group and a Resource, but does not force a version. This is useful for identifying // concepts during lookup stages without having partially valid types type GroupResource struct { @@ -58,6 +73,15 @@ func (gr *GroupResource) String() string { return gr.Resource + "." + gr.Group } +func ParseGroupKind(gk string) GroupKind { + i := strings.Index(gk, ".") + if i == -1 { + return GroupKind{Kind: gk} + } + + return GroupKind{Group: gk[i+1:], Kind: gk[:i]} +} + // ParseGroupResource turns "resource.group" string into a GroupResource struct. Empty strings are allowed // for each field. func ParseGroupResource(gr string) GroupResource { diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go b/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go index 08b755381..3d94a3041 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go +++ b/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go @@ -431,6 +431,7 @@ func (s *Scheme) Convert(in, out interface{}, context interface{}) error { return err } unstructuredOut.SetUnstructuredContent(content) + unstructuredOut.GetObjectKind().SetGroupVersionKind(gvk) return nil } diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/scheme_test.go b/vendor/k8s.io/apimachinery/pkg/runtime/scheme_test.go index 24743dcae..0b76b5d71 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/scheme_test.go +++ b/vendor/k8s.io/apimachinery/pkg/runtime/scheme_test.go @@ -37,11 +37,13 @@ var fuzzIters = flag.Int("fuzz-iters", 50, "How many fuzzing iterations to do.") func TestScheme(t *testing.T) { internalGV := schema.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal} + internalGVK := internalGV.WithKind("Simple") externalGV := schema.GroupVersion{Group: "test.group", Version: "testExternal"} + externalGVK := externalGV.WithKind("Simple") scheme := runtime.NewScheme() - scheme.AddKnownTypeWithName(internalGV.WithKind("Simple"), &runtimetesting.InternalSimple{}) - scheme.AddKnownTypeWithName(externalGV.WithKind("Simple"), &runtimetesting.ExternalSimple{}) + scheme.AddKnownTypeWithName(internalGVK, &runtimetesting.InternalSimple{}) + scheme.AddKnownTypeWithName(externalGVK, &runtimetesting.ExternalSimple{}) // If set, would clear TypeMeta during conversion. //scheme.AddIgnoredConversionType(&TypeMeta{}, &TypeMeta{}) @@ -55,14 +57,26 @@ func TestScheme(t *testing.T) { // Register functions to verify that scope.Meta() gets set correctly. err := scheme.AddConversionFuncs( func(in *runtimetesting.InternalSimple, out *runtimetesting.ExternalSimple, scope conversion.Scope) error { - scope.Convert(&in.TypeMeta, &out.TypeMeta, 0) - scope.Convert(&in.TestString, &out.TestString, 0) + err := scope.Convert(&in.TypeMeta, &out.TypeMeta, 0) + if err != nil { + return err + } + err = scope.Convert(&in.TestString, &out.TestString, 0) + if err != nil { + return err + } internalToExternalCalls++ return nil }, func(in *runtimetesting.ExternalSimple, out *runtimetesting.InternalSimple, scope conversion.Scope) error { - scope.Convert(&in.TypeMeta, &out.TypeMeta, 0) - scope.Convert(&in.TestString, &out.TestString, 0) + err := scope.Convert(&in.TypeMeta, &out.TypeMeta, 0) + if err != nil { + return err + } + err = scope.Convert(&in.TestString, &out.TestString, 0) + if err != nil { + return err + } externalToInternalCalls++ return nil }, @@ -71,140 +85,160 @@ func TestScheme(t *testing.T) { t.Fatalf("unexpected error: %v", err) } - codecs := serializer.NewCodecFactory(scheme) - codec := codecs.LegacyCodec(externalGV) - info, _ := runtime.SerializerInfoForMediaType(codecs.SupportedMediaTypes(), runtime.ContentTypeJSON) - jsonserializer := info.Serializer - - simple := &runtimetesting.InternalSimple{ - TestString: "foo", - } - - // Test Encode, Decode, DecodeInto, and DecodeToVersion - obj := runtime.Object(simple) - data, err := runtime.Encode(codec, obj) - if err != nil { - t.Fatal(err) - } - - obj2, err := runtime.Decode(codec, data) - if err != nil { - t.Fatal(err) - } - if _, ok := obj2.(*runtimetesting.InternalSimple); !ok { - t.Fatalf("Got wrong type") - } - if e, a := simple, obj2; !reflect.DeepEqual(e, a) { - t.Errorf("Expected:\n %#v,\n Got:\n %#v", e, a) - } - - obj3 := &runtimetesting.InternalSimple{} - if err := runtime.DecodeInto(codec, data, obj3); err != nil { - t.Fatal(err) - } - // clearing TypeMeta is a function of the scheme, which we do not test here (ConvertToVersion - // does not automatically clear TypeMeta anymore). - simple.TypeMeta = runtime.TypeMeta{Kind: "Simple", APIVersion: externalGV.String()} - if e, a := simple, obj3; !reflect.DeepEqual(e, a) { - t.Errorf("Expected:\n %#v,\n Got:\n %#v", e, a) - } + t.Run("Encode, Decode, DecodeInto, and DecodeToVersion", func(t *testing.T) { + simple := &runtimetesting.InternalSimple{ + TestString: "foo", + } - obj4, err := runtime.Decode(jsonserializer, data) - if err != nil { - t.Fatal(err) - } - if _, ok := obj4.(*runtimetesting.ExternalSimple); !ok { - t.Fatalf("Got wrong type") - } + codecs := serializer.NewCodecFactory(scheme) + codec := codecs.LegacyCodec(externalGV) + info, _ := runtime.SerializerInfoForMediaType(codecs.SupportedMediaTypes(), runtime.ContentTypeJSON) + jsonserializer := info.Serializer - // Test Convert - external := &runtimetesting.ExternalSimple{} - err = scheme.Convert(simple, external, nil) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - if e, a := simple.TestString, external.TestString; e != a { - t.Errorf("Expected %v, got %v", e, a) - } + obj := runtime.Object(simple) + data, err := runtime.Encode(codec, obj) + if err != nil { + t.Fatal(err) + } - // Test convert internal to unstructured - unstructuredObj := &runtimetesting.Unstructured{} - err = scheme.Convert(simple, unstructuredObj, nil) - if err == nil || !strings.Contains(err.Error(), "to Unstructured without providing a preferred version to convert to") { - t.Fatalf("Unexpected non-error: %v", err) - } - err = scheme.Convert(simple, unstructuredObj, schema.GroupVersion{Group: "test.group", Version: "testExternal"}) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - if e, a := simple.TestString, unstructuredObj.Object["testString"].(string); e != a { - t.Errorf("Expected %v, got %v", e, a) - } - if e := unstructuredObj.GetObjectKind().GroupVersionKind(); !reflect.DeepEqual(e, schema.GroupVersionKind{Group: "test.group", Version: "testExternal", Kind: "Simple"}) { - t.Errorf("Unexpected object kind: %#v", e) - } - if gvks, unversioned, err := scheme.ObjectKinds(unstructuredObj); err != nil || !reflect.DeepEqual(gvks[0], schema.GroupVersionKind{Group: "test.group", Version: "testExternal", Kind: "Simple"}) || unversioned { - t.Errorf("Scheme did not recognize unversioned: %v, %#v %t", err, gvks, unversioned) - } + obj2, err := runtime.Decode(codec, data) + if err != nil { + t.Fatal(err) + } + if _, ok := obj2.(*runtimetesting.InternalSimple); !ok { + t.Fatalf("Got wrong type") + } + if e, a := simple, obj2; !reflect.DeepEqual(e, a) { + t.Errorf("Expected:\n %#v,\n Got:\n %#v", e, a) + } - // Test convert external to unstructured - unstructuredObj = &runtimetesting.Unstructured{} - err = scheme.Convert(external, unstructuredObj, nil) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - if e, a := simple.TestString, unstructuredObj.Object["testString"].(string); e != a { - t.Errorf("Expected %v, got %v", e, a) - } - if e := unstructuredObj.GetObjectKind().GroupVersionKind(); !reflect.DeepEqual(e, schema.GroupVersionKind{Group: "test.group", Version: "testExternal", Kind: "Simple"}) { - t.Errorf("Unexpected object kind: %#v", e) - } + obj3 := &runtimetesting.InternalSimple{} + if err := runtime.DecodeInto(codec, data, obj3); err != nil { + t.Fatal(err) + } + // clearing TypeMeta is a function of the scheme, which we do not test here (ConvertToVersion + // does not automatically clear TypeMeta anymore). + simple.TypeMeta = runtime.TypeMeta{Kind: "Simple", APIVersion: externalGV.String()} + if e, a := simple, obj3; !reflect.DeepEqual(e, a) { + t.Errorf("Expected:\n %#v,\n Got:\n %#v", e, a) + } - // Test convert unstructured to unstructured - uIn := &runtimetesting.Unstructured{Object: map[string]interface{}{ - "test": []interface{}{"other", "test"}, - }} - uOut := &runtimetesting.Unstructured{} - err = scheme.Convert(uIn, uOut, nil) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - if !reflect.DeepEqual(uIn.Object, uOut.Object) { - t.Errorf("Unexpected object contents: %#v", uOut.Object) - } + obj4, err := runtime.Decode(jsonserializer, data) + if err != nil { + t.Fatal(err) + } + if _, ok := obj4.(*runtimetesting.ExternalSimple); !ok { + t.Fatalf("Got wrong type") + } + }) + t.Run("Convert", func(t *testing.T) { + simple := &runtimetesting.InternalSimple{ + TestString: "foo", + } - // Test convert unstructured to structured - externalOut := &runtimetesting.ExternalSimple{} - err = scheme.Convert(unstructuredObj, externalOut, nil) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - if !reflect.DeepEqual(external, externalOut) { - t.Errorf("Unexpected object contents: %#v", externalOut) - } + external := &runtimetesting.ExternalSimple{} + err = scheme.Convert(simple, external, nil) + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + if e, a := simple.TestString, external.TestString; e != a { + t.Errorf("Expected %q, got %q", e, a) + } + }) + t.Run("Convert internal to unstructured", func(t *testing.T) { + simple := &runtimetesting.InternalSimple{ + TestString: "foo", + } - // Encode and Convert should each have caused an increment. - if e, a := 3, internalToExternalCalls; e != a { - t.Errorf("Expected %v, got %v", e, a) - } - // DecodeInto and Decode should each have caused an increment because of a conversion - if e, a := 2, externalToInternalCalls; e != a { - t.Errorf("Expected %v, got %v", e, a) - } + unstructuredObj := &runtimetesting.Unstructured{} + err = scheme.Convert(simple, unstructuredObj, nil) + if err == nil || !strings.Contains(err.Error(), "to Unstructured without providing a preferred version to convert to") { + t.Fatalf("Unexpected non-error: %v", err) + } + err = scheme.Convert(simple, unstructuredObj, externalGV) + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + if e, a := simple.TestString, unstructuredObj.Object["testString"].(string); e != a { + t.Errorf("Expected %q, got %q", e, a) + } + if e := unstructuredObj.GetObjectKind().GroupVersionKind(); e != externalGVK { + t.Errorf("Unexpected object kind: %#v", e) + } + if gvks, unversioned, err := scheme.ObjectKinds(unstructuredObj); err != nil || gvks[0] != externalGVK || unversioned { + t.Errorf("Scheme did not recognize unversioned: %v, %#v %t", err, gvks, unversioned) + } + }) + t.Run("Convert external to unstructured", func(t *testing.T) { + unstructuredObj := &runtimetesting.Unstructured{} + external := &runtimetesting.ExternalSimple{ + TestString: "foo", + } - // Verify that unstructured types must have V and K set - emptyObj := &runtimetesting.Unstructured{Object: make(map[string]interface{})} - if _, _, err := scheme.ObjectKinds(emptyObj); !runtime.IsMissingKind(err) { - t.Errorf("unexpected error: %v", err) - } - emptyObj.SetGroupVersionKind(schema.GroupVersionKind{Kind: "Test"}) - if _, _, err := scheme.ObjectKinds(emptyObj); !runtime.IsMissingVersion(err) { - t.Errorf("unexpected error: %v", err) - } - emptyObj.SetGroupVersionKind(schema.GroupVersionKind{Kind: "Test", Version: "v1"}) - if _, _, err := scheme.ObjectKinds(emptyObj); err != nil { - t.Errorf("unexpected error: %v", err) - } + err = scheme.Convert(external, unstructuredObj, nil) + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + if e, a := external.TestString, unstructuredObj.Object["testString"].(string); e != a { + t.Errorf("Expected %q, got %q", e, a) + } + if e := unstructuredObj.GetObjectKind().GroupVersionKind(); e != externalGVK { + t.Errorf("Unexpected object kind: %#v", e) + } + }) + t.Run("Convert unstructured to unstructured", func(t *testing.T) { + uIn := &runtimetesting.Unstructured{Object: map[string]interface{}{ + "test": []interface{}{"other", "test"}, + }} + uOut := &runtimetesting.Unstructured{} + err = scheme.Convert(uIn, uOut, nil) + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + if !reflect.DeepEqual(uIn.Object, uOut.Object) { + t.Errorf("Unexpected object contents: %#v", uOut.Object) + } + }) + t.Run("Convert unstructured to structured", func(t *testing.T) { + unstructuredObj := &runtimetesting.Unstructured{ + Object: map[string]interface{}{ + "testString": "bla", + }, + } + unstructuredObj.SetGroupVersionKind(externalGV.WithKind("Simple")) + externalOut := &runtimetesting.ExternalSimple{} + err = scheme.Convert(unstructuredObj, externalOut, nil) + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + if externalOut.TestString != "bla" { + t.Errorf("Unexpected object contents: %#v", externalOut) + } + }) + t.Run("Encode and Convert should each have caused an increment", func(t *testing.T) { + if e, a := 3, internalToExternalCalls; e != a { + t.Errorf("Expected %v, got %v", e, a) + } + }) + t.Run("DecodeInto and Decode should each have caused an increment because of a conversion", func(t *testing.T) { + if e, a := 2, externalToInternalCalls; e != a { + t.Errorf("Expected %v, got %v", e, a) + } + }) + t.Run("Verify that unstructured types must have V and K set", func(t *testing.T) { + emptyObj := &runtimetesting.Unstructured{Object: make(map[string]interface{})} + if _, _, err := scheme.ObjectKinds(emptyObj); !runtime.IsMissingKind(err) { + t.Errorf("unexpected error: %v", err) + } + emptyObj.SetGroupVersionKind(schema.GroupVersionKind{Kind: "Test"}) + if _, _, err := scheme.ObjectKinds(emptyObj); !runtime.IsMissingVersion(err) { + t.Errorf("unexpected error: %v", err) + } + emptyObj.SetGroupVersionKind(schema.GroupVersionKind{Kind: "Test", Version: "v1"}) + if _, _, err := scheme.ObjectKinds(emptyObj); err != nil { + t.Errorf("unexpected error: %v", err) + } + }) } func TestBadJSONRejection(t *testing.T) { @@ -334,11 +368,13 @@ func TestExtensionMapping(t *testing.T) { func TestEncode(t *testing.T) { internalGV := schema.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal} + internalGVK := internalGV.WithKind("Simple") externalGV := schema.GroupVersion{Group: "test.group", Version: "testExternal"} + externalGVK := externalGV.WithKind("Simple") scheme := runtime.NewScheme() - scheme.AddKnownTypeWithName(internalGV.WithKind("Simple"), &runtimetesting.InternalSimple{}) - scheme.AddKnownTypeWithName(externalGV.WithKind("Simple"), &runtimetesting.ExternalSimple{}) + scheme.AddKnownTypeWithName(internalGVK, &runtimetesting.InternalSimple{}) + scheme.AddKnownTypeWithName(externalGVK, &runtimetesting.ExternalSimple{}) codec := serializer.NewCodecFactory(scheme).LegacyCodec(externalGV) @@ -357,20 +393,22 @@ func TestEncode(t *testing.T) { if !reflect.DeepEqual(obj2, test) { t.Errorf("Expected:\n %#v,\n Got:\n %#v", test, obj2) } - if !reflect.DeepEqual(gvk, &schema.GroupVersionKind{Group: "test.group", Version: "testExternal", Kind: "Simple"}) { - t.Errorf("unexpected gvk returned by decode: %#v", gvk) + if *gvk != externalGVK { + t.Errorf("unexpected gvk returned by decode: %#v", *gvk) } } func TestUnversionedTypes(t *testing.T) { internalGV := schema.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal} + internalGVK := internalGV.WithKind("Simple") externalGV := schema.GroupVersion{Group: "test.group", Version: "testExternal"} + externalGVK := externalGV.WithKind("Simple") otherGV := schema.GroupVersion{Group: "group", Version: "other"} scheme := runtime.NewScheme() scheme.AddUnversionedTypes(externalGV, &runtimetesting.InternalSimple{}) - scheme.AddKnownTypeWithName(internalGV.WithKind("Simple"), &runtimetesting.InternalSimple{}) - scheme.AddKnownTypeWithName(externalGV.WithKind("Simple"), &runtimetesting.ExternalSimple{}) + scheme.AddKnownTypeWithName(internalGVK, &runtimetesting.InternalSimple{}) + scheme.AddKnownTypeWithName(externalGVK, &runtimetesting.ExternalSimple{}) scheme.AddKnownTypeWithName(otherGV.WithKind("Simple"), &runtimetesting.ExternalSimple{}) codec := serializer.NewCodecFactory(scheme).LegacyCodec(externalGV) @@ -407,8 +445,8 @@ func TestUnversionedTypes(t *testing.T) { t.Errorf("Expected:\n %#v,\n Got:\n %#v", test, obj2) } // object is serialized as an unversioned object (in the group and version it was defined in) - if !reflect.DeepEqual(gvk, &schema.GroupVersionKind{Group: "test.group", Version: "testExternal", Kind: "InternalSimple"}) { - t.Errorf("unexpected gvk returned by decode: %#v", gvk) + if *gvk != externalGV.WithKind("InternalSimple") { + t.Errorf("unexpected gvk returned by decode: %#v", *gvk) } // when serialized to a different group, the object is kept in its preferred name @@ -435,10 +473,10 @@ var TestObjectFuzzer = fuzz.New().NilChance(.5).NumElements(1, 100).Funcs( // Returns a new Scheme set up with the test objects. func GetTestScheme() *runtime.Scheme { - internalGV := schema.GroupVersion{Version: "__internal"} + internalGV := schema.GroupVersion{Version: runtime.APIVersionInternal} externalGV := schema.GroupVersion{Version: "v1"} alternateExternalGV := schema.GroupVersion{Group: "custom", Version: "v1"} - alternateInternalGV := schema.GroupVersion{Group: "custom", Version: "__internal"} + alternateInternalGV := schema.GroupVersion{Group: "custom", Version: runtime.APIVersionInternal} differentExternalGV := schema.GroupVersion{Group: "other", Version: "v2"} s := runtime.NewScheme() @@ -614,7 +652,7 @@ func TestConvertToVersion(t *testing.T) { { scheme: GetTestScheme(), in: &runtimetesting.ExternalTestType1{A: "test"}, - gv: schema.GroupVersion{Version: "__internal"}, + gv: schema.GroupVersion{Version: runtime.APIVersionInternal}, out: &runtimetesting.TestType1{A: "test"}, }, // converts from unstructured to internal @@ -625,7 +663,7 @@ func TestConvertToVersion(t *testing.T) { "kind": "TestType3", "A": "test", }}, - gv: schema.GroupVersion{Version: "__internal"}, + gv: schema.GroupVersion{Version: runtime.APIVersionInternal}, out: &runtimetesting.TestType1{A: "test"}, }, // converts from unstructured to external @@ -643,7 +681,7 @@ func TestConvertToVersion(t *testing.T) { { scheme: GetTestScheme(), in: &runtimetesting.ExternalTestType1{A: "test"}, - gv: schema.GroupVersions{{Version: "__internal"}, {Version: "v1"}}, + gv: schema.GroupVersions{{Version: runtime.APIVersionInternal}, {Version: "v1"}}, out: &runtimetesting.ExternalTestType1{ MyWeirdCustomEmbeddedVersionKindField: runtimetesting.MyWeirdCustomEmbeddedVersionKindField{APIVersion: "v1", ObjectKind: "TestType1"}, A: "test", @@ -686,7 +724,7 @@ func TestConvertToVersion(t *testing.T) { { scheme: GetTestScheme(), in: &runtimetesting.ExternalTestType1{A: "test"}, - gv: schema.GroupVersions{{Version: "v1"}, {Version: "__internal"}}, + gv: schema.GroupVersions{{Version: "v1"}, {Version: runtime.APIVersionInternal}}, same: true, out: &runtimetesting.ExternalTestType1{ MyWeirdCustomEmbeddedVersionKindField: runtimetesting.MyWeirdCustomEmbeddedVersionKindField{APIVersion: "v1", ObjectKind: "TestType1"}, @@ -697,7 +735,7 @@ func TestConvertToVersion(t *testing.T) { { scheme: GetTestScheme(), in: &runtimetesting.ExternalTestType1{A: "test"}, - gv: schema.GroupVersions{{Version: "v1"}, {Version: "__internal"}}, + gv: schema.GroupVersions{{Version: "v1"}, {Version: runtime.APIVersionInternal}}, same: true, out: &runtimetesting.ExternalTestType1{ MyWeirdCustomEmbeddedVersionKindField: runtimetesting.MyWeirdCustomEmbeddedVersionKindField{APIVersion: "v1", ObjectKind: "TestType1"}, @@ -896,7 +934,7 @@ func TestConvert(t *testing.T) { } func TestMetaValues(t *testing.T) { - internalGV := schema.GroupVersion{Group: "test.group", Version: "__internal"} + internalGV := schema.GroupVersion{Group: "test.group", Version: runtime.APIVersionInternal} externalGV := schema.GroupVersion{Group: "test.group", Version: "externalVersion"} s := runtime.NewScheme() diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/BUILD b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/BUILD index 43d36a792..bc4cf8ec1 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["codec_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/runtime/serializer", deps = [ "//vendor/github.com/ghodss/yaml:go_default_library", "//vendor/github.com/google/gofuzz:go_default_library", diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/BUILD b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/BUILD index 0fdceeda9..7be13ed47 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["meta_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/runtime/serializer/json", ) go_library( @@ -34,7 +33,6 @@ go_library( go_test( name = "go_default_xtest", srcs = ["json_test.go"], - importpath = "k8s.io/apimachinery/pkg/runtime/serializer/json_test", deps = [ "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/recognizer/testing/BUILD b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/recognizer/testing/BUILD index 2e293b985..4e126bc8a 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/recognizer/testing/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/recognizer/testing/BUILD @@ -8,7 +8,6 @@ load( go_test( name = "go_default_test", srcs = ["recognizer_test.go"], - importpath = "k8s.io/apimachinery/pkg/runtime/serializer/recognizer/testing", deps = [ "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/streaming/BUILD b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/streaming/BUILD index f1a2f341b..e0589fef7 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/streaming/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/streaming/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["streaming_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/runtime/serializer/streaming", deps = [ "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/testing/zz_generated.deepcopy.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/testing/zz_generated.deepcopy.go index d43ae7f04..200e92468 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/testing/zz_generated.deepcopy.go +++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/testing/zz_generated.deepcopy.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This file was autogenerated by deepcopy-gen. Do not edit it manually! +// Code generated by deepcopy-gen. DO NOT EDIT. package testing @@ -46,9 +46,8 @@ func (in *ExternalInternalSame) DeepCopy() *ExternalInternalSame { func (in *ExternalInternalSame) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -100,9 +99,8 @@ func (in *ExternalTestType1) DeepCopy() *ExternalTestType1 { func (in *ExternalTestType1) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -125,9 +123,8 @@ func (in *ExternalTestType2) DeepCopy() *ExternalTestType2 { func (in *ExternalTestType2) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -179,9 +176,8 @@ func (in *TestType1) DeepCopy() *TestType1 { func (in *TestType1) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -204,7 +200,6 @@ func (in *TestType2) DeepCopy() *TestType2 { func (in *TestType2) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/BUILD b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/BUILD index 2e262cb6b..32e6863c9 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["versioning_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/runtime/serializer/versioning", deps = [ "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/testing/types.go b/vendor/k8s.io/apimachinery/pkg/runtime/testing/types.go index f7345db0c..0694e7011 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/testing/types.go +++ b/vendor/k8s.io/apimachinery/pkg/runtime/testing/types.go @@ -315,6 +315,9 @@ func (u *Unstructured) GroupVersionKind() schema.GroupVersionKind { } func (u *Unstructured) SetGroupVersionKind(gvk schema.GroupVersionKind) { + if u.Object == nil { + u.Object = make(map[string]interface{}) + } u.Object["apiVersion"] = gvk.GroupVersion().String() u.Object["kind"] = gvk.Kind } diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/testing/zz_generated.deepcopy.go b/vendor/k8s.io/apimachinery/pkg/runtime/testing/zz_generated.deepcopy.go index 1927e34c5..787bffe56 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/testing/zz_generated.deepcopy.go +++ b/vendor/k8s.io/apimachinery/pkg/runtime/testing/zz_generated.deepcopy.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This file was autogenerated by deepcopy-gen. Do not edit it manually! +// Code generated by deepcopy-gen. DO NOT EDIT. package testing @@ -55,9 +55,8 @@ func (in *EmbeddedTest) DeepCopy() *EmbeddedTest { func (in *EmbeddedTest) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -83,9 +82,8 @@ func (in *EmbeddedTestExternal) DeepCopy() *EmbeddedTestExternal { func (in *EmbeddedTestExternal) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -109,9 +107,8 @@ func (in *ExtensionA) DeepCopy() *ExtensionA { func (in *ExtensionA) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -135,9 +132,8 @@ func (in *ExtensionB) DeepCopy() *ExtensionB { func (in *ExtensionB) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -161,9 +157,8 @@ func (in *ExternalComplex) DeepCopy() *ExternalComplex { func (in *ExternalComplex) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -188,9 +183,8 @@ func (in *ExternalExtensionType) DeepCopy() *ExternalExtensionType { func (in *ExternalExtensionType) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -215,9 +209,8 @@ func (in *ExternalInternalSame) DeepCopy() *ExternalInternalSame { func (in *ExternalInternalSame) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -242,9 +235,8 @@ func (in *ExternalOptionalExtensionType) DeepCopy() *ExternalOptionalExtensionTy func (in *ExternalOptionalExtensionType) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -268,9 +260,8 @@ func (in *ExternalSimple) DeepCopy() *ExternalSimple { func (in *ExternalSimple) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -322,9 +313,8 @@ func (in *ExternalTestType1) DeepCopy() *ExternalTestType1 { func (in *ExternalTestType1) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -347,9 +337,8 @@ func (in *ExternalTestType2) DeepCopy() *ExternalTestType2 { func (in *ExternalTestType2) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -373,9 +362,8 @@ func (in *InternalComplex) DeepCopy() *InternalComplex { func (in *InternalComplex) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -404,9 +392,8 @@ func (in *InternalExtensionType) DeepCopy() *InternalExtensionType { func (in *InternalExtensionType) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -435,9 +422,8 @@ func (in *InternalOptionalExtensionType) DeepCopy() *InternalOptionalExtensionTy func (in *InternalOptionalExtensionType) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -461,9 +447,8 @@ func (in *InternalSimple) DeepCopy() *InternalSimple { func (in *InternalSimple) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -498,9 +483,8 @@ func (in *ObjectTest) DeepCopy() *ObjectTest { func (in *ObjectTest) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -531,9 +515,8 @@ func (in *ObjectTestExternal) DeepCopy() *ObjectTestExternal { func (in *ObjectTestExternal) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -585,9 +568,8 @@ func (in *TestType1) DeepCopy() *TestType1 { func (in *TestType1) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -610,9 +592,8 @@ func (in *TestType2) DeepCopy() *TestType2 { func (in *TestType2) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -636,9 +617,8 @@ func (in *UnknownType) DeepCopy() *UnknownType { func (in *UnknownType) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -662,7 +642,6 @@ func (in *UnversionedType) DeepCopy() *UnversionedType { func (in *UnversionedType) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/zz_generated.deepcopy.go b/vendor/k8s.io/apimachinery/pkg/runtime/zz_generated.deepcopy.go index 82cf19ce1..ba89cd235 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/zz_generated.deepcopy.go +++ b/vendor/k8s.io/apimachinery/pkg/runtime/zz_generated.deepcopy.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This file was autogenerated by deepcopy-gen. Do not edit it manually! +// Code generated by deepcopy-gen. DO NOT EDIT. package runtime @@ -72,9 +72,8 @@ func (in *Unknown) DeepCopy() *Unknown { func (in *Unknown) DeepCopyObject() Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -108,7 +107,6 @@ func (in *VersionedObjects) DeepCopy() *VersionedObjects { func (in *VersionedObjects) DeepCopyObject() Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } diff --git a/vendor/k8s.io/apimachinery/pkg/test/BUILD b/vendor/k8s.io/apimachinery/pkg/test/BUILD index c4946d52a..b7a2e4db3 100644 --- a/vendor/k8s.io/apimachinery/pkg/test/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/test/BUILD @@ -17,7 +17,6 @@ go_test( "runtime_unversioned_test.go", ], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/test", deps = [ "//vendor/github.com/google/gofuzz:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/equality:go_default_library", diff --git a/vendor/k8s.io/apimachinery/pkg/test/zz_generated.deepcopy.go b/vendor/k8s.io/apimachinery/pkg/test/zz_generated.deepcopy.go index bf67d1681..1a080acc7 100644 --- a/vendor/k8s.io/apimachinery/pkg/test/zz_generated.deepcopy.go +++ b/vendor/k8s.io/apimachinery/pkg/test/zz_generated.deepcopy.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This file was autogenerated by deepcopy-gen. Do not edit it manually! +// Code generated by deepcopy-gen. DO NOT EDIT. package test @@ -57,9 +57,8 @@ func (in *List) DeepCopy() *List { func (in *List) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -91,7 +90,6 @@ func (in *ListV1) DeepCopy() *ListV1 { func (in *ListV1) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c - } else { - return nil } + return nil } diff --git a/vendor/k8s.io/apimachinery/pkg/util/cache/BUILD b/vendor/k8s.io/apimachinery/pkg/util/cache/BUILD index 3b868ef57..2fcbae368 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/cache/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/util/cache/BUILD @@ -13,7 +13,6 @@ go_test( "lruexpirecache_test.go", ], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/util/cache", deps = [ "//vendor/github.com/golang/groupcache/lru:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/clock:go_default_library", diff --git a/vendor/k8s.io/apimachinery/pkg/util/clock/BUILD b/vendor/k8s.io/apimachinery/pkg/util/clock/BUILD index e5c117d66..a9f6be471 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/clock/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/util/clock/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["clock_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/util/clock", ) go_library( diff --git a/vendor/k8s.io/apimachinery/pkg/util/diff/BUILD b/vendor/k8s.io/apimachinery/pkg/util/diff/BUILD index 47d9732b0..3cd03b435 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/diff/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/util/diff/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["diff_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/util/diff", ) go_library( diff --git a/vendor/k8s.io/apimachinery/pkg/util/duration/BUILD b/vendor/k8s.io/apimachinery/pkg/util/duration/BUILD new file mode 100644 index 000000000..6b9e7880e --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/util/duration/BUILD @@ -0,0 +1,22 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = ["duration.go"], + importpath = "k8s.io/apimachinery/pkg/util/duration", + visibility = ["//visibility:public"], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +) diff --git a/vendor/k8s.io/apimachinery/pkg/util/duration/duration.go b/vendor/k8s.io/apimachinery/pkg/util/duration/duration.go new file mode 100644 index 000000000..00404c6cd --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/util/duration/duration.go @@ -0,0 +1,43 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package duration + +import ( + "fmt" + "time" +) + +// ShortHumanDuration returns a succint representation of the provided duration +// with limited precision for consumption by humans. +func ShortHumanDuration(d time.Duration) string { + // Allow deviation no more than 2 seconds(excluded) to tolerate machine time + // inconsistence, it can be considered as almost now. + if seconds := int(d.Seconds()); seconds < -1 { + return fmt.Sprintf("") + } else if seconds < 0 { + return fmt.Sprintf("0s") + } else if seconds < 60 { + return fmt.Sprintf("%ds", seconds) + } else if minutes := int(d.Minutes()); minutes < 60 { + return fmt.Sprintf("%dm", minutes) + } else if hours := int(d.Hours()); hours < 24 { + return fmt.Sprintf("%dh", hours) + } else if hours < 24*365 { + return fmt.Sprintf("%dd", hours/24) + } + return fmt.Sprintf("%dy", int(d.Hours()/24/365)) +} diff --git a/vendor/k8s.io/apimachinery/pkg/util/errors/BUILD b/vendor/k8s.io/apimachinery/pkg/util/errors/BUILD index 61999329a..fa2b74a2c 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/errors/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/util/errors/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["errors_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/util/errors", ) go_library( diff --git a/vendor/k8s.io/apimachinery/pkg/util/errors/errors.go b/vendor/k8s.io/apimachinery/pkg/util/errors/errors.go index 26e7eb208..88e937679 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/errors/errors.go +++ b/vendor/k8s.io/apimachinery/pkg/util/errors/errors.go @@ -21,7 +21,7 @@ import ( "fmt" ) -// MessageCountMap contains occurance for each error message. +// MessageCountMap contains occurrence for each error message. type MessageCountMap map[string]int // Aggregate represents an object that contains multiple errors, but does not diff --git a/vendor/k8s.io/apimachinery/pkg/util/framer/BUILD b/vendor/k8s.io/apimachinery/pkg/util/framer/BUILD index 8022f0aba..3a323b113 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/framer/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/util/framer/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["framer_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/util/framer", ) go_library( diff --git a/vendor/k8s.io/apimachinery/pkg/util/httpstream/BUILD b/vendor/k8s.io/apimachinery/pkg/util/httpstream/BUILD index 6450c3a6d..5d45073ef 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/httpstream/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/util/httpstream/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["httpstream_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/util/httpstream", ) go_library( diff --git a/vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/BUILD b/vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/BUILD index 278bf12ae..75d6ec0d1 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/BUILD @@ -14,7 +14,6 @@ go_test( "upgrade_test.go", ], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/util/httpstream/spdy", deps = [ "//vendor/github.com/elazarl/goproxy:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/httpstream:go_default_library", diff --git a/vendor/k8s.io/apimachinery/pkg/util/intstr/BUILD b/vendor/k8s.io/apimachinery/pkg/util/intstr/BUILD index b4fe3922f..73e62bcde 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/intstr/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/util/intstr/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["intstr_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/util/intstr", deps = ["//vendor/github.com/ghodss/yaml:go_default_library"], ) diff --git a/vendor/k8s.io/apimachinery/pkg/util/json/BUILD b/vendor/k8s.io/apimachinery/pkg/util/json/BUILD index 5838be3f7..c42821fc8 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/json/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/util/json/BUILD @@ -16,7 +16,6 @@ go_test( name = "go_default_test", srcs = ["json_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/util/json", ) filegroup( diff --git a/vendor/k8s.io/apimachinery/pkg/util/jsonmergepatch/BUILD b/vendor/k8s.io/apimachinery/pkg/util/jsonmergepatch/BUILD index 233ccad91..fcdebdb88 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/jsonmergepatch/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/util/jsonmergepatch/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["patch_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/util/jsonmergepatch", deps = [ "//vendor/github.com/davecgh/go-spew/spew:go_default_library", "//vendor/github.com/evanphx/json-patch:go_default_library", diff --git a/vendor/k8s.io/apimachinery/pkg/util/mergepatch/BUILD b/vendor/k8s.io/apimachinery/pkg/util/mergepatch/BUILD index 3f50c7618..0ddf97d1d 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/mergepatch/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/util/mergepatch/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["util_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/util/mergepatch", ) go_library( diff --git a/vendor/k8s.io/apimachinery/pkg/util/net/BUILD b/vendor/k8s.io/apimachinery/pkg/util/net/BUILD index 8f6999c92..9d0fffb11 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/net/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/util/net/BUILD @@ -16,7 +16,6 @@ go_test( "util_test.go", ], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/util/net", deps = ["//vendor/github.com/spf13/pflag:go_default_library"], ) diff --git a/vendor/k8s.io/apimachinery/pkg/util/net/interface_test.go b/vendor/k8s.io/apimachinery/pkg/util/net/interface_test.go index 5f42852ce..4799d43ae 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/net/interface_test.go +++ b/vendor/k8s.io/apimachinery/pkg/util/net/interface_test.go @@ -623,7 +623,7 @@ func TestFailGettingIPv4Routes(t *testing.T) { errStrFrag := "no such file" _, err := v4File.extract() if err == nil { - fmt.Errorf("Expected error trying to read non-existent v4 route file") + t.Errorf("Expected error trying to read non-existent v4 route file") } if !strings.Contains(err.Error(), errStrFrag) { t.Errorf("Unable to find %q in error string %q", errStrFrag, err.Error()) @@ -638,7 +638,7 @@ func TestFailGettingIPv6Routes(t *testing.T) { errStrFrag := "no such file" _, err := v6File.extract() if err == nil { - fmt.Errorf("Expected error trying to read non-existent v6 route file") + t.Errorf("Expected error trying to read non-existent v6 route file") } if !strings.Contains(err.Error(), errStrFrag) { t.Errorf("Unable to find %q in error string %q", errStrFrag, err.Error()) @@ -653,7 +653,7 @@ func TestGetAllDefaultRoutesFailNoV4RouteFile(t *testing.T) { errStrFrag := "no such file" _, err := getAllDefaultRoutes() if err == nil { - fmt.Errorf("Expected error trying to read non-existent v4 route file") + t.Errorf("Expected error trying to read non-existent v4 route file") } if !strings.Contains(err.Error(), errStrFrag) { t.Errorf("Unable to find %q in error string %q", errStrFrag, err.Error()) diff --git a/vendor/k8s.io/apimachinery/pkg/util/proxy/BUILD b/vendor/k8s.io/apimachinery/pkg/util/proxy/BUILD index 24083b248..69e9734cf 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/proxy/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/util/proxy/BUILD @@ -14,7 +14,6 @@ go_test( "upgradeaware_test.go", ], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/util/proxy", deps = [ "//vendor/github.com/stretchr/testify/assert:go_default_library", "//vendor/github.com/stretchr/testify/require:go_default_library", diff --git a/vendor/k8s.io/apimachinery/pkg/util/rand/BUILD b/vendor/k8s.io/apimachinery/pkg/util/rand/BUILD index 12254b4a2..27126ab59 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/rand/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/util/rand/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["rand_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/util/rand", ) go_library( diff --git a/vendor/k8s.io/apimachinery/pkg/util/rand/rand_test.go b/vendor/k8s.io/apimachinery/pkg/util/rand/rand_test.go index 7be656c40..517043a52 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/rand/rand_test.go +++ b/vendor/k8s.io/apimachinery/pkg/util/rand/rand_test.go @@ -36,7 +36,7 @@ func TestString(t *testing.T) { } for _, c := range s { if !strings.ContainsRune(valid, c) { - t.Errorf("expected valid charaters, got %v", c) + t.Errorf("expected valid characters, got %v", c) } } } diff --git a/vendor/k8s.io/apimachinery/pkg/util/runtime/BUILD b/vendor/k8s.io/apimachinery/pkg/util/runtime/BUILD index 521efc220..6407b8bd2 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/runtime/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/util/runtime/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["runtime_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/util/runtime", ) go_library( diff --git a/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go b/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go index 442dde7df..d4cec0b88 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go +++ b/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go @@ -43,7 +43,7 @@ var PanicHandlers = []func(interface{}){logPanic} // TODO: remove this function. We are switching to a world where it's safe for // apiserver to panic, since it will be restarted by kubelet. At the beginning // of the Kubernetes project, nothing was going to restart apiserver and so -// catching panics was important. But it's actually much simpler for montoring +// catching panics was important. But it's actually much simpler for monitoring // software if we just exit when an unexpected panic happens. func HandleCrash(additionalHandlers ...func(interface{})) { if r := recover(); r != nil { diff --git a/vendor/k8s.io/apimachinery/pkg/util/sets/BUILD b/vendor/k8s.io/apimachinery/pkg/util/sets/BUILD index 17bb4010e..ec2f23476 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/sets/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/util/sets/BUILD @@ -52,7 +52,6 @@ go_test( name = "go_default_test", srcs = ["set_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/util/sets", ) filegroup( diff --git a/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/BUILD b/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/BUILD index 2f4bcea4d..2d6088929 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/BUILD @@ -14,7 +14,6 @@ go_test( "testdata/swagger-precision-item.json", ], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/util/strategicpatch", deps = [ "//vendor/github.com/davecgh/go-spew/spew:go_default_library", "//vendor/github.com/ghodss/yaml:go_default_library", diff --git a/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go b/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go index 09dcd0fd5..2f6ade2be 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go +++ b/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go @@ -423,7 +423,7 @@ func normalizeElementOrder(patch, serverOnly, patchOrder, serverOrder []interfac // scan from the place of last insertion in `right` to the end of `right`, // the place is before the first item that is greater than the item we want to insert. // example usage: using server-only items as left and patch items as right. We insert server-only items -// to patch list. We use the order of live object as record for comparision. +// to patch list. We use the order of live object as record for comparison. func mergeSortedSlice(left, right, serverOrder []interface{}, mergeKey string, kind reflect.Kind) []interface{} { // Returns if l is less than r, and if both have been found. // If l and r both present and l is in front of r, l is less than r. @@ -2109,7 +2109,7 @@ func sliceTypeAssertion(original, patch interface{}) ([]interface{}, []interface } // extractRetainKeysPatchStrategy process patch strategy, which is a string may contains multiple -// patch strategies seperated by ",". It returns a boolean var indicating if it has +// patch strategies separated by ",". It returns a boolean var indicating if it has // retainKeys strategies and a string for the other strategy. func extractRetainKeysPatchStrategy(strategies []string) (bool, string, error) { switch len(strategies) { diff --git a/vendor/k8s.io/apimachinery/pkg/util/validation/BUILD b/vendor/k8s.io/apimachinery/pkg/util/validation/BUILD index 40ee23501..db599cbb7 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/validation/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/util/validation/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["validation_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/util/validation", deps = ["//vendor/k8s.io/apimachinery/pkg/util/validation/field:go_default_library"], ) diff --git a/vendor/k8s.io/apimachinery/pkg/util/validation/field/BUILD b/vendor/k8s.io/apimachinery/pkg/util/validation/field/BUILD index 6a2f815ed..fc59dd81c 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/validation/field/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/util/validation/field/BUILD @@ -13,7 +13,6 @@ go_test( "path_test.go", ], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/util/validation/field", ) go_library( diff --git a/vendor/k8s.io/apimachinery/pkg/util/validation/field/errors_test.go b/vendor/k8s.io/apimachinery/pkg/util/validation/field/errors_test.go index bff0d88e9..fe747319b 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/validation/field/errors_test.go +++ b/vendor/k8s.io/apimachinery/pkg/util/validation/field/errors_test.go @@ -99,7 +99,7 @@ func TestErrorUsefulMessage(t *testing.T) { "foo", ErrorTypeInvalid.String(), "Baz", "Qux", "Inner", "KV", "detail", "1", "aoeu", "Billy", "2", - // "asdf", TODO: reenable once we have a better nested printer + // "asdf", TODO: re-enable once we have a better nested printer } { if !strings.Contains(s, part) { t.Errorf("error message did not contain expected part '%v'", part) diff --git a/vendor/k8s.io/apimachinery/pkg/util/wait/BUILD b/vendor/k8s.io/apimachinery/pkg/util/wait/BUILD index 20046645a..c062f3818 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/wait/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/util/wait/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["wait_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/util/wait", deps = ["//vendor/k8s.io/apimachinery/pkg/util/runtime:go_default_library"], ) diff --git a/vendor/k8s.io/apimachinery/pkg/util/waitgroup/BUILD b/vendor/k8s.io/apimachinery/pkg/util/waitgroup/BUILD index a7ecb9d68..6cba6d176 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/waitgroup/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/util/waitgroup/BUILD @@ -14,7 +14,6 @@ go_test( name = "go_default_test", srcs = ["waitgroup_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/util/waitgroup", ) filegroup( diff --git a/vendor/k8s.io/apimachinery/pkg/util/waitgroup/waitgroup.go b/vendor/k8s.io/apimachinery/pkg/util/waitgroup/waitgroup.go index 488f56340..e080a5e92 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/waitgroup/waitgroup.go +++ b/vendor/k8s.io/apimachinery/pkg/util/waitgroup/waitgroup.go @@ -37,7 +37,7 @@ func (wg *SafeWaitGroup) Add(delta int) error { wg.mu.RLock() defer wg.mu.RUnlock() if wg.wait && delta > 0 { - return fmt.Errorf("add with postive delta after Wait is forbidden") + return fmt.Errorf("add with positive delta after Wait is forbidden") } wg.wg.Add(delta) return nil diff --git a/vendor/k8s.io/apimachinery/pkg/util/yaml/BUILD b/vendor/k8s.io/apimachinery/pkg/util/yaml/BUILD index 0208039a8..596ea292a 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/yaml/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/util/yaml/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["decoder_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/util/yaml", ) go_library( diff --git a/vendor/k8s.io/apimachinery/pkg/watch/BUILD b/vendor/k8s.io/apimachinery/pkg/watch/BUILD index 36c4ad64e..3106af8f1 100644 --- a/vendor/k8s.io/apimachinery/pkg/watch/BUILD +++ b/vendor/k8s.io/apimachinery/pkg/watch/BUILD @@ -36,7 +36,6 @@ go_test( "streamwatcher_test.go", "watch_test.go", ], - importpath = "k8s.io/apimachinery/pkg/watch_test", deps = [ "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", @@ -49,7 +48,6 @@ go_test( name = "go_default_test", srcs = ["until_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/pkg/watch", deps = [ "//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library", diff --git a/vendor/k8s.io/apimachinery/pkg/watch/zz_generated.deepcopy.go b/vendor/k8s.io/apimachinery/pkg/watch/zz_generated.deepcopy.go index 738d0a29c..b1b19d118 100644 --- a/vendor/k8s.io/apimachinery/pkg/watch/zz_generated.deepcopy.go +++ b/vendor/k8s.io/apimachinery/pkg/watch/zz_generated.deepcopy.go @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// This file was autogenerated by deepcopy-gen. Do not edit it manually! +// Code generated by deepcopy-gen. DO NOT EDIT. package watch diff --git a/vendor/k8s.io/apimachinery/third_party/forked/golang/json/BUILD b/vendor/k8s.io/apimachinery/third_party/forked/golang/json/BUILD index d4b5f696f..7ece664d0 100644 --- a/vendor/k8s.io/apimachinery/third_party/forked/golang/json/BUILD +++ b/vendor/k8s.io/apimachinery/third_party/forked/golang/json/BUILD @@ -16,7 +16,6 @@ go_test( name = "go_default_test", srcs = ["fields_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/third_party/forked/golang/json", ) filegroup( diff --git a/vendor/k8s.io/apimachinery/third_party/forked/golang/reflect/BUILD b/vendor/k8s.io/apimachinery/third_party/forked/golang/reflect/BUILD index 1069d9b93..22c8ec049 100644 --- a/vendor/k8s.io/apimachinery/third_party/forked/golang/reflect/BUILD +++ b/vendor/k8s.io/apimachinery/third_party/forked/golang/reflect/BUILD @@ -10,7 +10,6 @@ go_test( name = "go_default_test", srcs = ["deep_equal_test.go"], embed = [":go_default_library"], - importpath = "k8s.io/apimachinery/third_party/forked/golang/reflect", ) go_library( diff --git a/vendor/k8s.io/kube-openapi/Godeps/Godeps.json b/vendor/k8s.io/kube-openapi/Godeps/Godeps.json index 0e95fb3de..38032f652 100644 --- a/vendor/k8s.io/kube-openapi/Godeps/Godeps.json +++ b/vendor/k8s.io/kube-openapi/Godeps/Godeps.json @@ -6,6 +6,11 @@ "./..." ], "Deps": [ + { + "ImportPath": "bitbucket.org/ww/goautoneg", + "Comment": "null-5", + "Rev": "75cd24fc2f2c2a2088577d12123ddee5f54e0675" + }, { "ImportPath": "github.com/NYTimes/gziphandler", "Rev": "56545f4a5d46df9a6648819d1664c3a03a13ffdb" diff --git a/vendor/k8s.io/kube-openapi/pkg/handler/handler.go b/vendor/k8s.io/kube-openapi/pkg/handler/handler.go index 3ac304429..5a16cfcab 100644 --- a/vendor/k8s.io/kube-openapi/pkg/handler/handler.go +++ b/vendor/k8s.io/kube-openapi/pkg/handler/handler.go @@ -28,6 +28,8 @@ import ( "sync" "time" + "bitbucket.org/ww/goautoneg" + yaml "gopkg.in/yaml.v2" "github.com/NYTimes/gziphandler" @@ -79,7 +81,7 @@ func computeETag(data []byte) string { } // NOTE: [DEPRECATION] We will announce deprecation for format-separated endpoints for OpenAPI spec, -// and switch to a single /openapi/v2 endpoint in Kubernetes 1.9. The design doc and deprecation process +// and switch to a single /openapi/v2 endpoint in Kubernetes 1.10. The design doc and deprecation process // are tracked at: https://docs.google.com/document/d/19lEqE9lc4yHJ3WJAJxS_G7TcORIJXGHyq3wpwcH28nU. // // BuildAndRegisterOpenAPIService builds the spec and registers a handler to provides access to it. @@ -93,7 +95,7 @@ func BuildAndRegisterOpenAPIService(servePath string, webServices []*restful.Web } // NOTE: [DEPRECATION] We will announce deprecation for format-separated endpoints for OpenAPI spec, -// and switch to a single /openapi/v2 endpoint in Kubernetes 1.9. The design doc and deprecation process +// and switch to a single /openapi/v2 endpoint in Kubernetes 1.10. The design doc and deprecation process // are tracked at: https://docs.google.com/document/d/19lEqE9lc4yHJ3WJAJxS_G7TcORIJXGHyq3wpwcH28nU. // // RegisterOpenAPIService registers a handler to provides access to provided swagger spec. @@ -219,33 +221,43 @@ func RegisterOpenAPIVersionedService(openapiSpec *spec.Swagger, servePath string return nil, err } - files := map[string]func() ([]byte, string, time.Time){ - "application/json": o.getSwaggerBytes, - "application/com.github.proto-openapi.spec.v2@v1.0+protobuf": o.getSwaggerPbBytes, + accepted := []struct { + Type string + SubType string + GetDataAndETag func() ([]byte, string, time.Time) + }{ + {"application", "json", o.getSwaggerBytes}, + {"application", "com.github.proto-openapi.spec.v2@v1.0+protobuf", o.getSwaggerPbBytes}, } handler.Handle(servePath, gziphandler.GzipHandler(http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { - var getDataAndETag func() ([]byte, string, time.Time) - // Get the first value associated with header "Accept" - decipherableFormat := r.Header.Get("Accept") - if decipherableFormat == "" || decipherableFormat == "*/*" { - // If "Accept" header is not set or "*/*", serve json file as default - decipherableFormat = "application/json" + decipherableFormats := r.Header.Get("Accept") + if decipherableFormats == "" { + decipherableFormats = "*/*" } + clauses := goautoneg.ParseAccept(decipherableFormats) w.Header().Add("Vary", "Accept") - - getDataAndETag = files[decipherableFormat] - if getDataAndETag == nil { - // Return 406 for not acceptable format - w.WriteHeader(406) - return + for _, clause := range clauses { + for _, accepts := range accepted { + if clause.Type != accepts.Type && clause.Type != "*" { + continue + } + if clause.SubType != accepts.SubType && clause.SubType != "*" { + continue + } + + // serve the first matching media type in the sorted clause list + data, etag, lastModified := accepts.GetDataAndETag() + w.Header().Set("Etag", etag) + // ServeContent will take care of caching using eTag. + http.ServeContent(w, r, servePath, lastModified, bytes.NewReader(data)) + return + } } - data, etag, lastModified := getDataAndETag() - w.Header().Set("Etag", etag) - - // ServeContent will take care of caching using eTag. - http.ServeContent(w, r, servePath, lastModified, bytes.NewReader(data)) + // Return 406 for not acceptable format + w.WriteHeader(406) + return }), )) diff --git a/vendor/k8s.io/kube-openapi/pkg/handler/handler_test.go b/vendor/k8s.io/kube-openapi/pkg/handler/handler_test.go new file mode 100644 index 000000000..8d7146c10 --- /dev/null +++ b/vendor/k8s.io/kube-openapi/pkg/handler/handler_test.go @@ -0,0 +1,89 @@ +package handler + +import ( + "encoding/json" + "io/ioutil" + "net/http" + "net/http/httptest" + "reflect" + "testing" + + "github.com/go-openapi/spec" +) + +var returnedSwagger = []byte(`{ + "swagger": "2.0", + "info": { + "title": "Kubernetes", + "version": "v1.11.0" + }}`) + +func TestRegisterOpenAPIVersionedService(t *testing.T) { + var s spec.Swagger + err := s.UnmarshalJSON(returnedSwagger) + if err != nil { + t.Errorf("Unexpected error in unmarshalling SwaggerJSON: %v", err) + } + + returnedJSON, err := json.MarshalIndent(s, " ", " ") + if err != nil { + t.Errorf("Unexpected error in preparing returnedJSON: %v", err) + } + returnedPb, err := toProtoBinary(returnedJSON) + if err != nil { + t.Errorf("Unexpected error in preparing returnedPb: %v", err) + } + + mux := http.NewServeMux() + _, err = RegisterOpenAPIVersionedService(&s, "/openapi/v2", mux) + if err != nil { + t.Errorf("Unexpected error in register OpenAPI versioned service: %v", err) + } + server := httptest.NewServer(mux) + defer server.Close() + client := server.Client() + + tcs := []struct { + acceptHeader string + respStatus int + respBody []byte + }{ + {"", 200, returnedJSON}, + {"*/*", 200, returnedJSON}, + {"application/*", 200, returnedJSON}, + {"application/json", 200, returnedJSON}, + {"test/test", 406, []byte{}}, + {"application/test", 406, []byte{}}, + {"application/test, */*", 200, returnedJSON}, + {"application/test, application/json", 200, returnedJSON}, + {"application/com.github.proto-openapi.spec.v2@v1.0+protobuf", 200, returnedPb}, + {"application/json, application/com.github.proto-openapi.spec.v2@v1.0+protobuf", 200, returnedJSON}, + {"application/com.github.proto-openapi.spec.v2@v1.0+protobuf, application/json", 200, returnedPb}, + {"application/com.github.proto-openapi.spec.v2@v1.0+protobuf; q=0.5, application/json", 200, returnedJSON}, + } + + for _, tc := range tcs { + req, err := http.NewRequest("GET", server.URL+"/openapi/v2", nil) + if err != nil { + t.Errorf("Accept: %v: Unexpected error in creating new request: %v", tc.acceptHeader, err) + } + + req.Header.Add("Accept", tc.acceptHeader) + resp, err := client.Do(req) + if err != nil { + t.Errorf("Accept: %v: Unexpected error in serving HTTP request: %v", tc.acceptHeader, err) + } + + if resp.StatusCode != tc.respStatus { + t.Errorf("Accept: %v: Unexpected response status code, want: %v, got: %v", tc.acceptHeader, tc.respStatus, resp.StatusCode) + } + defer resp.Body.Close() + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + t.Errorf("Accept: %v: Unexpected error in reading response body: %v", tc.acceptHeader, err) + } + if !reflect.DeepEqual(body, tc.respBody) { + t.Errorf("Accept: %v: Response body mismatches, want: %v, got: %v", tc.acceptHeader, tc.respBody, body) + } + } +}