From 5719784948d47b662a768604a62df24d5600aad0 Mon Sep 17 00:00:00 2001 From: James Harris Date: Fri, 27 Sep 2024 07:34:50 +1000 Subject: [PATCH] Remove support for CBOR encoding. --- CHANGELOG.md | 8 +++- codec/cbor/codec.go | 46 --------------------- codec/cbor/codec_test.go | 86 --------------------------------------- codec/cbor/doc.go | 2 - codec/cbor/ginkgo_test.go | 15 ------- fixtures/marshaler.go | 2 - go.mod | 4 +- go.sum | 64 ++++++++++++++++++++++++++--- type_test.go | 10 ++--- value_test.go | 16 ++++---- 10 files changed, 79 insertions(+), 174 deletions(-) delete mode 100644 codec/cbor/codec.go delete mode 100644 codec/cbor/codec_test.go delete mode 100644 codec/cbor/doc.go delete mode 100644 codec/cbor/ginkgo_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cff042..41041aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,12 @@ The format is based on [Keep a Changelog], and this project adheres to ## [Unreleased] +### Removed + +- **[BC]** Removed support for CBOR encoding. Application developers should + prefer Protocol Buffers where possible. JSON support remains for encoding of + "arbitrary" types. + ### Deprecated - The `fixtures` package is now deprecated and will be removed in a future @@ -60,7 +66,7 @@ The format is based on [Keep a Changelog], and this project adheres to ### Fixed -- Fix mispelling of `json.DefaulCodec` and `cbor.DefaultCodec` (missing `t`) +- Fix mispelling of `json.DefaultCodec` and `cbor.DefaultCodec` (missing `t`) ### Changed diff --git a/codec/cbor/codec.go b/codec/cbor/codec.go deleted file mode 100644 index 4da523b..0000000 --- a/codec/cbor/codec.go +++ /dev/null @@ -1,46 +0,0 @@ -package cbor - -import ( - "reflect" - - "github.com/dogmatiq/marshalkit/codec" - "github.com/dogmatiq/marshalkit/codec/internal/portablename" - "github.com/fxamacker/cbor/v2" -) - -// Codec is an implementation of marshalkit.Codec that uses CBOR encoding. -type Codec struct{} - -// DefaultCodec is a marshalkit.Codec that marshals values using CBOR encoding. -var DefaultCodec = Codec{} - -// Query returns the capabilities of the codec for the given types. -func (Codec) Query(types []reflect.Type) codec.Capabilities { - caps := codec.Capabilities{ - Types: map[reflect.Type]string{}, - } - - for _, rt := range types { - if n, ok := portablename.FromReflect(rt); ok { - caps.Types[rt] = n - } - } - - return caps -} - -// BasicMediaType returns the type and subtype portion of the media-type used to -// identify data encoded by this codec. -func (Codec) BasicMediaType() string { - return "application/cbor" -} - -// Marshal returns the binary representation of v. -func (Codec) Marshal(v any) ([]byte, error) { - return cbor.Marshal(v) -} - -// Unmarshal decodes a binary representation into v. -func (Codec) Unmarshal(data []byte, v any) error { - return cbor.Unmarshal(data, v) -} diff --git a/codec/cbor/codec_test.go b/codec/cbor/codec_test.go deleted file mode 100644 index 8cf983b..0000000 --- a/codec/cbor/codec_test.go +++ /dev/null @@ -1,86 +0,0 @@ -package cbor_test - -import ( - "reflect" - - . "github.com/dogmatiq/dogma/fixtures" - . "github.com/dogmatiq/marshalkit/codec/cbor" - . "github.com/dogmatiq/marshalkit/codec/internal/fixtures" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" -) - -var _ = Describe("type Codec", func() { - var codec *Codec - - BeforeEach(func() { - codec = &Codec{} - }) - - Describe("func Query()", func() { - It("uses the unqualified type-name as the portable type", func() { - rt := reflect.TypeOf(MessageA{}) - - caps := codec.Query( - []reflect.Type{rt}, - ) - - Expect(caps.Types[rt]).To(Equal("MessageA")) - }) - - It("uses the user-defined type name", func() { - type LocalMessage MessageA - rt := reflect.TypeOf(LocalMessage{}) - - caps := codec.Query( - []reflect.Type{rt}, - ) - - Expect(caps.Types[rt]).To(Equal("LocalMessage")) - }) - - It("uses the element name for pointer types", func() { - var m **MessageA - rt := reflect.TypeOf(m) - - caps := codec.Query( - []reflect.Type{rt}, - ) - - Expect(caps.Types[rt]).To(Equal("MessageA")) - }) - }) - - Describe("func BasicMediaType()", func() { - It("returns the expected basic media-type", func() { - Expect(codec.BasicMediaType()).To(Equal("application/cbor")) - }) - }) - - Describe("func Marshal()", func() { - It("marshals the value", func() { - data, err := codec.Marshal( - &ProtoMessage{ - Value: "", - }, - ) - Expect(err).ShouldNot(HaveOccurred()) - Expect(data).To(Equal([]byte("\xa1evalueg"))) - }) - }) - - Describe("func Unmarshal()", func() { - It("unmarshals the data", func() { - data := []byte("\xa1evalueg") - - m := &ProtoMessage{} - err := codec.Unmarshal(data, m) - Expect(err).ShouldNot(HaveOccurred()) - Expect(m).To(Equal( - &ProtoMessage{ - Value: "", - }, - )) - }) - }) -}) diff --git a/codec/cbor/doc.go b/codec/cbor/doc.go deleted file mode 100644 index 09ce8c6..0000000 --- a/codec/cbor/doc.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package cbor contains a codec implementation that marshals in CBOR format. -package cbor diff --git a/codec/cbor/ginkgo_test.go b/codec/cbor/ginkgo_test.go deleted file mode 100644 index 4d0cfb6..0000000 --- a/codec/cbor/ginkgo_test.go +++ /dev/null @@ -1,15 +0,0 @@ -package cbor_test - -import ( - "reflect" - "testing" - - "github.com/onsi/ginkgo/v2" - "github.com/onsi/gomega" -) - -func TestSuite(t *testing.T) { - type tag struct{} - gomega.RegisterFailHandler(ginkgo.Fail) - ginkgo.RunSpecs(t, reflect.TypeOf(tag{}).PkgPath()) -} diff --git a/fixtures/marshaler.go b/fixtures/marshaler.go index aa38b8b..dd686de 100644 --- a/fixtures/marshaler.go +++ b/fixtures/marshaler.go @@ -7,7 +7,6 @@ import ( "github.com/dogmatiq/enginekit/enginetest/stubs" "github.com/dogmatiq/marshalkit" "github.com/dogmatiq/marshalkit/codec" - "github.com/dogmatiq/marshalkit/codec/cbor" "github.com/dogmatiq/marshalkit/codec/json" ) @@ -134,7 +133,6 @@ func init() { }, []codec.Codec{ &json.Codec{}, - &cbor.Codec{}, }, ) if err != nil { diff --git a/go.mod b/go.mod index 54d152a..4e7d46e 100644 --- a/go.mod +++ b/go.mod @@ -7,9 +7,8 @@ toolchain go1.23.1 require ( github.com/dogmatiq/configkit v0.13.8 github.com/dogmatiq/dogma v0.14.2 - github.com/dogmatiq/enginekit v0.11.1-0.20240926204809-4e45ae3e1a87 + github.com/dogmatiq/enginekit v0.11.1 github.com/dogmatiq/interopspec v0.5.4 - github.com/fxamacker/cbor/v2 v2.7.0 github.com/jmalloc/gomegax v0.0.0-20200507221434-64fca4c0e03a github.com/onsi/ginkgo/v2 v2.20.2 github.com/onsi/gomega v1.34.2 @@ -23,7 +22,6 @@ require ( github.com/google/go-cmp v0.6.0 // indirect github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/x448/float16 v0.8.4 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect diff --git a/go.sum b/go.sum index bff6c3a..097cd05 100644 --- a/go.sum +++ b/go.sum @@ -1,29 +1,55 @@ +cel.dev/expr v0.16.0 h1:yloc84fytn4zmJX2GU3TkXGsaieaV7dQ057Qs4sIG2Y= +cel.dev/expr v0.16.0/go.mod h1:TRSuuV7DlVCE/uwv5QbAiW/v8l5O8C4eEPHeu7gf7Sg= +cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY= +cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= +github.com/census-instrumentation/opencensus-proto v0.4.1 h1:iKLQ0xPNFxR/2hzXZMrBo8f1j86j5WHzznCCQxV/b8g= +github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI= +github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= +github.com/cncf/xds/go v0.0.0-20240723142845-024c85f92f20 h1:N+3sFI5GUjRKBi+i0TxYVST9h4Ie192jJWpHvthBBgg= +github.com/cncf/xds/go v0.0.0-20240723142845-024c85f92f20/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dogmatiq/configkit v0.13.8 h1:8VNNusYCi3AnwwQ8ZhZJLUCRJlJ5uz/yWTzXkBDE1QU= github.com/dogmatiq/configkit v0.13.8/go.mod h1:DKFr/17QHC0RBnzigNs0PSHf+uEPeYitDrQgy7kbcxY= +github.com/dogmatiq/dapper v0.6.0 h1:hnWUsjnt3nUiC9hmkPvuxrnMd7fYNz1i+/GS3gOx0Xs= +github.com/dogmatiq/dapper v0.6.0/go.mod h1:ubRHWzt73s0MsPpGhWvnfW/Z/1YPnrkCsQv6CUOZVEw= github.com/dogmatiq/dogma v0.14.2 h1:SrwuNGMbZ4W9jdxe9a9e7n1Fspo/dhsLLhMSVMdIQro= github.com/dogmatiq/dogma v0.14.2/go.mod h1:9lyVA+6V2+E/exV0IrBOrkUiyFwIATEhv+b0vnB2umQ= -github.com/dogmatiq/enginekit v0.11.1-0.20240926204809-4e45ae3e1a87 h1:XcjlzO6S+Vkvm8mZ8Oh5AXfu/gOaJesUDATz422Pxps= -github.com/dogmatiq/enginekit v0.11.1-0.20240926204809-4e45ae3e1a87/go.mod h1:gDEDVDPAYstWK262NzHWKknox5MncDguQu+XW769jY4= +github.com/dogmatiq/enginekit v0.11.1 h1:zXOe4Ms/6cbDPvaZMzJiXGiG9Bq/nB6Liqyw/fIBKxI= +github.com/dogmatiq/enginekit v0.11.1/go.mod h1:gDEDVDPAYstWK262NzHWKknox5MncDguQu+XW769jY4= github.com/dogmatiq/iago v0.4.0 h1:57nZqVT34IZxtCZEW/RFif7DNUEjMXgevfr/Mmd0N8I= github.com/dogmatiq/iago v0.4.0/go.mod h1:fishMWBtzYcjgis6d873VTv9kFm/wHYLOzOyO9ECBDc= github.com/dogmatiq/interopspec v0.5.4 h1:klyGPy16zUKJartJIJOBZ4JrQ4LxFiY3wgzFTTiNlDk= github.com/dogmatiq/interopspec v0.5.4/go.mod h1:JL0QFXBTRGH+RgQqExhEUdhtv5Vn802w43RxKQbk8Co= +github.com/dogmatiq/jumble v0.1.0 h1:Cb3ExfxY+AoUP4G9/sOwoOdYX8o+kOLK8+dhXAry+QA= +github.com/dogmatiq/jumble v0.1.0/go.mod h1:FCGV2ImXu8zvThxhd4QLstiEdu74vbIVw9bFJSBcKr4= +github.com/dogmatiq/primo v0.3.1 h1:JSqiCh1ma9CbIVzPf8k1vhzQ2Zn/d/WupzElDoiYZw0= +github.com/dogmatiq/primo v0.3.1/go.mod h1:z2DfWNz0YmwIKhUEwgJY4xyeWOw0He+9veRRMGQ21UI= +github.com/emicklei/dot v1.6.2 h1:08GN+DD79cy/tzN6uLCT84+2Wk9u+wvqP+Hkx/dIR8A= +github.com/emicklei/dot v1.6.2/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= +github.com/envoyproxy/go-control-plane v0.13.0 h1:HzkeUz1Knt+3bK+8LG1bxOO/jzWZmdxpwC51i202les= +github.com/envoyproxy/go-control-plane v0.13.0/go.mod h1:GRaKG3dwvFoTg4nj7aXdZnvMg4d7nvT/wl9WgVXn3Q8= +github.com/envoyproxy/protoc-gen-validate v1.1.0 h1:tntQDh69XqOCOZsDz0lVJQez/2L6Uu2PdjCQwWCJ3bM= +github.com/envoyproxy/protoc-gen-validate v1.1.0/go.mod h1:sXRDRVmzEbkM7CVcM06s9shE/m23dg3wzjl0UWqJ2q4= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= -github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= +github.com/golang/glog v1.2.2 h1:1+mZ9upx1Dh6FmUTFR1naJ77miKiXgALjWOZ3NVFPmY= +github.com/golang/glog v1.2.2/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -33,7 +59,10 @@ github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 h1:5iH8iuqE5apketRbSF github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/ianlancetaylor/demangle v0.0.0-20240312041847-bd984b5ce465 h1:KwWnWVWCNtNq/ewIX7HIKnELmEx2nDP42yskD/pi7QE= +github.com/ianlancetaylor/demangle v0.0.0-20240312041847-bd984b5ce465/go.mod h1:gx7rwoVhcfuVKG5uya9Hs3Sxj7EIvldVofAWIUtGouw= github.com/jmalloc/gomegax v0.0.0-20200507221434-64fca4c0e03a h1:Gk7Gkwl1KUJII/FiAjvBjRgEz/lpvTV8kNYp+9jdpuk= github.com/jmalloc/gomegax v0.0.0-20200507221434-64fca4c0e03a/go.mod h1:TZpc8ObQEKqTuy1/VXpPRfcMU80QFDU4zK3nchXts/k= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= @@ -52,26 +81,45 @@ github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/onsi/gomega v1.10.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= github.com/onsi/gomega v1.34.2 h1:pNCwDkzrsv7MS9kpaQvVb1aVLahQXyJ/Tv5oAZMI3i8= github.com/onsi/gomega v1.34.2/go.mod h1:v1xfxRgk0KIsG+QOdm7p8UosrOzPYRo60fd3B/1Dukc= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= +github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= -github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= +golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= +golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= +golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= +golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= +golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= +golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= +golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457 h1:zf5N6UOrA487eEFacMePxjXAJctxKmyjKUsjA11Uzuk= +golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457/go.mod h1:pRgIJT+bRLFKnoM1ldnzKoxTIn14Yxz928LQRYYgIN0= +golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= +golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= @@ -86,10 +134,14 @@ google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWn gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= +pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= diff --git a/type_test.go b/type_test.go index f84a629..0e41476 100644 --- a/type_test.go +++ b/type_test.go @@ -3,7 +3,7 @@ package marshalkit_test import ( "reflect" - . "github.com/dogmatiq/dogma/fixtures" + . "github.com/dogmatiq/enginekit/enginetest/stubs" . "github.com/dogmatiq/marshalkit" "github.com/dogmatiq/marshalkit/fixtures" // can't dot-import due to conflicts . "github.com/onsi/ginkgo/v2" @@ -14,9 +14,9 @@ var _ = Describe("func MustMarshalType()", func() { It("marshals the type using the marshaler", func() { n := MustMarshalType( fixtures.Marshaler, - reflect.TypeOf(&AggregateRoot{}), + reflect.TypeOf(&AggregateRootStub{}), ) - Expect(n).To(Equal("AggregateRoot")) + Expect(n).To(Equal("AggregateRootStub")) }) It("panics if the type is not registered", func() { @@ -33,10 +33,10 @@ var _ = Describe("func MustUnmarshalType()", func() { It("unmarshals the type using the marshaler", func() { rt := MustUnmarshalType( fixtures.Marshaler, - "AggregateRoot", + "AggregateRootStub", ) Expect(rt).To(Equal( - reflect.TypeOf(&AggregateRoot{}), + reflect.TypeOf(&AggregateRootStub{}), )) }) diff --git a/value_test.go b/value_test.go index 3ab9305..99832bb 100644 --- a/value_test.go +++ b/value_test.go @@ -1,7 +1,7 @@ package marshalkit_test import ( - . "github.com/dogmatiq/dogma/fixtures" + . "github.com/dogmatiq/enginekit/enginetest/stubs" . "github.com/dogmatiq/marshalkit" "github.com/dogmatiq/marshalkit/fixtures" // can't dot-import due to conflicts . "github.com/onsi/ginkgo/v2" @@ -12,12 +12,12 @@ var _ = Describe("func MustMarshal()", func() { It("marshals the value using the marshaler", func() { p := MustMarshal( fixtures.Marshaler, - &ProcessRoot{ + &ProcessRootStub{ Value: "", }, ) - Expect(p.MediaType).To(Equal("application/json; type=ProcessRoot")) - Expect(p.Data).To(Equal([]byte(`{"Value":"\u003cvalue\u003e"}`))) + Expect(p.MediaType).To(Equal("application/json; type=ProcessRootStub")) + Expect(p.Data).To(Equal([]byte(`{"value":"\u003cvalue\u003e"}`))) }) It("panics if the type is not registered", func() { @@ -35,12 +35,12 @@ var _ = Describe("func MustUnmarshal()", func() { v := MustUnmarshal( fixtures.Marshaler, Packet{ - "application/json; type=ProcessRoot", - []byte(`{"Value":"\u003cvalue\u003e"}`), + "application/json; type=ProcessRootStub", + []byte(`{"value":"\u003cvalue\u003e"}`), }, ) Expect(v).To(Equal( - &ProcessRoot{ + &ProcessRootStub{ Value: "", }, )) @@ -52,7 +52,7 @@ var _ = Describe("func MustUnmarshal()", func() { fixtures.Marshaler, Packet{ "application/json; type=Unsupported", - []byte(`{"Value":"\u003cvalue\u003e"}`), + []byte(`{"value":"\u003cvalue\u003e"}`), }, ) }).To(Panic())