From 514a7081bd74cf8084f84b6c80bc19d0efb45dc1 Mon Sep 17 00:00:00 2001 From: shamaton Date: Thu, 15 Jan 2026 22:27:24 +0900 Subject: [PATCH 1/5] Default decoded time to UTC --- time/time.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/time/time.go b/time/time.go index 233bebf..8edde29 100644 --- a/time/time.go +++ b/time/time.go @@ -1,6 +1,6 @@ package time -var decodeAsLocal = true +var decodeAsLocal = false // SetDecodedAsLocal sets the decoded time to local time. func SetDecodedAsLocal(b bool) { From 28bb658e970d11d411f618d09580d20a49bee7e6 Mon Sep 17 00:00:00 2001 From: shamaton Date: Thu, 15 Jan 2026 22:34:33 +0900 Subject: [PATCH 2/5] Fix time tests for UTC defaults --- msgpack_test.go | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/msgpack_test.go b/msgpack_test.go index 0b42881..8e6c00f 100644 --- a/msgpack_test.go +++ b/msgpack_test.go @@ -25,7 +25,7 @@ var now time.Time func init() { n := time.Now() - now = time.Unix(n.Unix(), int64(n.Nanosecond())) + now = time.Unix(n.Unix(), int64(n.Nanosecond())).UTC() } func TestInt(t *testing.T) { @@ -515,7 +515,7 @@ func TestAny(t *testing.T) { []byte(strings.Repeat("a", math.MaxUint16+1)), []interface{}{1, "a", 1.23}, a1, a2, map[interface{}]interface{}{"1": 1, 1.23: "a"}, m1, m2, - time.Unix(now.Unix(), int64(now.Nanosecond())), + time.Unix(now.Unix(), int64(now.Nanosecond())).UTC(), } for i, v := range vars { @@ -553,7 +553,7 @@ func TestAny(t *testing.T) { {n: "Map3", v: any(map[any]any{"1": 1, 1.23: "a"})}, {n: "Map65535", v: any(m1)}, {n: "Map65536", v: any(m2)}, - {n: "Time", v: any(time.Unix(now.Unix(), int64(now.Nanosecond())))}, + {n: "Time", v: any(time.Unix(now.Unix(), int64(now.Nanosecond())).UTC())}, } for i := range args { i := i @@ -1315,14 +1315,14 @@ func TestTime(t *testing.T) { args := []encdecArg[time.Time]{ { n: "Fixext4", - v: time.Unix(now.Unix(), 0), + v: time.Unix(now.Unix(), 0).UTC(), c: func(d []byte) bool { return d[0] == def.Fixext4 }, }, { n: "Fixext8", - v: time.Unix(now.Unix(), int64(now.Nanosecond())), + v: time.Unix(now.Unix(), int64(now.Nanosecond())).UTC(), c: func(d []byte) bool { return d[0] == def.Fixext8 }, @@ -1376,7 +1376,25 @@ func TestTime(t *testing.T) { utc8 := time.FixedZone("UTC-8", -8*60*60) time.Local = utc8 - defer func() { time.Local = loc }() + t.Cleanup(func() { + time.Local = loc + msgpack.SetDecodedTimeAsUTC() + }) + t.Run("Default", func(t *testing.T) { + args := []encdecArg[time.Time]{ + { + n: "case", + v: time.Unix(now.Unix(), 0), + vc: func(r time.Time) error { + tu.Equal(t, now.Unix(), r.Unix()) + tu.Equal(t, r.Location(), time.UTC) + return nil + }, + skipEq: true, // skip equal check because of location difference + }, + } + encdec(t, args...) + }) t.Run("UTC", func(t *testing.T) { msgpack.SetDecodedTimeAsUTC() From 32bbf8df23fd79fda3e819bb010770ed84e99bb5 Mon Sep 17 00:00:00 2001 From: shamaton Date: Thu, 15 Jan 2026 22:38:02 +0900 Subject: [PATCH 3/5] Bump module path to v3 --- crash_test.go | 2 +- decode.go | 4 ++-- encode.go | 4 ++-- errors.go | 2 +- ext/decode.go | 2 +- ext/encode_stream.go | 2 +- go.mod | 4 ++-- internal/common/common_test.go | 2 +- internal/common/testutil/struct.go | 2 +- internal/decoding/bin.go | 2 +- internal/decoding/bin_test.go | 4 ++-- internal/decoding/bool.go | 2 +- internal/decoding/bool_test.go | 2 +- internal/decoding/complex.go | 2 +- internal/decoding/complex_test.go | 2 +- internal/decoding/decoding.go | 4 ++-- internal/decoding/decoding_test.go | 4 ++-- internal/decoding/ext.go | 4 ++-- internal/decoding/ext_test.go | 4 ++-- internal/decoding/float.go | 2 +- internal/decoding/float_test.go | 2 +- internal/decoding/int.go | 2 +- internal/decoding/int_test.go | 2 +- internal/decoding/interface.go | 2 +- internal/decoding/interface_test.go | 4 ++-- internal/decoding/map.go | 2 +- internal/decoding/map_test.go | 4 ++-- internal/decoding/nil.go | 2 +- internal/decoding/read.go | 2 +- internal/decoding/slice.go | 2 +- internal/decoding/slice_test.go | 4 ++-- internal/decoding/string.go | 2 +- internal/decoding/string_test.go | 2 +- internal/decoding/struct.go | 2 +- internal/decoding/struct_test.go | 4 ++-- internal/decoding/uint.go | 2 +- internal/decoding/uint_test.go | 2 +- internal/encoding/bool.go | 2 +- internal/encoding/byte.go | 2 +- internal/encoding/byte_test.go | 4 ++-- internal/encoding/complex.go | 2 +- internal/encoding/encoding.go | 4 ++-- internal/encoding/encoding_test.go | 4 ++-- internal/encoding/ext.go | 4 ++-- internal/encoding/ext_test.go | 4 ++-- internal/encoding/float.go | 2 +- internal/encoding/int.go | 2 +- internal/encoding/map.go | 2 +- internal/encoding/nil.go | 2 +- internal/encoding/slice.go | 2 +- internal/encoding/slice_test.go | 2 +- internal/encoding/string.go | 2 +- internal/encoding/struct.go | 4 ++-- internal/encoding/struct_test.go | 4 ++-- internal/encoding/uint.go | 2 +- internal/stream/decoding/bin.go | 2 +- internal/stream/decoding/bin_test.go | 4 ++-- internal/stream/decoding/bool.go | 2 +- internal/stream/decoding/bool_test.go | 2 +- internal/stream/decoding/complex.go | 2 +- internal/stream/decoding/complex_test.go | 2 +- internal/stream/decoding/decoding.go | 4 ++-- internal/stream/decoding/decoding_test.go | 6 +++--- internal/stream/decoding/ext.go | 6 +++--- internal/stream/decoding/ext_test.go | 8 ++++---- internal/stream/decoding/float.go | 2 +- internal/stream/decoding/float_test.go | 2 +- internal/stream/decoding/int.go | 2 +- internal/stream/decoding/int_test.go | 2 +- internal/stream/decoding/interface.go | 2 +- internal/stream/decoding/interface_test.go | 4 ++-- internal/stream/decoding/map.go | 2 +- internal/stream/decoding/map_test.go | 4 ++-- internal/stream/decoding/nil.go | 2 +- internal/stream/decoding/slice.go | 2 +- internal/stream/decoding/slice_test.go | 4 ++-- internal/stream/decoding/string.go | 4 ++-- internal/stream/decoding/string_test.go | 2 +- internal/stream/decoding/struct.go | 2 +- internal/stream/decoding/struct_test.go | 4 ++-- internal/stream/decoding/uint.go | 2 +- internal/stream/decoding/uint_test.go | 6 +++--- internal/stream/encoding/bool.go | 2 +- internal/stream/encoding/bool_test.go | 2 +- internal/stream/encoding/byte.go | 2 +- internal/stream/encoding/byte_test.go | 2 +- internal/stream/encoding/complex.go | 2 +- internal/stream/encoding/complex_test.go | 2 +- internal/stream/encoding/encoding.go | 4 ++-- internal/stream/encoding/encoding_test.go | 6 +++--- internal/stream/encoding/ext.go | 4 ++-- internal/stream/encoding/ext_test.go | 4 ++-- internal/stream/encoding/float.go | 2 +- internal/stream/encoding/float_test.go | 2 +- internal/stream/encoding/int.go | 2 +- internal/stream/encoding/int_test.go | 2 +- internal/stream/encoding/map.go | 2 +- internal/stream/encoding/map_test.go | 2 +- internal/stream/encoding/nil.go | 2 +- internal/stream/encoding/slice.go | 2 +- internal/stream/encoding/slice_test.go | 2 +- internal/stream/encoding/string.go | 2 +- internal/stream/encoding/string_test.go | 2 +- internal/stream/encoding/struct.go | 6 +++--- internal/stream/encoding/struct_test.go | 4 ++-- internal/stream/encoding/uint.go | 2 +- internal/stream/encoding/uint_test.go | 2 +- msgpack.go | 14 +++++++------- msgpack_example_test.go | 6 +++--- msgpack_test.go | 10 +++++----- time/decode.go | 4 ++-- time/decode_stream.go | 4 ++-- time/decode_stream_test.go | 4 ++-- time/decode_test.go | 4 ++-- time/encode.go | 4 ++-- time/encode_stream.go | 4 ++-- time/encode_stream_test.go | 8 ++++---- time/encode_test.go | 4 ++-- 118 files changed, 183 insertions(+), 183 deletions(-) diff --git a/crash_test.go b/crash_test.go index 0bcc67d..58d0b9f 100644 --- a/crash_test.go +++ b/crash_test.go @@ -8,7 +8,7 @@ import ( "sync" "testing" - "github.com/shamaton/msgpack/v2" + "github.com/shamaton/msgpack/v3" ) var crashDir = filepath.Join("testdata", "crashers") diff --git a/decode.go b/decode.go index a6d1800..dbef1b8 100644 --- a/decode.go +++ b/decode.go @@ -3,8 +3,8 @@ package msgpack import ( "io" - "github.com/shamaton/msgpack/v2/internal/decoding" - streamdecoding "github.com/shamaton/msgpack/v2/internal/stream/decoding" + "github.com/shamaton/msgpack/v3/internal/decoding" + streamdecoding "github.com/shamaton/msgpack/v3/internal/stream/decoding" ) // UnmarshalAsMap decodes data that is encoded as map format. diff --git a/encode.go b/encode.go index a188bea..52b6df7 100644 --- a/encode.go +++ b/encode.go @@ -3,8 +3,8 @@ package msgpack import ( "io" - "github.com/shamaton/msgpack/v2/internal/encoding" - streamencoding "github.com/shamaton/msgpack/v2/internal/stream/encoding" + "github.com/shamaton/msgpack/v3/internal/encoding" + streamencoding "github.com/shamaton/msgpack/v3/internal/stream/encoding" ) // MarshalAsMap encodes data as map format. diff --git a/errors.go b/errors.go index 59e7916..f90c3ad 100644 --- a/errors.go +++ b/errors.go @@ -1,7 +1,7 @@ package msgpack import ( - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) // Error is used in all msgpack error as the based error. diff --git a/ext/decode.go b/ext/decode.go index 6cae0eb..e60eab7 100644 --- a/ext/decode.go +++ b/ext/decode.go @@ -3,7 +3,7 @@ package ext import ( "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) // Decoder defines an interface for decoding values from bytes. diff --git a/ext/encode_stream.go b/ext/encode_stream.go index 0172792..0df7927 100644 --- a/ext/encode_stream.go +++ b/ext/encode_stream.go @@ -4,7 +4,7 @@ import ( "io" "reflect" - "github.com/shamaton/msgpack/v2/internal/common" + "github.com/shamaton/msgpack/v3/internal/common" ) // StreamEncoder is an interface that extended encoders should implement. diff --git a/go.mod b/go.mod index 8dbbab6..38967da 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module github.com/shamaton/msgpack/v2 +module github.com/shamaton/msgpack/v3 -go 1.20 +go 1.23 diff --git a/internal/common/common_test.go b/internal/common/common_test.go index 679a523..51fe908 100644 --- a/internal/common/common_test.go +++ b/internal/common/common_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" ) func TestCommon_CheckField(t *testing.T) { diff --git a/internal/common/testutil/struct.go b/internal/common/testutil/struct.go index ab8b545..366e2db 100644 --- a/internal/common/testutil/struct.go +++ b/internal/common/testutil/struct.go @@ -5,7 +5,7 @@ import ( "reflect" "strconv" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) // CreateStruct returns a struct that is made dynamically and encoded bytes. diff --git a/internal/decoding/bin.go b/internal/decoding/bin.go index 65fb859..6feef55 100644 --- a/internal/decoding/bin.go +++ b/internal/decoding/bin.go @@ -5,7 +5,7 @@ import ( "reflect" "unsafe" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (d *decoder) isCodeBin(v byte) bool { diff --git a/internal/decoding/bin_test.go b/internal/decoding/bin_test.go index d20df30..09eb2e5 100644 --- a/internal/decoding/bin_test.go +++ b/internal/decoding/bin_test.go @@ -4,8 +4,8 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" + "github.com/shamaton/msgpack/v3/def" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" ) func Test_isCodeBin(t *testing.T) { diff --git a/internal/decoding/bool.go b/internal/decoding/bool.go index 7d8809c..e5bdc7d 100644 --- a/internal/decoding/bool.go +++ b/internal/decoding/bool.go @@ -3,7 +3,7 @@ package decoding import ( "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (d *decoder) asBool(offset int, k reflect.Kind) (bool, int, error) { diff --git a/internal/decoding/bool_test.go b/internal/decoding/bool_test.go index e232dd1..3793a23 100644 --- a/internal/decoding/bool_test.go +++ b/internal/decoding/bool_test.go @@ -1,7 +1,7 @@ package decoding import ( - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" "reflect" "testing" ) diff --git a/internal/decoding/complex.go b/internal/decoding/complex.go index 3b4d741..4990342 100644 --- a/internal/decoding/complex.go +++ b/internal/decoding/complex.go @@ -6,7 +6,7 @@ import ( "math" "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (d *decoder) asComplex64(offset int, k reflect.Kind) (complex64, int, error) { diff --git a/internal/decoding/complex_test.go b/internal/decoding/complex_test.go index 87af7e0..1bd4e6e 100644 --- a/internal/decoding/complex_test.go +++ b/internal/decoding/complex_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func Test_asComplex64(t *testing.T) { diff --git a/internal/decoding/decoding.go b/internal/decoding/decoding.go index e81c174..94e2452 100644 --- a/internal/decoding/decoding.go +++ b/internal/decoding/decoding.go @@ -4,8 +4,8 @@ import ( "fmt" "reflect" - "github.com/shamaton/msgpack/v2/def" - "github.com/shamaton/msgpack/v2/internal/common" + "github.com/shamaton/msgpack/v3/def" + "github.com/shamaton/msgpack/v3/internal/common" ) type decoder struct { diff --git a/internal/decoding/decoding_test.go b/internal/decoding/decoding_test.go index 1b8d11f..46823c1 100644 --- a/internal/decoding/decoding_test.go +++ b/internal/decoding/decoding_test.go @@ -4,8 +4,8 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" + "github.com/shamaton/msgpack/v3/def" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" ) type AsXXXTestCase[T any] struct { diff --git a/internal/decoding/ext.go b/internal/decoding/ext.go index a8567a8..0fdc45c 100644 --- a/internal/decoding/ext.go +++ b/internal/decoding/ext.go @@ -1,8 +1,8 @@ package decoding import ( - "github.com/shamaton/msgpack/v2/ext" - "github.com/shamaton/msgpack/v2/time" + "github.com/shamaton/msgpack/v3/ext" + "github.com/shamaton/msgpack/v3/time" ) var extCoderMap = map[int8]ext.Decoder{time.Decoder.Code(): time.Decoder} diff --git a/internal/decoding/ext_test.go b/internal/decoding/ext_test.go index 51160b3..8d0d5e9 100644 --- a/internal/decoding/ext_test.go +++ b/internal/decoding/ext_test.go @@ -3,8 +3,8 @@ package decoding import ( "testing" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" - "github.com/shamaton/msgpack/v2/time" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" + "github.com/shamaton/msgpack/v3/time" ) func Test_AddExtDecoder(t *testing.T) { diff --git a/internal/decoding/float.go b/internal/decoding/float.go index 62f9e0b..05de1b2 100644 --- a/internal/decoding/float.go +++ b/internal/decoding/float.go @@ -5,7 +5,7 @@ import ( "math" "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (d *decoder) asFloat32(offset int, k reflect.Kind) (float32, int, error) { diff --git a/internal/decoding/float_test.go b/internal/decoding/float_test.go index 5fa75b5..84f7327 100644 --- a/internal/decoding/float_test.go +++ b/internal/decoding/float_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func Test_asFloat32(t *testing.T) { diff --git a/internal/decoding/int.go b/internal/decoding/int.go index 92967eb..ec2c916 100644 --- a/internal/decoding/int.go +++ b/internal/decoding/int.go @@ -4,7 +4,7 @@ import ( "encoding/binary" "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (d *decoder) isPositiveFixNum(v byte) bool { diff --git a/internal/decoding/int_test.go b/internal/decoding/int_test.go index 03d1b68..086dd7a 100644 --- a/internal/decoding/int_test.go +++ b/internal/decoding/int_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func Test_asInt(t *testing.T) { diff --git a/internal/decoding/interface.go b/internal/decoding/interface.go index c47a581..9760558 100644 --- a/internal/decoding/interface.go +++ b/internal/decoding/interface.go @@ -4,7 +4,7 @@ import ( "fmt" "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (d *decoder) asInterface(offset int, k reflect.Kind) (interface{}, int, error) { diff --git a/internal/decoding/interface_test.go b/internal/decoding/interface_test.go index c37b3d6..9533d92 100644 --- a/internal/decoding/interface_test.go +++ b/internal/decoding/interface_test.go @@ -5,8 +5,8 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" - "github.com/shamaton/msgpack/v2/ext" + "github.com/shamaton/msgpack/v3/def" + "github.com/shamaton/msgpack/v3/ext" ) func Test_asInterfaceWithCode(t *testing.T) { diff --git a/internal/decoding/map.go b/internal/decoding/map.go index 9463700..4cc1194 100644 --- a/internal/decoding/map.go +++ b/internal/decoding/map.go @@ -4,7 +4,7 @@ import ( "encoding/binary" "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) var ( diff --git a/internal/decoding/map_test.go b/internal/decoding/map_test.go index 21d5ab9..ccd81b5 100644 --- a/internal/decoding/map_test.go +++ b/internal/decoding/map_test.go @@ -6,8 +6,8 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" + "github.com/shamaton/msgpack/v3/def" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" ) func Test_mapLength(t *testing.T) { diff --git a/internal/decoding/nil.go b/internal/decoding/nil.go index d06318b..ac7734a 100644 --- a/internal/decoding/nil.go +++ b/internal/decoding/nil.go @@ -1,6 +1,6 @@ package decoding -import "github.com/shamaton/msgpack/v2/def" +import "github.com/shamaton/msgpack/v3/def" func (d *decoder) isCodeNil(v byte) bool { return def.Nil == v diff --git a/internal/decoding/read.go b/internal/decoding/read.go index dcb9e32..0b4e87e 100644 --- a/internal/decoding/read.go +++ b/internal/decoding/read.go @@ -1,7 +1,7 @@ package decoding import ( - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (d *decoder) readSize1(index int) (byte, int, error) { diff --git a/internal/decoding/slice.go b/internal/decoding/slice.go index fa4b1aa..f577b9c 100644 --- a/internal/decoding/slice.go +++ b/internal/decoding/slice.go @@ -4,7 +4,7 @@ import ( "encoding/binary" "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) var ( diff --git a/internal/decoding/slice_test.go b/internal/decoding/slice_test.go index 66fb0bb..49673a7 100644 --- a/internal/decoding/slice_test.go +++ b/internal/decoding/slice_test.go @@ -5,8 +5,8 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" + "github.com/shamaton/msgpack/v3/def" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" ) func Test_sliceLength(t *testing.T) { diff --git a/internal/decoding/string.go b/internal/decoding/string.go index 9aaf74d..5a72ce0 100644 --- a/internal/decoding/string.go +++ b/internal/decoding/string.go @@ -4,7 +4,7 @@ import ( "encoding/binary" "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) var emptyString = "" diff --git a/internal/decoding/string_test.go b/internal/decoding/string_test.go index f15c153..a85f347 100644 --- a/internal/decoding/string_test.go +++ b/internal/decoding/string_test.go @@ -5,7 +5,7 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func Test_stringByteLength(t *testing.T) { diff --git a/internal/decoding/struct.go b/internal/decoding/struct.go index 5af60b1..edc71f3 100644 --- a/internal/decoding/struct.go +++ b/internal/decoding/struct.go @@ -5,7 +5,7 @@ import ( "reflect" "sync" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) type structCacheTypeMap struct { diff --git a/internal/decoding/struct_test.go b/internal/decoding/struct_test.go index c272dab..845ce81 100644 --- a/internal/decoding/struct_test.go +++ b/internal/decoding/struct_test.go @@ -5,8 +5,8 @@ import ( "testing" "time" - "github.com/shamaton/msgpack/v2/def" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" + "github.com/shamaton/msgpack/v3/def" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" ) func Test_setStruct_ext(t *testing.T) { diff --git a/internal/decoding/uint.go b/internal/decoding/uint.go index cd739fc..beb2503 100644 --- a/internal/decoding/uint.go +++ b/internal/decoding/uint.go @@ -4,7 +4,7 @@ import ( "encoding/binary" "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (d *decoder) asUint(offset int, k reflect.Kind) (uint64, int, error) { diff --git a/internal/decoding/uint_test.go b/internal/decoding/uint_test.go index d16705e..29c8e27 100644 --- a/internal/decoding/uint_test.go +++ b/internal/decoding/uint_test.go @@ -5,7 +5,7 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func Test_asUint(t *testing.T) { diff --git a/internal/encoding/bool.go b/internal/encoding/bool.go index 34be05b..5434605 100644 --- a/internal/encoding/bool.go +++ b/internal/encoding/bool.go @@ -1,6 +1,6 @@ package encoding -import "github.com/shamaton/msgpack/v2/def" +import "github.com/shamaton/msgpack/v3/def" //func (e *encoder) calcBool() int { // return 0 diff --git a/internal/encoding/byte.go b/internal/encoding/byte.go index cbd5a7d..6f8d19c 100644 --- a/internal/encoding/byte.go +++ b/internal/encoding/byte.go @@ -5,7 +5,7 @@ import ( "math" "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) var typeByte = reflect.TypeOf(byte(0)) diff --git a/internal/encoding/byte_test.go b/internal/encoding/byte_test.go index b629b00..206929e 100644 --- a/internal/encoding/byte_test.go +++ b/internal/encoding/byte_test.go @@ -4,9 +4,9 @@ import ( "math" "testing" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" ) func Test_calcByteSlice(t *testing.T) { diff --git a/internal/encoding/complex.go b/internal/encoding/complex.go index be640c0..c11697f 100644 --- a/internal/encoding/complex.go +++ b/internal/encoding/complex.go @@ -3,7 +3,7 @@ package encoding import ( "math" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (e *encoder) calcComplex64() int { diff --git a/internal/encoding/encoding.go b/internal/encoding/encoding.go index 62081b5..24270fd 100644 --- a/internal/encoding/encoding.go +++ b/internal/encoding/encoding.go @@ -5,8 +5,8 @@ import ( "math" "reflect" - "github.com/shamaton/msgpack/v2/def" - "github.com/shamaton/msgpack/v2/internal/common" + "github.com/shamaton/msgpack/v3/def" + "github.com/shamaton/msgpack/v3/internal/common" ) type encoder struct { diff --git a/internal/encoding/encoding_test.go b/internal/encoding/encoding_test.go index 1dc59e8..e3f855d 100644 --- a/internal/encoding/encoding_test.go +++ b/internal/encoding/encoding_test.go @@ -6,9 +6,9 @@ import ( "strconv" "testing" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" ) func TestEncode(t *testing.T) { diff --git a/internal/encoding/ext.go b/internal/encoding/ext.go index c90f7fd..f7d9ae3 100644 --- a/internal/encoding/ext.go +++ b/internal/encoding/ext.go @@ -3,8 +3,8 @@ package encoding import ( "reflect" - "github.com/shamaton/msgpack/v2/ext" - "github.com/shamaton/msgpack/v2/time" + "github.com/shamaton/msgpack/v3/ext" + "github.com/shamaton/msgpack/v3/time" ) var extCoderMap = map[reflect.Type]ext.Encoder{time.Encoder.Type(): time.Encoder} diff --git a/internal/encoding/ext_test.go b/internal/encoding/ext_test.go index 2d70119..86b27c3 100644 --- a/internal/encoding/ext_test.go +++ b/internal/encoding/ext_test.go @@ -3,8 +3,8 @@ package encoding import ( "testing" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" - "github.com/shamaton/msgpack/v2/time" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" + "github.com/shamaton/msgpack/v3/time" ) func Test_AddExtEncoder(t *testing.T) { diff --git a/internal/encoding/float.go b/internal/encoding/float.go index 34eef06..a4f9921 100644 --- a/internal/encoding/float.go +++ b/internal/encoding/float.go @@ -3,7 +3,7 @@ package encoding import ( "math" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (e *encoder) calcFloat32(_ float64) int { diff --git a/internal/encoding/int.go b/internal/encoding/int.go index d5c7fd9..df79b56 100644 --- a/internal/encoding/int.go +++ b/internal/encoding/int.go @@ -3,7 +3,7 @@ package encoding import ( "math" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (e *encoder) isNegativeFixInt64(v int64) bool { diff --git a/internal/encoding/map.go b/internal/encoding/map.go index 78ac977..112fd43 100644 --- a/internal/encoding/map.go +++ b/internal/encoding/map.go @@ -4,7 +4,7 @@ import ( "math" "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (e *encoder) calcFixedMap(rv reflect.Value) (int, bool) { diff --git a/internal/encoding/nil.go b/internal/encoding/nil.go index 7cd582a..d5d583e 100644 --- a/internal/encoding/nil.go +++ b/internal/encoding/nil.go @@ -1,6 +1,6 @@ package encoding -import "github.com/shamaton/msgpack/v2/def" +import "github.com/shamaton/msgpack/v3/def" func (e *encoder) writeNil(offset int) int { offset = e.setByte1Int(def.Nil, offset) diff --git a/internal/encoding/slice.go b/internal/encoding/slice.go index bae88c4..aea84c4 100644 --- a/internal/encoding/slice.go +++ b/internal/encoding/slice.go @@ -4,7 +4,7 @@ import ( "math" "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (e *encoder) calcFixedSlice(rv reflect.Value) (int, bool) { diff --git a/internal/encoding/slice_test.go b/internal/encoding/slice_test.go index 3eb6e94..dfae13a 100644 --- a/internal/encoding/slice_test.go +++ b/internal/encoding/slice_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" ) func Test_FixedSlice(t *testing.T) { diff --git a/internal/encoding/string.go b/internal/encoding/string.go index 34cff10..3e91990 100644 --- a/internal/encoding/string.go +++ b/internal/encoding/string.go @@ -4,7 +4,7 @@ import ( "math" "unsafe" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (e *encoder) calcString(v string) int { diff --git a/internal/encoding/struct.go b/internal/encoding/struct.go index 3b6ed30..8c41be6 100644 --- a/internal/encoding/struct.go +++ b/internal/encoding/struct.go @@ -5,8 +5,8 @@ import ( "reflect" "sync" - "github.com/shamaton/msgpack/v2/def" - "github.com/shamaton/msgpack/v2/internal/common" + "github.com/shamaton/msgpack/v3/def" + "github.com/shamaton/msgpack/v3/internal/common" ) type structCache struct { diff --git a/internal/encoding/struct_test.go b/internal/encoding/struct_test.go index cc01b34..cf055b9 100644 --- a/internal/encoding/struct_test.go +++ b/internal/encoding/struct_test.go @@ -5,8 +5,8 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" + "github.com/shamaton/msgpack/v3/def" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" ) func Test_calcStructArray(t *testing.T) { diff --git a/internal/encoding/uint.go b/internal/encoding/uint.go index 4c093b7..a4bb0fa 100644 --- a/internal/encoding/uint.go +++ b/internal/encoding/uint.go @@ -3,7 +3,7 @@ package encoding import ( "math" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (e *encoder) calcUint(v uint64) int { diff --git a/internal/stream/decoding/bin.go b/internal/stream/decoding/bin.go index ed3fce8..54c41e9 100644 --- a/internal/stream/decoding/bin.go +++ b/internal/stream/decoding/bin.go @@ -5,7 +5,7 @@ import ( "reflect" "unsafe" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (d *decoder) isCodeBin(v byte) bool { diff --git a/internal/stream/decoding/bin_test.go b/internal/stream/decoding/bin_test.go index 50a4c4a..793a14b 100644 --- a/internal/stream/decoding/bin_test.go +++ b/internal/stream/decoding/bin_test.go @@ -5,8 +5,8 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" + "github.com/shamaton/msgpack/v3/def" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" ) func Test_isCodeBin(t *testing.T) { diff --git a/internal/stream/decoding/bool.go b/internal/stream/decoding/bool.go index 687b784..82fa5fb 100644 --- a/internal/stream/decoding/bool.go +++ b/internal/stream/decoding/bool.go @@ -3,7 +3,7 @@ package decoding import ( "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (d *decoder) asBool(k reflect.Kind) (bool, error) { diff --git a/internal/stream/decoding/bool_test.go b/internal/stream/decoding/bool_test.go index 72f9ec3..30f588b 100644 --- a/internal/stream/decoding/bool_test.go +++ b/internal/stream/decoding/bool_test.go @@ -5,7 +5,7 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func Test_asBool(t *testing.T) { diff --git a/internal/stream/decoding/complex.go b/internal/stream/decoding/complex.go index 07471d2..a943d78 100644 --- a/internal/stream/decoding/complex.go +++ b/internal/stream/decoding/complex.go @@ -6,7 +6,7 @@ import ( "math" "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (d *decoder) asComplex64(code byte, k reflect.Kind) (complex64, error) { diff --git a/internal/stream/decoding/complex_test.go b/internal/stream/decoding/complex_test.go index 4c541ed..ab209ed 100644 --- a/internal/stream/decoding/complex_test.go +++ b/internal/stream/decoding/complex_test.go @@ -5,7 +5,7 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func Test_asComplex64(t *testing.T) { diff --git a/internal/stream/decoding/decoding.go b/internal/stream/decoding/decoding.go index d2e452c..ca1da24 100644 --- a/internal/stream/decoding/decoding.go +++ b/internal/stream/decoding/decoding.go @@ -5,8 +5,8 @@ import ( "io" "reflect" - "github.com/shamaton/msgpack/v2/def" - "github.com/shamaton/msgpack/v2/internal/common" + "github.com/shamaton/msgpack/v3/def" + "github.com/shamaton/msgpack/v3/internal/common" ) type decoder struct { diff --git a/internal/stream/decoding/decoding_test.go b/internal/stream/decoding/decoding_test.go index fc10c34..55cc627 100644 --- a/internal/stream/decoding/decoding_test.go +++ b/internal/stream/decoding/decoding_test.go @@ -5,10 +5,10 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" - "github.com/shamaton/msgpack/v2/internal/common" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" + "github.com/shamaton/msgpack/v3/internal/common" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" ) type AsXXXTestCase[T any] struct { diff --git a/internal/stream/decoding/ext.go b/internal/stream/decoding/ext.go index 4324705..caba2ec 100644 --- a/internal/stream/decoding/ext.go +++ b/internal/stream/decoding/ext.go @@ -2,9 +2,9 @@ package decoding import ( "encoding/binary" - "github.com/shamaton/msgpack/v2/def" - "github.com/shamaton/msgpack/v2/ext" - "github.com/shamaton/msgpack/v2/time" + "github.com/shamaton/msgpack/v3/def" + "github.com/shamaton/msgpack/v3/ext" + "github.com/shamaton/msgpack/v3/time" ) var extCoderMap = map[int8]ext.StreamDecoder{time.StreamDecoder.Code(): time.StreamDecoder} diff --git a/internal/stream/decoding/ext_test.go b/internal/stream/decoding/ext_test.go index 7f206d4..624d0c1 100644 --- a/internal/stream/decoding/ext_test.go +++ b/internal/stream/decoding/ext_test.go @@ -4,10 +4,10 @@ import ( "io" "testing" - "github.com/shamaton/msgpack/v2/def" - "github.com/shamaton/msgpack/v2/internal/common" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" - "github.com/shamaton/msgpack/v2/time" + "github.com/shamaton/msgpack/v3/def" + "github.com/shamaton/msgpack/v3/internal/common" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" + "github.com/shamaton/msgpack/v3/time" ) func Test_AddExtDecoder(t *testing.T) { diff --git a/internal/stream/decoding/float.go b/internal/stream/decoding/float.go index 51c1887..967cd91 100644 --- a/internal/stream/decoding/float.go +++ b/internal/stream/decoding/float.go @@ -5,7 +5,7 @@ import ( "math" "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (d *decoder) asFloat32(k reflect.Kind) (float32, error) { diff --git a/internal/stream/decoding/float_test.go b/internal/stream/decoding/float_test.go index d4b59ea..06aa8c1 100644 --- a/internal/stream/decoding/float_test.go +++ b/internal/stream/decoding/float_test.go @@ -5,7 +5,7 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func Test_asFloat32(t *testing.T) { diff --git a/internal/stream/decoding/int.go b/internal/stream/decoding/int.go index 1170797..8c505d4 100644 --- a/internal/stream/decoding/int.go +++ b/internal/stream/decoding/int.go @@ -4,7 +4,7 @@ import ( "encoding/binary" "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (d *decoder) isPositiveFixNum(v byte) bool { diff --git a/internal/stream/decoding/int_test.go b/internal/stream/decoding/int_test.go index 65c6479..b57f05c 100644 --- a/internal/stream/decoding/int_test.go +++ b/internal/stream/decoding/int_test.go @@ -5,7 +5,7 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func Test_asInt(t *testing.T) { diff --git a/internal/stream/decoding/interface.go b/internal/stream/decoding/interface.go index d220214..692e916 100644 --- a/internal/stream/decoding/interface.go +++ b/internal/stream/decoding/interface.go @@ -4,7 +4,7 @@ import ( "fmt" "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (d *decoder) asInterface(k reflect.Kind) (interface{}, error) { diff --git a/internal/stream/decoding/interface_test.go b/internal/stream/decoding/interface_test.go index 6f0b826..ce25c53 100644 --- a/internal/stream/decoding/interface_test.go +++ b/internal/stream/decoding/interface_test.go @@ -6,8 +6,8 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" - "github.com/shamaton/msgpack/v2/ext" + "github.com/shamaton/msgpack/v3/def" + "github.com/shamaton/msgpack/v3/ext" ) func Test_asInterface(t *testing.T) { diff --git a/internal/stream/decoding/map.go b/internal/stream/decoding/map.go index 3af27d6..ce2f10b 100644 --- a/internal/stream/decoding/map.go +++ b/internal/stream/decoding/map.go @@ -4,7 +4,7 @@ import ( "encoding/binary" "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) var ( diff --git a/internal/stream/decoding/map_test.go b/internal/stream/decoding/map_test.go index 77e660e..50bc1b5 100644 --- a/internal/stream/decoding/map_test.go +++ b/internal/stream/decoding/map_test.go @@ -7,8 +7,8 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" + "github.com/shamaton/msgpack/v3/def" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" ) func Test_mapLength(t *testing.T) { diff --git a/internal/stream/decoding/nil.go b/internal/stream/decoding/nil.go index d06318b..ac7734a 100644 --- a/internal/stream/decoding/nil.go +++ b/internal/stream/decoding/nil.go @@ -1,6 +1,6 @@ package decoding -import "github.com/shamaton/msgpack/v2/def" +import "github.com/shamaton/msgpack/v3/def" func (d *decoder) isCodeNil(v byte) bool { return def.Nil == v diff --git a/internal/stream/decoding/slice.go b/internal/stream/decoding/slice.go index 98e81fb..f0aceed 100644 --- a/internal/stream/decoding/slice.go +++ b/internal/stream/decoding/slice.go @@ -4,7 +4,7 @@ import ( "encoding/binary" "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) var ( diff --git a/internal/stream/decoding/slice_test.go b/internal/stream/decoding/slice_test.go index 5a7b223..a318e08 100644 --- a/internal/stream/decoding/slice_test.go +++ b/internal/stream/decoding/slice_test.go @@ -6,8 +6,8 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" + "github.com/shamaton/msgpack/v3/def" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" ) func Test_sliceLength(t *testing.T) { diff --git a/internal/stream/decoding/string.go b/internal/stream/decoding/string.go index c756465..68f31d7 100644 --- a/internal/stream/decoding/string.go +++ b/internal/stream/decoding/string.go @@ -4,7 +4,7 @@ import ( "encoding/binary" "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) var emptyString = "" @@ -83,7 +83,7 @@ func (d *decoder) asStringByteByLength(l int, _ reflect.Kind) ([]byte, error) { if l < 1 { return emptyBytes, nil } - + // avoid common buffer reference return d.copySizeN(l) } diff --git a/internal/stream/decoding/string_test.go b/internal/stream/decoding/string_test.go index 9b32727..0b7066a 100644 --- a/internal/stream/decoding/string_test.go +++ b/internal/stream/decoding/string_test.go @@ -6,7 +6,7 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func Test_stringByteLength(t *testing.T) { diff --git a/internal/stream/decoding/struct.go b/internal/stream/decoding/struct.go index d0cbda0..b905cd5 100644 --- a/internal/stream/decoding/struct.go +++ b/internal/stream/decoding/struct.go @@ -5,7 +5,7 @@ import ( "reflect" "sync" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) type structCacheTypeMap struct { diff --git a/internal/stream/decoding/struct_test.go b/internal/stream/decoding/struct_test.go index 48be31b..69a8bee 100644 --- a/internal/stream/decoding/struct_test.go +++ b/internal/stream/decoding/struct_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func Test_setStruct_ext(t *testing.T) { diff --git a/internal/stream/decoding/uint.go b/internal/stream/decoding/uint.go index dee5cad..3a62092 100644 --- a/internal/stream/decoding/uint.go +++ b/internal/stream/decoding/uint.go @@ -4,7 +4,7 @@ import ( "encoding/binary" "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (d *decoder) asUint(k reflect.Kind) (uint64, error) { diff --git a/internal/stream/decoding/uint_test.go b/internal/stream/decoding/uint_test.go index f596740..d09fc68 100644 --- a/internal/stream/decoding/uint_test.go +++ b/internal/stream/decoding/uint_test.go @@ -7,9 +7,9 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" - "github.com/shamaton/msgpack/v2/internal/common" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" + "github.com/shamaton/msgpack/v3/def" + "github.com/shamaton/msgpack/v3/internal/common" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" ) func Test_asUint(t *testing.T) { diff --git a/internal/stream/encoding/bool.go b/internal/stream/encoding/bool.go index f578670..3d7db49 100644 --- a/internal/stream/encoding/bool.go +++ b/internal/stream/encoding/bool.go @@ -1,6 +1,6 @@ package encoding -import "github.com/shamaton/msgpack/v2/def" +import "github.com/shamaton/msgpack/v3/def" func (e *encoder) writeBool(v bool) error { if v { diff --git a/internal/stream/encoding/bool_test.go b/internal/stream/encoding/bool_test.go index 5917828..6c4227f 100644 --- a/internal/stream/encoding/bool_test.go +++ b/internal/stream/encoding/bool_test.go @@ -3,7 +3,7 @@ package encoding import ( "testing" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func Test_asBool(t *testing.T) { diff --git a/internal/stream/encoding/byte.go b/internal/stream/encoding/byte.go index 062daf8..abdb86b 100644 --- a/internal/stream/encoding/byte.go +++ b/internal/stream/encoding/byte.go @@ -4,7 +4,7 @@ import ( "math" "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) var typeByte = reflect.TypeOf(byte(0)) diff --git a/internal/stream/encoding/byte_test.go b/internal/stream/encoding/byte_test.go index 2300a6d..bf33b54 100644 --- a/internal/stream/encoding/byte_test.go +++ b/internal/stream/encoding/byte_test.go @@ -3,7 +3,7 @@ package encoding import ( "testing" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func Test_writeByteSliceLength(t *testing.T) { diff --git a/internal/stream/encoding/complex.go b/internal/stream/encoding/complex.go index f26ecf1..70e1c88 100644 --- a/internal/stream/encoding/complex.go +++ b/internal/stream/encoding/complex.go @@ -3,7 +3,7 @@ package encoding import ( "math" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (e *encoder) writeComplex64(v complex64) error { diff --git a/internal/stream/encoding/complex_test.go b/internal/stream/encoding/complex_test.go index 84cfe0b..95b1017 100644 --- a/internal/stream/encoding/complex_test.go +++ b/internal/stream/encoding/complex_test.go @@ -3,7 +3,7 @@ package encoding import ( "testing" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func Test_writeComplex64(t *testing.T) { diff --git a/internal/stream/encoding/encoding.go b/internal/stream/encoding/encoding.go index d53d9f4..df781c9 100644 --- a/internal/stream/encoding/encoding.go +++ b/internal/stream/encoding/encoding.go @@ -5,8 +5,8 @@ import ( "io" "reflect" - "github.com/shamaton/msgpack/v2/def" - "github.com/shamaton/msgpack/v2/internal/common" + "github.com/shamaton/msgpack/v3/def" + "github.com/shamaton/msgpack/v3/internal/common" ) type encoder struct { diff --git a/internal/stream/encoding/encoding_test.go b/internal/stream/encoding/encoding_test.go index 0acccfb..fb18002 100644 --- a/internal/stream/encoding/encoding_test.go +++ b/internal/stream/encoding/encoding_test.go @@ -7,9 +7,9 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" - "github.com/shamaton/msgpack/v2/internal/common" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" + "github.com/shamaton/msgpack/v3/def" + "github.com/shamaton/msgpack/v3/internal/common" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" ) const dummyByte = 0xc1 diff --git a/internal/stream/encoding/ext.go b/internal/stream/encoding/ext.go index 940feb0..178f68d 100644 --- a/internal/stream/encoding/ext.go +++ b/internal/stream/encoding/ext.go @@ -3,8 +3,8 @@ package encoding import ( "reflect" - "github.com/shamaton/msgpack/v2/ext" - "github.com/shamaton/msgpack/v2/time" + "github.com/shamaton/msgpack/v3/ext" + "github.com/shamaton/msgpack/v3/time" ) var extCoderMap = map[reflect.Type]ext.StreamEncoder{time.StreamEncoder.Type(): time.StreamEncoder} diff --git a/internal/stream/encoding/ext_test.go b/internal/stream/encoding/ext_test.go index c6c4a07..94964fa 100644 --- a/internal/stream/encoding/ext_test.go +++ b/internal/stream/encoding/ext_test.go @@ -3,8 +3,8 @@ package encoding import ( "testing" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" - "github.com/shamaton/msgpack/v2/time" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" + "github.com/shamaton/msgpack/v3/time" ) func Test_AddExtEncoder(t *testing.T) { diff --git a/internal/stream/encoding/float.go b/internal/stream/encoding/float.go index ee582e5..7bc0437 100644 --- a/internal/stream/encoding/float.go +++ b/internal/stream/encoding/float.go @@ -3,7 +3,7 @@ package encoding import ( "math" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (e *encoder) writeFloat32(v float64) error { diff --git a/internal/stream/encoding/float_test.go b/internal/stream/encoding/float_test.go index dd969a6..ef428f5 100644 --- a/internal/stream/encoding/float_test.go +++ b/internal/stream/encoding/float_test.go @@ -3,7 +3,7 @@ package encoding import ( "testing" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func Test_writeFloat32(t *testing.T) { diff --git a/internal/stream/encoding/int.go b/internal/stream/encoding/int.go index 2c9a73f..e78cc2a 100644 --- a/internal/stream/encoding/int.go +++ b/internal/stream/encoding/int.go @@ -3,7 +3,7 @@ package encoding import ( "math" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (e *encoder) isNegativeFixInt64(v int64) bool { diff --git a/internal/stream/encoding/int_test.go b/internal/stream/encoding/int_test.go index a044fbc..e3f115f 100644 --- a/internal/stream/encoding/int_test.go +++ b/internal/stream/encoding/int_test.go @@ -4,7 +4,7 @@ import ( "math" "testing" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func Test_asInt(t *testing.T) { diff --git a/internal/stream/encoding/map.go b/internal/stream/encoding/map.go index 2f97ef4..ec4e144 100644 --- a/internal/stream/encoding/map.go +++ b/internal/stream/encoding/map.go @@ -4,7 +4,7 @@ import ( "math" "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (e *encoder) writeMapLength(l int) error { diff --git a/internal/stream/encoding/map_test.go b/internal/stream/encoding/map_test.go index 4742262..1f0325b 100644 --- a/internal/stream/encoding/map_test.go +++ b/internal/stream/encoding/map_test.go @@ -5,7 +5,7 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func Test_writeMapLength(t *testing.T) { diff --git a/internal/stream/encoding/nil.go b/internal/stream/encoding/nil.go index b4eaddc..e0c9522 100644 --- a/internal/stream/encoding/nil.go +++ b/internal/stream/encoding/nil.go @@ -1,6 +1,6 @@ package encoding -import "github.com/shamaton/msgpack/v2/def" +import "github.com/shamaton/msgpack/v3/def" func (e *encoder) writeNil() error { return e.setByte1Int(def.Nil) diff --git a/internal/stream/encoding/slice.go b/internal/stream/encoding/slice.go index 6b7649a..900f16d 100644 --- a/internal/stream/encoding/slice.go +++ b/internal/stream/encoding/slice.go @@ -4,7 +4,7 @@ import ( "math" "reflect" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (e *encoder) writeSliceLength(l int) error { diff --git a/internal/stream/encoding/slice_test.go b/internal/stream/encoding/slice_test.go index 378d8fc..cb8c0cc 100644 --- a/internal/stream/encoding/slice_test.go +++ b/internal/stream/encoding/slice_test.go @@ -5,7 +5,7 @@ import ( "reflect" "testing" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func Test_writeSliceLength(t *testing.T) { diff --git a/internal/stream/encoding/string.go b/internal/stream/encoding/string.go index 15c96b5..39c0c9c 100644 --- a/internal/stream/encoding/string.go +++ b/internal/stream/encoding/string.go @@ -4,7 +4,7 @@ import ( "math" "unsafe" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (e *encoder) writeString(str string) error { diff --git a/internal/stream/encoding/string_test.go b/internal/stream/encoding/string_test.go index 1ef24b2..685b087 100644 --- a/internal/stream/encoding/string_test.go +++ b/internal/stream/encoding/string_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func Test_writeString(t *testing.T) { diff --git a/internal/stream/encoding/struct.go b/internal/stream/encoding/struct.go index 06eeac5..db3cad1 100644 --- a/internal/stream/encoding/struct.go +++ b/internal/stream/encoding/struct.go @@ -5,9 +5,9 @@ import ( "reflect" "sync" - "github.com/shamaton/msgpack/v2/def" - "github.com/shamaton/msgpack/v2/ext" - "github.com/shamaton/msgpack/v2/internal/common" + "github.com/shamaton/msgpack/v3/def" + "github.com/shamaton/msgpack/v3/ext" + "github.com/shamaton/msgpack/v3/internal/common" ) type structCache struct { diff --git a/internal/stream/encoding/struct_test.go b/internal/stream/encoding/struct_test.go index 93bce50..df451ed 100644 --- a/internal/stream/encoding/struct_test.go +++ b/internal/stream/encoding/struct_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "github.com/shamaton/msgpack/v2/def" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" + "github.com/shamaton/msgpack/v3/def" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" ) func Test_writeStruct(t *testing.T) { diff --git a/internal/stream/encoding/uint.go b/internal/stream/encoding/uint.go index 85b6c4c..ec2cde3 100644 --- a/internal/stream/encoding/uint.go +++ b/internal/stream/encoding/uint.go @@ -3,7 +3,7 @@ package encoding import ( "math" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func (e *encoder) writeUint(v uint64) error { diff --git a/internal/stream/encoding/uint_test.go b/internal/stream/encoding/uint_test.go index 03f605a..871edbb 100644 --- a/internal/stream/encoding/uint_test.go +++ b/internal/stream/encoding/uint_test.go @@ -4,7 +4,7 @@ import ( "math" "testing" - "github.com/shamaton/msgpack/v2/def" + "github.com/shamaton/msgpack/v3/def" ) func Test_asUint(t *testing.T) { diff --git a/msgpack.go b/msgpack.go index 5c8d5d7..0527239 100644 --- a/msgpack.go +++ b/msgpack.go @@ -4,13 +4,13 @@ import ( "fmt" "io" - "github.com/shamaton/msgpack/v2/def" - "github.com/shamaton/msgpack/v2/ext" - "github.com/shamaton/msgpack/v2/internal/decoding" - "github.com/shamaton/msgpack/v2/internal/encoding" - streamdecoding "github.com/shamaton/msgpack/v2/internal/stream/decoding" - streamencoding "github.com/shamaton/msgpack/v2/internal/stream/encoding" - "github.com/shamaton/msgpack/v2/time" + "github.com/shamaton/msgpack/v3/def" + "github.com/shamaton/msgpack/v3/ext" + "github.com/shamaton/msgpack/v3/internal/decoding" + "github.com/shamaton/msgpack/v3/internal/encoding" + streamdecoding "github.com/shamaton/msgpack/v3/internal/stream/decoding" + streamencoding "github.com/shamaton/msgpack/v3/internal/stream/encoding" + "github.com/shamaton/msgpack/v3/time" ) // StructAsArray is encoding option. diff --git a/msgpack_example_test.go b/msgpack_example_test.go index 9bae30c..e4e6532 100644 --- a/msgpack_example_test.go +++ b/msgpack_example_test.go @@ -6,9 +6,9 @@ import ( "net" "reflect" - "github.com/shamaton/msgpack/v2" - "github.com/shamaton/msgpack/v2/def" - "github.com/shamaton/msgpack/v2/ext" + "github.com/shamaton/msgpack/v3" + "github.com/shamaton/msgpack/v3/def" + "github.com/shamaton/msgpack/v3/ext" ) func ExampleAddExtCoder() { diff --git a/msgpack_test.go b/msgpack_test.go index 8e6c00f..618eaef 100644 --- a/msgpack_test.go +++ b/msgpack_test.go @@ -14,11 +14,11 @@ import ( "testing" "time" - "github.com/shamaton/msgpack/v2" - "github.com/shamaton/msgpack/v2/def" - "github.com/shamaton/msgpack/v2/ext" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" - extTime "github.com/shamaton/msgpack/v2/time" + "github.com/shamaton/msgpack/v3" + "github.com/shamaton/msgpack/v3/def" + "github.com/shamaton/msgpack/v3/ext" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" + extTime "github.com/shamaton/msgpack/v3/time" ) var now time.Time diff --git a/time/decode.go b/time/decode.go index e5962d2..4360eed 100644 --- a/time/decode.go +++ b/time/decode.go @@ -6,8 +6,8 @@ import ( "reflect" "time" - "github.com/shamaton/msgpack/v2/def" - "github.com/shamaton/msgpack/v2/ext" + "github.com/shamaton/msgpack/v3/def" + "github.com/shamaton/msgpack/v3/ext" ) var zero = time.Unix(0, 0) diff --git a/time/decode_stream.go b/time/decode_stream.go index 0de21c7..3e3c79c 100644 --- a/time/decode_stream.go +++ b/time/decode_stream.go @@ -6,8 +6,8 @@ import ( "reflect" "time" - "github.com/shamaton/msgpack/v2/def" - "github.com/shamaton/msgpack/v2/ext" + "github.com/shamaton/msgpack/v3/def" + "github.com/shamaton/msgpack/v3/ext" ) var StreamDecoder = new(timeStreamDecoder) diff --git a/time/decode_stream_test.go b/time/decode_stream_test.go index ba3ca67..2aca09d 100644 --- a/time/decode_stream_test.go +++ b/time/decode_stream_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "github.com/shamaton/msgpack/v2/def" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" + "github.com/shamaton/msgpack/v3/def" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" ) func TestStreamDecodeCode(t *testing.T) { diff --git a/time/decode_test.go b/time/decode_test.go index c256e4a..1679d36 100644 --- a/time/decode_test.go +++ b/time/decode_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "github.com/shamaton/msgpack/v2/def" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" + "github.com/shamaton/msgpack/v3/def" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" ) func TestDecodeCode(t *testing.T) { diff --git a/time/encode.go b/time/encode.go index b8ec582..06683aa 100644 --- a/time/encode.go +++ b/time/encode.go @@ -4,8 +4,8 @@ import ( "reflect" "time" - "github.com/shamaton/msgpack/v2/def" - "github.com/shamaton/msgpack/v2/ext" + "github.com/shamaton/msgpack/v3/def" + "github.com/shamaton/msgpack/v3/ext" ) var Encoder = new(timeEncoder) diff --git a/time/encode_stream.go b/time/encode_stream.go index b11c4ff..48b74c9 100644 --- a/time/encode_stream.go +++ b/time/encode_stream.go @@ -4,8 +4,8 @@ import ( "reflect" "time" - "github.com/shamaton/msgpack/v2/def" - "github.com/shamaton/msgpack/v2/ext" + "github.com/shamaton/msgpack/v3/def" + "github.com/shamaton/msgpack/v3/ext" ) var StreamEncoder = new(timeStreamEncoder) diff --git a/time/encode_stream_test.go b/time/encode_stream_test.go index 083788a..48a6e7f 100644 --- a/time/encode_stream_test.go +++ b/time/encode_stream_test.go @@ -8,10 +8,10 @@ import ( "testing" "time" - "github.com/shamaton/msgpack/v2/def" - "github.com/shamaton/msgpack/v2/ext" - "github.com/shamaton/msgpack/v2/internal/common" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" + "github.com/shamaton/msgpack/v3/def" + "github.com/shamaton/msgpack/v3/ext" + "github.com/shamaton/msgpack/v3/internal/common" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" ) func TestStreamCode(t *testing.T) { diff --git a/time/encode_test.go b/time/encode_test.go index ae1b56a..634faf0 100644 --- a/time/encode_test.go +++ b/time/encode_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "github.com/shamaton/msgpack/v2/def" - tu "github.com/shamaton/msgpack/v2/internal/common/testutil" + "github.com/shamaton/msgpack/v3/def" + tu "github.com/shamaton/msgpack/v3/internal/common/testutil" ) func TestCode(t *testing.T) { From 8d05395f4f0fa2d8705f6f4f9dee0e25382d6fa0 Mon Sep 17 00:00:00 2001 From: shamaton Date: Thu, 15 Jan 2026 22:40:20 +0900 Subject: [PATCH 4/5] Update README for v3 and upgrade note --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 93e3a5c..15ccadd 100644 --- a/README.md +++ b/README.md @@ -21,17 +21,21 @@ To keep the old behavior, use `SetDecodedTimeAsLocal()`. ## Installation -Current version is **msgpack/v2**. +Current version is **msgpack/v3**. ```sh -go get -u github.com/shamaton/msgpack/v2 +go get -u github.com/shamaton/msgpack/v3 ``` +### Upgrading from v2 +If you are upgrading from v2, please note the `time.Time` decoding change mentioned in the announcement above. +To keep the v2 behavior, use `msgpack.SetDecodedTimeAsLocal()` after upgrading. + ## Quick Start ```go package main import ( - "github.com/shamaton/msgpack/v2" + "github.com/shamaton/msgpack/v3" "net/http" ) From 6e82c0ced32153d966ea0304346bd6c38ff44fb7 Mon Sep 17 00:00:00 2001 From: shamaton Date: Thu, 15 Jan 2026 22:41:07 +0900 Subject: [PATCH 5/5] =?UTF-8?q?Bump=20CI=20Go=20matrix=20to=201.23?= =?UTF-8?q?=E2=80=931.25?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2eb22d7..51fd115 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - go: ['1.22', '1.23', '1.24'] + go: ['1.23', '1.24', '1.25'] name: ${{ matrix.os }} @ Go ${{ matrix.go }} runs-on: ${{ matrix.os }} steps: @@ -50,7 +50,7 @@ jobs: rm coverage.coverprofile.tmp - name: Upload coverage to Codecov - if: success() && matrix.go == '1.24' && matrix.os == 'ubuntu-latest' + if: success() && matrix.go == '1.25' && matrix.os == 'ubuntu-latest' uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }}