From cbbaa0e92e9040496310bbbde8083cdb1c36423f Mon Sep 17 00:00:00 2001 From: stewartboyd119 Date: Wed, 16 Oct 2024 21:44:28 -0700 Subject: [PATCH 1/5] Updated --- client_test.go | 2 +- example/producer_avro/go.sum | 4 ++-- example/worker_avro/go.sum | 4 ++-- go.mod | 2 +- go.sum | 25 -------------------- mocks/confluent/kafka_consumer.go | 13 +++++++---- mocks/confluent/kafka_producer.go | 9 +++++-- mocks/mock_client.go | 19 +++++++++------ mocks/mock_logger.go | 39 +++++++++++++++++-------------- mocks/mock_reader.go | 11 ++++++--- mocks/mock_writer.go | 29 +++++++++++++---------- reader_test.go | 2 +- test/worker_test.go | 4 ++-- test/writer_test.go | 2 +- work_test.go | 9 ++++--- writer_test.go | 2 +- 16 files changed, 90 insertions(+), 86 deletions(-) diff --git a/client_test.go b/client_test.go index 6c67584..1a28950 100644 --- a/client_test.go +++ b/client_test.go @@ -10,7 +10,6 @@ import ( "time" "github.com/confluentinc/confluent-kafka-go/v2/kafka" - "github.com/golang/mock/gomock" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/stretchr/testify/require" @@ -19,6 +18,7 @@ import ( "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/otel/trace/noop" + "go.uber.org/mock/gomock" ) func TestNewClient(t *testing.T) { diff --git a/example/producer_avro/go.sum b/example/producer_avro/go.sum index 4746bb1..4e01f23 100644 --- a/example/producer_avro/go.sum +++ b/example/producer_avro/go.sum @@ -160,8 +160,8 @@ github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1 github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +go.uber.org/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +go.uber.org/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= diff --git a/example/worker_avro/go.sum b/example/worker_avro/go.sum index 4746bb1..4e01f23 100644 --- a/example/worker_avro/go.sum +++ b/example/worker_avro/go.sum @@ -160,8 +160,8 @@ github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1 github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= +go.uber.org/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +go.uber.org/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= diff --git a/go.mod b/go.mod index 8dff515..577618b 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,6 @@ go 1.23 require ( github.com/confluentinc/confluent-kafka-go/v2 v2.5.3 - github.com/golang/mock v1.6.0 github.com/google/go-cmp v0.6.0 github.com/google/uuid v1.6.0 github.com/hamba/avro/v2 v2.24.0 @@ -14,6 +13,7 @@ require ( github.com/zillow/zfmt v1.0.1 go.opentelemetry.io/otel v1.30.0 go.opentelemetry.io/otel/trace v1.30.0 + go.uber.org/mock v0.4.0 golang.org/x/sync v0.8.0 google.golang.org/protobuf v1.34.2 ) diff --git a/go.sum b/go.sum index e29f2cc..0bdcd80 100644 --- a/go.sum +++ b/go.sum @@ -161,8 +161,6 @@ github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1 github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -401,7 +399,6 @@ github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17 github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/xiatechs/jsonata-go v1.8.5 h1:m1NaokPKD6LPaTPRl674EQz5mpkJvM3ymjdReDEP6/A= github.com/xiatechs/jsonata-go v1.8.5/go.mod h1:yGEvviiftcdVfhSRhRSpgyTel89T58f+690iB0fp2Vk= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/zillow/zfmt v1.0.1 h1:JLN5WaxoqqoEPUpVWer83uhXhDPAA2nZkfQqgKnWp+w= @@ -442,46 +439,24 @@ go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lI go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 h1:hNQpMuAJe5CtcUqCXaWga3FHu+kQvCqcsoVaQgSV60o= golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/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-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.169.0 h1:QwWPy71FgMWqJN/l6jVlFHUa29a7dcUy02I8o799nPY= google.golang.org/api v0.169.0/go.mod h1:gpNOiMA2tZ4mf5R9Iwf4rK/Dcz0fbdIgWYWVoxmsyLg= google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= diff --git a/mocks/confluent/kafka_consumer.go b/mocks/confluent/kafka_consumer.go index 4c71479..ef2fc83 100644 --- a/mocks/confluent/kafka_consumer.go +++ b/mocks/confluent/kafka_consumer.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/zillow/zkafka (interfaces: KafkaConsumer) +// +// Generated by this command: +// +// mockgen -package mock_confluent --destination=./mocks/confluent/kafka_consumer.go . KafkaConsumer +// // Package mock_confluent is a generated GoMock package. package mock_confluent @@ -9,7 +14,7 @@ import ( time "time" kafka "github.com/confluentinc/confluent-kafka-go/v2/kafka" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockKafkaConsumer is a mock of KafkaConsumer interface. @@ -103,7 +108,7 @@ func (m *MockKafkaConsumer) ReadMessage(arg0 time.Duration) (*kafka.Message, err } // ReadMessage indicates an expected call of ReadMessage. -func (mr *MockKafkaConsumerMockRecorder) ReadMessage(arg0 interface{}) *gomock.Call { +func (mr *MockKafkaConsumerMockRecorder) ReadMessage(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReadMessage", reflect.TypeOf((*MockKafkaConsumer)(nil).ReadMessage), arg0) } @@ -118,7 +123,7 @@ func (m *MockKafkaConsumer) StoreOffsets(arg0 []kafka.TopicPartition) ([]kafka.T } // StoreOffsets indicates an expected call of StoreOffsets. -func (mr *MockKafkaConsumerMockRecorder) StoreOffsets(arg0 interface{}) *gomock.Call { +func (mr *MockKafkaConsumerMockRecorder) StoreOffsets(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StoreOffsets", reflect.TypeOf((*MockKafkaConsumer)(nil).StoreOffsets), arg0) } @@ -132,7 +137,7 @@ func (m *MockKafkaConsumer) SubscribeTopics(arg0 []string, arg1 kafka.RebalanceC } // SubscribeTopics indicates an expected call of SubscribeTopics. -func (mr *MockKafkaConsumerMockRecorder) SubscribeTopics(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockKafkaConsumerMockRecorder) SubscribeTopics(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubscribeTopics", reflect.TypeOf((*MockKafkaConsumer)(nil).SubscribeTopics), arg0, arg1) } diff --git a/mocks/confluent/kafka_producer.go b/mocks/confluent/kafka_producer.go index 795b5f9..e8156a2 100644 --- a/mocks/confluent/kafka_producer.go +++ b/mocks/confluent/kafka_producer.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/zillow/zkafka (interfaces: KafkaProducer) +// +// Generated by this command: +// +// mockgen -package mock_confluent -destination=./mocks/confluent/kafka_producer.go . KafkaProducer +// // Package mock_confluent is a generated GoMock package. package mock_confluent @@ -8,7 +13,7 @@ import ( reflect "reflect" kafka "github.com/confluentinc/confluent-kafka-go/v2/kafka" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockKafkaProducer is a mock of KafkaProducer interface. @@ -55,7 +60,7 @@ func (m *MockKafkaProducer) Produce(arg0 *kafka.Message, arg1 chan kafka.Event) } // Produce indicates an expected call of Produce. -func (mr *MockKafkaProducerMockRecorder) Produce(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockKafkaProducerMockRecorder) Produce(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Produce", reflect.TypeOf((*MockKafkaProducer)(nil).Produce), arg0, arg1) } diff --git a/mocks/mock_client.go b/mocks/mock_client.go index ef89c83..398224b 100644 --- a/mocks/mock_client.go +++ b/mocks/mock_client.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: ./client.go +// +// Generated by this command: +// +// mockgen -package=mock_zkafka -destination=./mocks/mock_client.go -source=./client.go +// // Package mock_zkafka is a generated GoMock package. package mock_zkafka @@ -8,8 +13,8 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" zkafka "github.com/zillow/zkafka" + gomock "go.uber.org/mock/gomock" ) // MockClientProvider is a mock of ClientProvider interface. @@ -52,7 +57,7 @@ func (mr *MockClientProviderMockRecorder) Close() *gomock.Call { // Reader mocks base method. func (m *MockClientProvider) Reader(ctx context.Context, topicConfig zkafka.ConsumerTopicConfig, opts ...zkafka.ReaderOption) (zkafka.Reader, error) { m.ctrl.T.Helper() - varargs := []interface{}{ctx, topicConfig} + varargs := []any{ctx, topicConfig} for _, a := range opts { varargs = append(varargs, a) } @@ -63,16 +68,16 @@ func (m *MockClientProvider) Reader(ctx context.Context, topicConfig zkafka.Cons } // Reader indicates an expected call of Reader. -func (mr *MockClientProviderMockRecorder) Reader(ctx, topicConfig interface{}, opts ...interface{}) *gomock.Call { +func (mr *MockClientProviderMockRecorder) Reader(ctx, topicConfig any, opts ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, topicConfig}, opts...) + varargs := append([]any{ctx, topicConfig}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Reader", reflect.TypeOf((*MockClientProvider)(nil).Reader), varargs...) } // Writer mocks base method. func (m *MockClientProvider) Writer(ctx context.Context, topicConfig zkafka.ProducerTopicConfig, opts ...zkafka.WriterOption) (zkafka.Writer, error) { m.ctrl.T.Helper() - varargs := []interface{}{ctx, topicConfig} + varargs := []any{ctx, topicConfig} for _, a := range opts { varargs = append(varargs, a) } @@ -83,8 +88,8 @@ func (m *MockClientProvider) Writer(ctx context.Context, topicConfig zkafka.Prod } // Writer indicates an expected call of Writer. -func (mr *MockClientProviderMockRecorder) Writer(ctx, topicConfig interface{}, opts ...interface{}) *gomock.Call { +func (mr *MockClientProviderMockRecorder) Writer(ctx, topicConfig any, opts ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, topicConfig}, opts...) + varargs := append([]any{ctx, topicConfig}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Writer", reflect.TypeOf((*MockClientProvider)(nil).Writer), varargs...) } diff --git a/mocks/mock_logger.go b/mocks/mock_logger.go index b888a6b..c3946c9 100644 --- a/mocks/mock_logger.go +++ b/mocks/mock_logger.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: logger.go +// +// Generated by this command: +// +// mockgen -destination=./mocks/mock_logger.go -source=logger.go +// // Package mock_zkafka is a generated GoMock package. package mock_zkafka @@ -8,7 +13,7 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" + gomock "go.uber.org/mock/gomock" ) // MockLogger is a mock of Logger interface. @@ -35,9 +40,9 @@ func (m *MockLogger) EXPECT() *MockLoggerMockRecorder { } // Debugw mocks base method. -func (m *MockLogger) Debugw(ctx context.Context, msg string, keysAndValues ...interface{}) { +func (m *MockLogger) Debugw(ctx context.Context, msg string, keysAndValues ...any) { m.ctrl.T.Helper() - varargs := []interface{}{ctx, msg} + varargs := []any{ctx, msg} for _, a := range keysAndValues { varargs = append(varargs, a) } @@ -45,16 +50,16 @@ func (m *MockLogger) Debugw(ctx context.Context, msg string, keysAndValues ...in } // Debugw indicates an expected call of Debugw. -func (mr *MockLoggerMockRecorder) Debugw(ctx, msg interface{}, keysAndValues ...interface{}) *gomock.Call { +func (mr *MockLoggerMockRecorder) Debugw(ctx, msg any, keysAndValues ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, msg}, keysAndValues...) + varargs := append([]any{ctx, msg}, keysAndValues...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Debugw", reflect.TypeOf((*MockLogger)(nil).Debugw), varargs...) } // Errorw mocks base method. -func (m *MockLogger) Errorw(ctx context.Context, msg string, keysAndValues ...interface{}) { +func (m *MockLogger) Errorw(ctx context.Context, msg string, keysAndValues ...any) { m.ctrl.T.Helper() - varargs := []interface{}{ctx, msg} + varargs := []any{ctx, msg} for _, a := range keysAndValues { varargs = append(varargs, a) } @@ -62,16 +67,16 @@ func (m *MockLogger) Errorw(ctx context.Context, msg string, keysAndValues ...in } // Errorw indicates an expected call of Errorw. -func (mr *MockLoggerMockRecorder) Errorw(ctx, msg interface{}, keysAndValues ...interface{}) *gomock.Call { +func (mr *MockLoggerMockRecorder) Errorw(ctx, msg any, keysAndValues ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, msg}, keysAndValues...) + varargs := append([]any{ctx, msg}, keysAndValues...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Errorw", reflect.TypeOf((*MockLogger)(nil).Errorw), varargs...) } // Infow mocks base method. -func (m *MockLogger) Infow(ctx context.Context, msg string, keysAndValues ...interface{}) { +func (m *MockLogger) Infow(ctx context.Context, msg string, keysAndValues ...any) { m.ctrl.T.Helper() - varargs := []interface{}{ctx, msg} + varargs := []any{ctx, msg} for _, a := range keysAndValues { varargs = append(varargs, a) } @@ -79,16 +84,16 @@ func (m *MockLogger) Infow(ctx context.Context, msg string, keysAndValues ...int } // Infow indicates an expected call of Infow. -func (mr *MockLoggerMockRecorder) Infow(ctx, msg interface{}, keysAndValues ...interface{}) *gomock.Call { +func (mr *MockLoggerMockRecorder) Infow(ctx, msg any, keysAndValues ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, msg}, keysAndValues...) + varargs := append([]any{ctx, msg}, keysAndValues...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Infow", reflect.TypeOf((*MockLogger)(nil).Infow), varargs...) } // Warnw mocks base method. -func (m *MockLogger) Warnw(ctx context.Context, msg string, keysAndValues ...interface{}) { +func (m *MockLogger) Warnw(ctx context.Context, msg string, keysAndValues ...any) { m.ctrl.T.Helper() - varargs := []interface{}{ctx, msg} + varargs := []any{ctx, msg} for _, a := range keysAndValues { varargs = append(varargs, a) } @@ -96,8 +101,8 @@ func (m *MockLogger) Warnw(ctx context.Context, msg string, keysAndValues ...int } // Warnw indicates an expected call of Warnw. -func (mr *MockLoggerMockRecorder) Warnw(ctx, msg interface{}, keysAndValues ...interface{}) *gomock.Call { +func (mr *MockLoggerMockRecorder) Warnw(ctx, msg any, keysAndValues ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, msg}, keysAndValues...) + varargs := append([]any{ctx, msg}, keysAndValues...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Warnw", reflect.TypeOf((*MockLogger)(nil).Warnw), varargs...) } diff --git a/mocks/mock_reader.go b/mocks/mock_reader.go index 7431991..876cdc7 100644 --- a/mocks/mock_reader.go +++ b/mocks/mock_reader.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: kreader.go +// +// Generated by this command: +// +// mockgen -source=kreader.go -package mock_zkafka -mock_names reader=MockReader -destination=./mock_reader.go +// // Package mock_zkafka is a generated GoMock package. package mock_zkafka @@ -8,8 +13,8 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" zkafka "github.com/zillow/zkafka" + gomock "go.uber.org/mock/gomock" ) // MockReader is a mock of reader interface. @@ -45,7 +50,7 @@ func (m *MockReader) Assignments(arg0 context.Context) ([]zkafka.Assignment, err } // Assignments indicates an expected call of Assignments. -func (mr *MockReaderMockRecorder) Assignments(arg0 interface{}) *gomock.Call { +func (mr *MockReaderMockRecorder) Assignments(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Assignments", reflect.TypeOf((*MockReader)(nil).Assignments), arg0) } @@ -74,7 +79,7 @@ func (m *MockReader) Read(ctx context.Context) (*zkafka.Message, error) { } // Read indicates an expected call of Read. -func (mr *MockReaderMockRecorder) Read(ctx interface{}) *gomock.Call { +func (mr *MockReaderMockRecorder) Read(ctx any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockReader)(nil).Read), ctx) } diff --git a/mocks/mock_writer.go b/mocks/mock_writer.go index a304214..85c9c52 100644 --- a/mocks/mock_writer.go +++ b/mocks/mock_writer.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: kwriter.go +// +// Generated by this command: +// +// mockgen -source=kwriter.go -package mock_zkafka -mock_names writer=MockWriter -destination=./mock_writer.go +// // Package mock_zkafka is a generated GoMock package. package mock_zkafka @@ -8,8 +13,8 @@ import ( context "context" reflect "reflect" - gomock "github.com/golang/mock/gomock" zkafka "github.com/zillow/zkafka" + gomock "go.uber.org/mock/gomock" ) // MockWriter is a mock of writer interface. @@ -48,9 +53,9 @@ func (mr *MockWriterMockRecorder) Close() *gomock.Call { } // Write mocks base method. -func (m *MockWriter) Write(ctx context.Context, value interface{}, opts ...zkafka.WriteOption) (zkafka.Response, error) { +func (m *MockWriter) Write(ctx context.Context, value any, opts ...zkafka.WriteOption) (zkafka.Response, error) { m.ctrl.T.Helper() - varargs := []interface{}{ctx, value} + varargs := []any{ctx, value} for _, a := range opts { varargs = append(varargs, a) } @@ -61,16 +66,16 @@ func (m *MockWriter) Write(ctx context.Context, value interface{}, opts ...zkafk } // Write indicates an expected call of Write. -func (mr *MockWriterMockRecorder) Write(ctx, value interface{}, opts ...interface{}) *gomock.Call { +func (mr *MockWriterMockRecorder) Write(ctx, value any, opts ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, value}, opts...) + varargs := append([]any{ctx, value}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*MockWriter)(nil).Write), varargs...) } // WriteKey mocks base method. -func (m *MockWriter) WriteKey(ctx context.Context, key string, value interface{}, opts ...zkafka.WriteOption) (zkafka.Response, error) { +func (m *MockWriter) WriteKey(ctx context.Context, key string, value any, opts ...zkafka.WriteOption) (zkafka.Response, error) { m.ctrl.T.Helper() - varargs := []interface{}{ctx, key, value} + varargs := []any{ctx, key, value} for _, a := range opts { varargs = append(varargs, a) } @@ -81,16 +86,16 @@ func (m *MockWriter) WriteKey(ctx context.Context, key string, value interface{} } // WriteKey indicates an expected call of WriteKey. -func (mr *MockWriterMockRecorder) WriteKey(ctx, key, value interface{}, opts ...interface{}) *gomock.Call { +func (mr *MockWriterMockRecorder) WriteKey(ctx, key, value any, opts ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, key, value}, opts...) + varargs := append([]any{ctx, key, value}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WriteKey", reflect.TypeOf((*MockWriter)(nil).WriteKey), varargs...) } // WriteRaw mocks base method. func (m *MockWriter) WriteRaw(ctx context.Context, key *string, value []byte, opts ...zkafka.WriteOption) (zkafka.Response, error) { m.ctrl.T.Helper() - varargs := []interface{}{ctx, key, value} + varargs := []any{ctx, key, value} for _, a := range opts { varargs = append(varargs, a) } @@ -101,8 +106,8 @@ func (m *MockWriter) WriteRaw(ctx context.Context, key *string, value []byte, op } // WriteRaw indicates an expected call of WriteRaw. -func (mr *MockWriterMockRecorder) WriteRaw(ctx, key, value interface{}, opts ...interface{}) *gomock.Call { +func (mr *MockWriterMockRecorder) WriteRaw(ctx, key, value any, opts ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, key, value}, opts...) + varargs := append([]any{ctx, key, value}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WriteRaw", reflect.TypeOf((*MockWriter)(nil).WriteRaw), varargs...) } diff --git a/reader_test.go b/reader_test.go index 52bb81b..182c812 100644 --- a/reader_test.go +++ b/reader_test.go @@ -11,8 +11,8 @@ import ( "github.com/stretchr/testify/require" mock_confluent "github.com/zillow/zkafka/mocks/confluent" - "github.com/golang/mock/gomock" "github.com/zillow/zfmt" + "go.uber.org/mock/gomock" ) func TestReader_Read_NilReturn(t *testing.T) { diff --git a/test/worker_test.go b/test/worker_test.go index b32e096..2c13a32 100644 --- a/test/worker_test.go +++ b/test/worker_test.go @@ -20,7 +20,7 @@ import ( zkafka_mocks "github.com/zillow/zkafka/mocks" "golang.org/x/sync/errgroup" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" ) const ( @@ -1839,7 +1839,7 @@ func Test_MsgOrderingIsMaintainedPerKeyWithAnyNumberOfVirtualPartitions(t *testi l := zkafka.NoopLogger{} mockReader := zkafka_mocks.NewMockReader(ctrl) - var readerCalls []*gomock.Call + var readerCalls []any keyCount := 3 msgCount := 200 for i := 0; i < msgCount; i++ { diff --git a/test/writer_test.go b/test/writer_test.go index 4027502..7d9ed50 100644 --- a/test/writer_test.go +++ b/test/writer_test.go @@ -9,11 +9,11 @@ import ( "testing" "github.com/confluentinc/confluent-kafka-go/v2/kafka" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "github.com/zillow/zfmt" "github.com/zillow/zkafka" mock_confluent "github.com/zillow/zkafka/mocks/confluent" + "go.uber.org/mock/gomock" ) func TestWriter_Write_LifecycleHooksCalled(t *testing.T) { diff --git a/work_test.go b/work_test.go index 1dfc6b5..153c76a 100644 --- a/work_test.go +++ b/work_test.go @@ -18,8 +18,8 @@ import ( "go.opentelemetry.io/otel/trace/noop" "github.com/confluentinc/confluent-kafka-go/v2/kafka" - "github.com/golang/mock/gomock" mock_confluent "github.com/zillow/zkafka/mocks/confluent" + "go.uber.org/mock/gomock" ) func TestWork_processTimeoutMillis(t *testing.T) { @@ -142,7 +142,7 @@ func TestWork_ShouldCommitMessagesProperly(t *testing.T) { consumer := mock_confluent.NewMockKafkaConsumer(ctrl) consumer.EXPECT().SubscribeTopics(gomock.Any(), gomock.Any()).Times(1) - var consumerCalls []*gomock.Call + var consumerCalls []any msgToDelay := make(map[key]time.Duration) for i := range inputs { @@ -285,7 +285,7 @@ func TestWork_CommitManagerIsEmptyAfterAllProcessingCompletes(t *testing.T) { consumer := mock_confluent.NewMockKafkaConsumer(ctrl) consumer.EXPECT().SubscribeTopics(gomock.Any(), gomock.Any()).Times(1) - var consumerCalls []*gomock.Call + var consumerCalls []any msgToDelay := make(map[key]time.Duration) for i := range inputs { @@ -407,8 +407,7 @@ func TestWork_WithDoneWithContext(t *testing.T) { consumer := mock_confluent.NewMockKafkaConsumer(ctrl) consumer.EXPECT().SubscribeTopics(gomock.Any(), gomock.Any()).Times(1) - var consumerCalls []*gomock.Call - + var consumerCalls []any msgToDelay := make(map[key]time.Duration) for i := range inputs { input := inputs[i] diff --git a/writer_test.go b/writer_test.go index dd56bb1..f384fa1 100644 --- a/writer_test.go +++ b/writer_test.go @@ -7,13 +7,13 @@ import ( "testing" "github.com/confluentinc/confluent-kafka-go/v2/kafka" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "github.com/zillow/zfmt" mock_confluent "github.com/zillow/zkafka/mocks/confluent" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace/noop" + "go.uber.org/mock/gomock" ) func TestWriter_Write(t *testing.T) { From 11a708ac826b62a95c50be881363e71abb9d1d9b Mon Sep 17 00:00:00 2001 From: stewartboyd119 Date: Thu, 17 Oct 2024 11:31:01 -0700 Subject: [PATCH 2/5] Updated to v2 --- README.md | 8 ++++---- changelog.md | 4 ++++ client.go | 2 +- client_test.go | 2 +- example/producer/main.go | 2 +- example/producer_avro/go.mod | 6 +++--- example/producer_avro/main.go | 2 +- example/worker-deadletter/main.go | 2 +- example/worker-delay/main.go | 2 +- example/worker/main.go | 2 +- example/worker_avro/go.mod | 6 +++--- example/worker_avro/main.go | 2 +- go.mod | 2 +- mocks/confluent/kafka_consumer.go | 2 +- mocks/confluent/kafka_producer.go | 2 +- mocks/kreader.go | 2 +- mocks/kwriter.go | 2 +- mocks/mock_client.go | 2 +- mocks/mock_reader.go | 2 +- mocks/mock_writer.go | 2 +- reader_test.go | 2 +- test/integration_test.go | 2 +- test/schema_registry_evo_test.go | 14 +++++++------- test/schema_registry_test.go | 10 +++++----- test/worker_test.go | 4 ++-- test/writer_test.go | 4 ++-- work_test.go | 2 +- writer_test.go | 2 +- 28 files changed, 50 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index b2a2901..c3e6f9b 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ # zkafka -[![License](https://img.shields.io/github/license/zillow/zkafka)](https://github.com/zillow/zkafka/blob/main/LICENSE) -[![GitHub Actions](https://github.com/zillow/zkafka/actions/workflows/go.yml/badge.svg)](https://github.com/zillow/zkafka/actions/workflows/go.yml) +[![License](https://img.shields.io/github/license/zillow/zkafka)](https://github.com/zillow/zkafka/v2/blob/main/LICENSE) +[![GitHub Actions](https://github.com/zillow/zkafka/v2/actions/workflows/go.yml/badge.svg)](https://github.com/zillow/zkafka/v2/actions/workflows/go.yml) [![Codecov](https://codecov.io/gh/zillow/zkafka/branch/main/graph/badge.svg?token=STRT8T67YP)](https://codecov.io/gh/zillow/zkafka) -[![Go Report Card](https://goreportcard.com/badge/github.com/zillow/zkafka)](https://goreportcard.com/report/github.com/zillow/zkafka) +[![Go Report Card](https://goreportcard.com/badge/github.com/zillow/zkafka/v2)](https://goreportcard.com/report/github.com/zillow/zkafka/v2) ## Install -`go get -u github.com/zillow/zkafka` +`go get -u github.com/zillow/zkafka/v2` ## About diff --git a/changelog.md b/changelog.md index 1936597..3faa0a7 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning. +## 2.0.0 (October 17, 2024) + +1. Removed dependency on github.com/golang/mock (deprecated) in favor of github.com/uber-go/mock + ## 1.3.0 (Sep 25, 2024) 1. Added `WithDisableCircuitBreaker` and `WithDisableBusyLoopBreaker` options. These are variants of the now deprecated `DisableCircuitBreaker` diff --git a/client.go b/client.go index 6e44ee9..cc5548e 100644 --- a/client.go +++ b/client.go @@ -22,7 +22,7 @@ type ClientProvider interface { // static type checking for the convenient Writer interface var _ ClientProvider = (*Client)(nil) -const instrumentationName = "github.com/zillow/zkafka" +const instrumentationName = "github.com/zillow/zkafka/v2" // Client helps instantiate usable readers and writers type Client struct { diff --git a/client_test.go b/client_test.go index 1a28950..2f288ab 100644 --- a/client_test.go +++ b/client_test.go @@ -14,7 +14,7 @@ import ( "github.com/google/go-cmp/cmp/cmpopts" "github.com/stretchr/testify/require" "github.com/zillow/zfmt" - mock_confluent "github.com/zillow/zkafka/mocks/confluent" + mock_confluent "github.com/zillow/zkafka/v2/mocks/confluent" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" "go.opentelemetry.io/otel/trace/noop" diff --git a/example/producer/main.go b/example/producer/main.go index 94cfe77..87fab8a 100644 --- a/example/producer/main.go +++ b/example/producer/main.go @@ -7,7 +7,7 @@ import ( "time" "github.com/zillow/zfmt" - "github.com/zillow/zkafka" + "github.com/zillow/zkafka/v2" ) func main() { diff --git a/example/producer_avro/go.mod b/example/producer_avro/go.mod index 7e0b337..47f1a38 100644 --- a/example/producer_avro/go.mod +++ b/example/producer_avro/go.mod @@ -1,10 +1,10 @@ -module github.com/zillow/zkafka/example/producer_avro +module github.com/zillow/zkafka/v2/example/producer_avro go 1.23.1 -replace github.com/zillow/zkafka v1.0.0 => ../.. +replace github.com/zillow/zkafka/v2 v1.0.0 => ../.. -require github.com/zillow/zkafka v1.0.0 +require github.com/zillow/zkafka/v2 v1.0.0 require ( github.com/actgardner/gogen-avro/v10 v10.2.1 // indirect diff --git a/example/producer_avro/main.go b/example/producer_avro/main.go index 219b53f..891fb87 100644 --- a/example/producer_avro/main.go +++ b/example/producer_avro/main.go @@ -7,7 +7,7 @@ import ( "math/rand" "time" - "github.com/zillow/zkafka" + "github.com/zillow/zkafka/v2" ) //go:embed event.avsc diff --git a/example/worker-deadletter/main.go b/example/worker-deadletter/main.go index 697eebc..8dd6ba1 100644 --- a/example/worker-deadletter/main.go +++ b/example/worker-deadletter/main.go @@ -10,7 +10,7 @@ import ( "syscall" "time" - "github.com/zillow/zkafka" + "github.com/zillow/zkafka/v2" ) // Demonstrates reading from a topic via the zkafka.Work struct which is more convenient, typically, than using the consumer directly diff --git a/example/worker-delay/main.go b/example/worker-delay/main.go index 4725233..73a01bc 100644 --- a/example/worker-delay/main.go +++ b/example/worker-delay/main.go @@ -8,7 +8,7 @@ import ( "syscall" "time" - "github.com/zillow/zkafka" + "github.com/zillow/zkafka/v2" ) // Demonstrates reading from a topic via the zkafka.Work struct which is more convenient, typically, than using the consumer directly diff --git a/example/worker/main.go b/example/worker/main.go index f505582..1d51f4c 100644 --- a/example/worker/main.go +++ b/example/worker/main.go @@ -9,7 +9,7 @@ import ( "time" "github.com/zillow/zfmt" - "github.com/zillow/zkafka" + "github.com/zillow/zkafka/v2" ) // Demonstrates reading from a topic via the zkafka.Work struct which is more convenient, typically, than using the consumer directly diff --git a/example/worker_avro/go.mod b/example/worker_avro/go.mod index ca246bd..ec092ee 100644 --- a/example/worker_avro/go.mod +++ b/example/worker_avro/go.mod @@ -1,12 +1,12 @@ -module github.com/zillow/zkafka/example/worker_avro +module github.com/zillow/zkafka/v2/example/worker_avro go 1.23.1 -replace github.com/zillow/zkafka v1.0.0 => ../.. +replace github.com/zillow/zkafka/v2 v1.0.0 => ../.. require ( github.com/google/uuid v1.6.0 - github.com/zillow/zkafka v1.0.0 + github.com/zillow/zkafka/v2 v1.0.0 ) require ( diff --git a/example/worker_avro/main.go b/example/worker_avro/main.go index 8050c49..8abc1ee 100644 --- a/example/worker_avro/main.go +++ b/example/worker_avro/main.go @@ -10,7 +10,7 @@ import ( "time" "github.com/google/uuid" - "github.com/zillow/zkafka" + "github.com/zillow/zkafka/v2" ) //go:embed event.avsc diff --git a/go.mod b/go.mod index 577618b..8681f10 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/zillow/zkafka +module github.com/zillow/zkafka/v2 go 1.23 diff --git a/mocks/confluent/kafka_consumer.go b/mocks/confluent/kafka_consumer.go index ef2fc83..24aa51f 100644 --- a/mocks/confluent/kafka_consumer.go +++ b/mocks/confluent/kafka_consumer.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/zillow/zkafka (interfaces: KafkaConsumer) +// Source: github.com/zillow/zkafka/v2 (interfaces: KafkaConsumer) // // Generated by this command: // diff --git a/mocks/confluent/kafka_producer.go b/mocks/confluent/kafka_producer.go index e8156a2..bf2da87 100644 --- a/mocks/confluent/kafka_producer.go +++ b/mocks/confluent/kafka_producer.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/zillow/zkafka (interfaces: KafkaProducer) +// Source: github.com/zillow/zkafka/v2 (interfaces: KafkaProducer) // // Generated by this command: // diff --git a/mocks/kreader.go b/mocks/kreader.go index 70d7cc4..4e98256 100644 --- a/mocks/kreader.go +++ b/mocks/kreader.go @@ -5,7 +5,7 @@ package mock_zkafka import ( "context" - "github.com/zillow/zkafka" + "github.com/zillow/zkafka/v2" ) var ( diff --git a/mocks/kwriter.go b/mocks/kwriter.go index 6dc2dc1..ec06ec7 100644 --- a/mocks/kwriter.go +++ b/mocks/kwriter.go @@ -5,7 +5,7 @@ package mock_zkafka import ( "context" - "github.com/zillow/zkafka" + "github.com/zillow/zkafka/v2" ) var ( diff --git a/mocks/mock_client.go b/mocks/mock_client.go index 398224b..4bc1f4b 100644 --- a/mocks/mock_client.go +++ b/mocks/mock_client.go @@ -13,7 +13,7 @@ import ( context "context" reflect "reflect" - zkafka "github.com/zillow/zkafka" + zkafka "github.com/zillow/zkafka/v2" gomock "go.uber.org/mock/gomock" ) diff --git a/mocks/mock_reader.go b/mocks/mock_reader.go index 876cdc7..8f5885f 100644 --- a/mocks/mock_reader.go +++ b/mocks/mock_reader.go @@ -13,7 +13,7 @@ import ( context "context" reflect "reflect" - zkafka "github.com/zillow/zkafka" + zkafka "github.com/zillow/zkafka/v2" gomock "go.uber.org/mock/gomock" ) diff --git a/mocks/mock_writer.go b/mocks/mock_writer.go index 85c9c52..7f3fd00 100644 --- a/mocks/mock_writer.go +++ b/mocks/mock_writer.go @@ -13,7 +13,7 @@ import ( context "context" reflect "reflect" - zkafka "github.com/zillow/zkafka" + zkafka "github.com/zillow/zkafka/v2" gomock "go.uber.org/mock/gomock" ) diff --git a/reader_test.go b/reader_test.go index 182c812..66b3efb 100644 --- a/reader_test.go +++ b/reader_test.go @@ -9,7 +9,7 @@ import ( "github.com/confluentinc/confluent-kafka-go/v2/kafka" "github.com/stretchr/testify/require" - mock_confluent "github.com/zillow/zkafka/mocks/confluent" + mock_confluent "github.com/zillow/zkafka/v2/mocks/confluent" "github.com/zillow/zfmt" "go.uber.org/mock/gomock" diff --git a/test/integration_test.go b/test/integration_test.go index 40552f4..081c13f 100644 --- a/test/integration_test.go +++ b/test/integration_test.go @@ -17,7 +17,7 @@ import ( "github.com/google/uuid" "github.com/stretchr/testify/require" "github.com/zillow/zfmt" - "github.com/zillow/zkafka" + "github.com/zillow/zkafka/v2" "golang.org/x/sync/errgroup" ) diff --git a/test/schema_registry_evo_test.go b/test/schema_registry_evo_test.go index 7252ab2..28d2d9d 100644 --- a/test/schema_registry_evo_test.go +++ b/test/schema_registry_evo_test.go @@ -17,13 +17,13 @@ import ( "github.com/google/go-cmp/cmp/cmpopts" "github.com/google/uuid" "github.com/stretchr/testify/require" - "github.com/zillow/zkafka" - "github.com/zillow/zkafka/test/evolution/avro1" - "github.com/zillow/zkafka/test/evolution/avro2" - "github.com/zillow/zkafka/test/evolution/json1" - "github.com/zillow/zkafka/test/evolution/json2" - "github.com/zillow/zkafka/test/evolution/proto1" - "github.com/zillow/zkafka/test/evolution/proto2" + "github.com/zillow/zkafka/v2" + "github.com/zillow/zkafka/v2/test/evolution/avro1" + "github.com/zillow/zkafka/v2/test/evolution/avro2" + "github.com/zillow/zkafka/v2/test/evolution/json1" + "github.com/zillow/zkafka/v2/test/evolution/json2" + "github.com/zillow/zkafka/v2/test/evolution/proto1" + "github.com/zillow/zkafka/v2/test/evolution/proto2" ) // Test_SchemaRegistryReal_Avro_AutoRegisterSchemas_BackwardCompatibleSchemasCanBeRegisteredAndReadFrom tests diff --git a/test/schema_registry_test.go b/test/schema_registry_test.go index d04f433..5033995 100644 --- a/test/schema_registry_test.go +++ b/test/schema_registry_test.go @@ -13,11 +13,11 @@ import ( "github.com/google/uuid" "github.com/stretchr/testify/require" "github.com/zillow/zfmt" - "github.com/zillow/zkafka" - "github.com/zillow/zkafka/test/evolution/avro1" - avro1x "github.com/zillow/zkafka/test/evolution/avro1x" - "github.com/zillow/zkafka/test/evolution/json1" - "github.com/zillow/zkafka/test/evolution/proto1" + "github.com/zillow/zkafka/v2" + "github.com/zillow/zkafka/v2/test/evolution/avro1" + avro1x "github.com/zillow/zkafka/v2/test/evolution/avro1x" + "github.com/zillow/zkafka/v2/test/evolution/json1" + "github.com/zillow/zkafka/v2/test/evolution/proto1" ) //go:embed evolution/schema_1.avsc diff --git a/test/worker_test.go b/test/worker_test.go index 2c13a32..3d6de43 100644 --- a/test/worker_test.go +++ b/test/worker_test.go @@ -16,8 +16,8 @@ import ( "github.com/google/uuid" "github.com/stretchr/testify/require" "github.com/zillow/zfmt" - "github.com/zillow/zkafka" - zkafka_mocks "github.com/zillow/zkafka/mocks" + "github.com/zillow/zkafka/v2" + zkafka_mocks "github.com/zillow/zkafka/v2/mocks" "golang.org/x/sync/errgroup" "go.uber.org/mock/gomock" diff --git a/test/writer_test.go b/test/writer_test.go index 7d9ed50..722b80c 100644 --- a/test/writer_test.go +++ b/test/writer_test.go @@ -11,8 +11,8 @@ import ( "github.com/confluentinc/confluent-kafka-go/v2/kafka" "github.com/stretchr/testify/require" "github.com/zillow/zfmt" - "github.com/zillow/zkafka" - mock_confluent "github.com/zillow/zkafka/mocks/confluent" + "github.com/zillow/zkafka/v2" + mock_confluent "github.com/zillow/zkafka/v2/mocks/confluent" "go.uber.org/mock/gomock" ) diff --git a/work_test.go b/work_test.go index 153c76a..70b1996 100644 --- a/work_test.go +++ b/work_test.go @@ -18,7 +18,7 @@ import ( "go.opentelemetry.io/otel/trace/noop" "github.com/confluentinc/confluent-kafka-go/v2/kafka" - mock_confluent "github.com/zillow/zkafka/mocks/confluent" + mock_confluent "github.com/zillow/zkafka/v2/mocks/confluent" "go.uber.org/mock/gomock" ) diff --git a/writer_test.go b/writer_test.go index f384fa1..48f41c5 100644 --- a/writer_test.go +++ b/writer_test.go @@ -9,7 +9,7 @@ import ( "github.com/confluentinc/confluent-kafka-go/v2/kafka" "github.com/stretchr/testify/require" "github.com/zillow/zfmt" - mock_confluent "github.com/zillow/zkafka/mocks/confluent" + mock_confluent "github.com/zillow/zkafka/v2/mocks/confluent" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace/noop" From 1a1e914848ec46324ecf6fe078ab8d8f4295d1e1 Mon Sep 17 00:00:00 2001 From: stewartboyd119 Date: Fri, 18 Oct 2024 20:13:20 -0700 Subject: [PATCH 3/5] Bugfix --- changelog.md | 1 + example/producer_avro/go.mod | 4 ++-- example/worker_avro/go.mod | 4 ++-- workoption.go | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/changelog.md b/changelog.md index 3faa0a7..cae5b27 100644 --- a/changelog.md +++ b/changelog.md @@ -7,6 +7,7 @@ This project adheres to Semantic Versioning. ## 2.0.0 (October 17, 2024) 1. Removed dependency on github.com/golang/mock (deprecated) in favor of github.com/uber-go/mock +2. Bugfixes in `WithDisableCircuitBreaker` and `WithDisableBusyLoopBreaker` options implementation ## 1.3.0 (Sep 25, 2024) diff --git a/example/producer_avro/go.mod b/example/producer_avro/go.mod index 47f1a38..6502a9e 100644 --- a/example/producer_avro/go.mod +++ b/example/producer_avro/go.mod @@ -2,9 +2,9 @@ module github.com/zillow/zkafka/v2/example/producer_avro go 1.23.1 -replace github.com/zillow/zkafka/v2 v1.0.0 => ../.. +replace github.com/zillow/zkafka/v2 v2.0.0 => ../.. -require github.com/zillow/zkafka/v2 v1.0.0 +require github.com/zillow/zkafka/v2 v2.0.0 require ( github.com/actgardner/gogen-avro/v10 v10.2.1 // indirect diff --git a/example/worker_avro/go.mod b/example/worker_avro/go.mod index ec092ee..eeea674 100644 --- a/example/worker_avro/go.mod +++ b/example/worker_avro/go.mod @@ -2,11 +2,11 @@ module github.com/zillow/zkafka/v2/example/worker_avro go 1.23.1 -replace github.com/zillow/zkafka/v2 v1.0.0 => ../.. +replace github.com/zillow/zkafka/v2 v2.0.0 => ../.. require ( github.com/google/uuid v1.6.0 - github.com/zillow/zkafka/v2 v1.0.0 + github.com/zillow/zkafka/v2 v2.0.0 ) require ( diff --git a/workoption.go b/workoption.go index fe94202..b9f5965 100644 --- a/workoption.go +++ b/workoption.go @@ -91,7 +91,7 @@ type disableCbOption struct { } func (d disableCbOption) apply(w *Work) { - w.disableCb = true + w.disableCb = d.disabled } type onDoneOption struct { @@ -117,7 +117,7 @@ type disableBlbOption struct { } func (d disableBlbOption) apply(w *Work) { - w.blb.disabled = true + w.blb.disabled = d.disabled } type dltOption struct { From 65a9465c3fa5619753a4ca25f2281fe14da86f7d Mon Sep 17 00:00:00 2001 From: stewartboyd119 Date: Fri, 18 Oct 2024 20:30:34 -0700 Subject: [PATCH 4/5] Fix coverage.sh --- coverage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coverage.sh b/coverage.sh index 4485c4b..8d14545 100755 --- a/coverage.sh +++ b/coverage.sh @@ -6,7 +6,7 @@ set -x # proto panics in such a situation. Setting this envvar ignores that check export GOLANG_PROTOBUF_REGISTRATION_CONFLICT=ignore # golang packages that will be used for either testing or will be assessed for coverage -pck1=github.com/zillow/zkafka +pck1=github.com/zillow/zkafka/v2 pck2=$pck1/test topdir=$(pwd) From 0c94c9b4366a7bbbcba239f2fadab568eeae2c45 Mon Sep 17 00:00:00 2001 From: stewartboyd119 Date: Fri, 18 Oct 2024 20:43:27 -0700 Subject: [PATCH 5/5] Updated README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c3e6f9b..2c45a8a 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # zkafka -[![License](https://img.shields.io/github/license/zillow/zkafka)](https://github.com/zillow/zkafka/v2/blob/main/LICENSE) -[![GitHub Actions](https://github.com/zillow/zkafka/v2/actions/workflows/go.yml/badge.svg)](https://github.com/zillow/zkafka/v2/actions/workflows/go.yml) +[![License](https://img.shields.io/github/license/zillow/zkafka)](https://github.com/zillow/zkafka/blob/main/LICENSE) +[![GitHub Actions](https://github.com/zillow/zkafka/actions/workflows/go.yml/badge.svg)](https://github.com/zillow/zkafka/actions/workflows/go.yml) [![Codecov](https://codecov.io/gh/zillow/zkafka/branch/main/graph/badge.svg?token=STRT8T67YP)](https://codecov.io/gh/zillow/zkafka) -[![Go Report Card](https://goreportcard.com/badge/github.com/zillow/zkafka/v2)](https://goreportcard.com/report/github.com/zillow/zkafka/v2) +[![Go Report Card](https://goreportcard.com/badge/github.com/zillow/zkafka)](https://goreportcard.com/report/github.com/zillow/zkafka) ## Install