diff --git a/.golangci.yml b/.golangci.yml index b731acf..6980feb 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -7,7 +7,7 @@ linters-settings: goimports: # put imports beginning with prefix after 3rd-party packages; # it's a comma-separated list of prefixes - local-prefixes: github.com/alebabai/go-kit-kafka + local-prefixes: github.com/alebabai/go-kit-kafka/v1 linters: enable: diff --git a/README.md b/README.md index cb7660a..6de1956 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,12 @@ > Apache Kafka integration module for go-kit -[![build](https://img.shields.io/github/actions/workflow/status/alebabai/go-kit-kafka/ci.yml)](https://github.com/alebabai/go-kit-kafka/actions?query=workflow%3ACI) +[![build](https://img.shields.io/github/actions/workflow/status/alebabai/go-kit-kafka/ci.yml)](https://github.com/alebabai/go-kit-kafka/v1/actions?query=workflow%3ACI) [![version](https://img.shields.io/github/go-mod/go-version/alebabai/go-kit-kafka)](https://go.dev/) -[![report](https://goreportcard.com/badge/github.com/alebabai/go-kit-kafka)](https://goreportcard.com/report/github.com/alebabai/go-kit-kafka) +[![report](https://goreportcard.com/badge/github.com/alebabai/go-kit-kafka/v1)](https://goreportcard.com/report/github.com/alebabai/go-kit-kafka/v1) [![coverage](https://img.shields.io/codecov/c/github/alebabai/go-kit-kafka)](https://codecov.io/github/alebabai/go-kit-kafka) -[![tag](https://img.shields.io/github/tag/alebabai/go-kit-kafka.svg)](https://github.com/alebabai/go-kit-kafka/tags) -[![reference](https://pkg.go.dev/badge/github.com/alebabai/go-kit-kafka.svg)](https://pkg.go.dev/github.com/alebabai/go-kit-kafka) +[![tag](https://img.shields.io/github/tag/alebabai/go-kit-kafka.svg)](https://github.com/alebabai/go-kit-kafka/v1/tags) +[![reference](https://pkg.go.dev/badge/github.com/alebabai/go-kit-kafka/v1.svg)](https://pkg.go.dev/github.com/alebabai/go-kit-kafka/v1) ## Getting started @@ -16,13 +16,13 @@ Go modules are supported. Manual install: ```bash -go get -u github.com/alebabai/go-kit-kafka +go get -u github.com/alebabai/go-kit-kafka/v1 ``` Golang import: ```go -import "github.com/alebabai/go-kit-kafka/kafka" +import "github.com/alebabai/go-kit-kafka/v1/kafka" ``` ## Usage diff --git a/_examples/common/consumer/request_response.go b/_examples/common/consumer/request_response.go index 101e379..a743064 100644 --- a/_examples/common/consumer/request_response.go +++ b/_examples/common/consumer/request_response.go @@ -1,7 +1,7 @@ package consumer import ( - "github.com/alebabai/go-kit-kafka/examples/common/domain" + "github.com/alebabai/go-kit-kafka/v1/examples/common/domain" ) type CreateEventRequest struct { diff --git a/_examples/common/consumer/service.go b/_examples/common/consumer/service.go index dcf8dec..17df483 100644 --- a/_examples/common/consumer/service.go +++ b/_examples/common/consumer/service.go @@ -3,7 +3,7 @@ package consumer import ( "context" - "github.com/alebabai/go-kit-kafka/examples/common/domain" + "github.com/alebabai/go-kit-kafka/v1/examples/common/domain" ) type Service interface { diff --git a/_examples/common/consumer/storage.go b/_examples/common/consumer/storage.go index 004e3d7..24bce29 100644 --- a/_examples/common/consumer/storage.go +++ b/_examples/common/consumer/storage.go @@ -8,7 +8,7 @@ import ( "github.com/go-kit/log" - "github.com/alebabai/go-kit-kafka/examples/common/domain" + "github.com/alebabai/go-kit-kafka/v1/examples/common/domain" ) type StorageService struct { diff --git a/_examples/common/consumer/transport_kafka.go b/_examples/common/consumer/transport_kafka.go index 0c42d4d..8a2ffcd 100644 --- a/_examples/common/consumer/transport_kafka.go +++ b/_examples/common/consumer/transport_kafka.go @@ -5,11 +5,11 @@ import ( "encoding/json" "fmt" - "github.com/alebabai/go-kit-kafka/kafka" - "github.com/alebabai/go-kit-kafka/kafka/transport" + "github.com/alebabai/go-kit-kafka/v1/kafka" + "github.com/alebabai/go-kit-kafka/v1/kafka/transport" "github.com/go-kit/kit/endpoint" - "github.com/alebabai/go-kit-kafka/examples/common/domain" + "github.com/alebabai/go-kit-kafka/v1/examples/common/domain" ) func NewKafkaHandler(e endpoint.Endpoint) kafka.Handler { diff --git a/_examples/common/go.mod b/_examples/common/go.mod index a1b351d..f1c9832 100644 --- a/_examples/common/go.mod +++ b/_examples/common/go.mod @@ -1,13 +1,13 @@ -module github.com/alebabai/go-kit-kafka/examples/common +module github.com/alebabai/go-kit-kafka/v1/examples/common go 1.16 require ( - github.com/alebabai/go-kit-kafka v0.0.0 + github.com/alebabai/go-kit-kafka/v1 v0.0.0 github.com/go-kit/kit v0.13.0 github.com/go-kit/log v0.2.1 github.com/google/uuid v1.2.0 github.com/gorilla/mux v1.8.0 ) -replace github.com/alebabai/go-kit-kafka => ../../ +replace github.com/alebabai/go-kit-kafka/v1 => ../../ diff --git a/_examples/common/producer/generator.go b/_examples/common/producer/generator.go index aedaad8..bac5651 100644 --- a/_examples/common/producer/generator.go +++ b/_examples/common/producer/generator.go @@ -7,7 +7,7 @@ import ( "github.com/go-kit/log" "github.com/google/uuid" - "github.com/alebabai/go-kit-kafka/examples/common/domain" + "github.com/alebabai/go-kit-kafka/v1/examples/common/domain" ) type GeneratorService struct { diff --git a/_examples/common/producer/request_response.go b/_examples/common/producer/request_response.go index e26877a..3beb0e3 100644 --- a/_examples/common/producer/request_response.go +++ b/_examples/common/producer/request_response.go @@ -1,7 +1,7 @@ package producer import ( - "github.com/alebabai/go-kit-kafka/examples/common/domain" + "github.com/alebabai/go-kit-kafka/v1/examples/common/domain" ) type GenerateEventRequest struct { diff --git a/_examples/common/producer/service.go b/_examples/common/producer/service.go index 9cffd5a..9e13156 100644 --- a/_examples/common/producer/service.go +++ b/_examples/common/producer/service.go @@ -3,7 +3,7 @@ package producer import ( "context" - "github.com/alebabai/go-kit-kafka/examples/common/domain" + "github.com/alebabai/go-kit-kafka/v1/examples/common/domain" ) type Service interface { diff --git a/_examples/common/producer/transport_kafka.go b/_examples/common/producer/transport_kafka.go index b54b8a8..176cba2 100644 --- a/_examples/common/producer/transport_kafka.go +++ b/_examples/common/producer/transport_kafka.go @@ -3,9 +3,9 @@ package producer import ( "context" - "github.com/alebabai/go-kit-kafka/kafka" - "github.com/alebabai/go-kit-kafka/kafka/tracing" - "github.com/alebabai/go-kit-kafka/kafka/transport" + "github.com/alebabai/go-kit-kafka/v1/kafka" + "github.com/alebabai/go-kit-kafka/v1/kafka/tracing" + "github.com/alebabai/go-kit-kafka/v1/kafka/transport" ) func NewKafkaProducer(handler kafka.Handler, topic string) *transport.Producer { diff --git a/_examples/confluent/cmd/consumer/main.go b/_examples/confluent/cmd/consumer/main.go index 5a1310a..4afc5d2 100644 --- a/_examples/confluent/cmd/consumer/main.go +++ b/_examples/confluent/cmd/consumer/main.go @@ -8,16 +8,16 @@ import ( "os/signal" "syscall" - kafkatransport "github.com/alebabai/go-kit-kafka/kafka/transport" + kafkatransport "github.com/alebabai/go-kit-kafka/v1/kafka/transport" "github.com/confluentinc/confluent-kafka-go/kafka" "github.com/go-kit/kit/transport" "github.com/go-kit/log" "github.com/go-kit/log/level" - "github.com/alebabai/go-kit-kafka/examples/common/consumer" - "github.com/alebabai/go-kit-kafka/examples/common/domain" + "github.com/alebabai/go-kit-kafka/v1/examples/common/consumer" + "github.com/alebabai/go-kit-kafka/v1/examples/common/domain" - "github.com/alebabai/go-kit-kafka/examples/confluent/pkg/consumer/kafka/adapter" + "github.com/alebabai/go-kit-kafka/v1/examples/confluent/pkg/consumer/kafka/adapter" ) func fatal(logger log.Logger, err error) { diff --git a/_examples/confluent/cmd/producer/main.go b/_examples/confluent/cmd/producer/main.go index d24e667..1667601 100644 --- a/_examples/confluent/cmd/producer/main.go +++ b/_examples/confluent/cmd/producer/main.go @@ -14,10 +14,10 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" - "github.com/alebabai/go-kit-kafka/examples/common/domain" - "github.com/alebabai/go-kit-kafka/examples/common/producer" + "github.com/alebabai/go-kit-kafka/v1/examples/common/domain" + "github.com/alebabai/go-kit-kafka/v1/examples/common/producer" - "github.com/alebabai/go-kit-kafka/examples/confluent/pkg/producer/kafka/adapter" + "github.com/alebabai/go-kit-kafka/v1/examples/confluent/pkg/producer/kafka/adapter" ) func fatal(logger log.Logger, err error) { diff --git a/_examples/confluent/go.mod b/_examples/confluent/go.mod index 2f1f634..ffc7df3 100644 --- a/_examples/confluent/go.mod +++ b/_examples/confluent/go.mod @@ -1,15 +1,15 @@ -module github.com/alebabai/go-kit-kafka/examples/confluent +module github.com/alebabai/go-kit-kafka/v1/examples/confluent go 1.16 require ( - github.com/alebabai/go-kit-kafka v0.0.0 - github.com/alebabai/go-kit-kafka/examples/common v0.0.0 + github.com/alebabai/go-kit-kafka/v1 v0.0.0 + github.com/alebabai/go-kit-kafka/v1/examples/common v0.0.0 github.com/confluentinc/confluent-kafka-go v1.8.2 github.com/go-kit/kit v0.13.0 github.com/go-kit/log v0.2.1 ) -replace github.com/alebabai/go-kit-kafka => ../.. +replace github.com/alebabai/go-kit-kafka/v1 => ../.. -replace github.com/alebabai/go-kit-kafka/examples/common => ../common +replace github.com/alebabai/go-kit-kafka/v1/examples/common => ../common diff --git a/_examples/confluent/pkg/consumer/kafka/adapter/listener.go b/_examples/confluent/pkg/consumer/kafka/adapter/listener.go index 0ecf2df..7f90d80 100644 --- a/_examples/confluent/pkg/consumer/kafka/adapter/listener.go +++ b/_examples/confluent/pkg/consumer/kafka/adapter/listener.go @@ -7,7 +7,7 @@ import ( "io" "time" - kitkafka "github.com/alebabai/go-kit-kafka/kafka" + kitkafka "github.com/alebabai/go-kit-kafka/v1/kafka" "github.com/confluentinc/confluent-kafka-go/kafka" "github.com/go-kit/kit/transport" ) diff --git a/_examples/confluent/pkg/consumer/kafka/adapter/message.go b/_examples/confluent/pkg/consumer/kafka/adapter/message.go index 261682f..6788c89 100644 --- a/_examples/confluent/pkg/consumer/kafka/adapter/message.go +++ b/_examples/confluent/pkg/consumer/kafka/adapter/message.go @@ -1,7 +1,7 @@ package adapter import ( - kitkafka "github.com/alebabai/go-kit-kafka/kafka" + kitkafka "github.com/alebabai/go-kit-kafka/v1/kafka" "github.com/confluentinc/confluent-kafka-go/kafka" ) diff --git a/_examples/confluent/pkg/producer/kafka/adapter/message.go b/_examples/confluent/pkg/producer/kafka/adapter/message.go index 74c89d0..b614772 100644 --- a/_examples/confluent/pkg/producer/kafka/adapter/message.go +++ b/_examples/confluent/pkg/producer/kafka/adapter/message.go @@ -1,7 +1,7 @@ package adapter import ( - kitkafka "github.com/alebabai/go-kit-kafka/kafka" + kitkafka "github.com/alebabai/go-kit-kafka/v1/kafka" "github.com/confluentinc/confluent-kafka-go/kafka" ) diff --git a/_examples/confluent/pkg/producer/kafka/adapter/producer.go b/_examples/confluent/pkg/producer/kafka/adapter/producer.go index 263e311..e7752b3 100644 --- a/_examples/confluent/pkg/producer/kafka/adapter/producer.go +++ b/_examples/confluent/pkg/producer/kafka/adapter/producer.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - kitkafka "github.com/alebabai/go-kit-kafka/kafka" + kitkafka "github.com/alebabai/go-kit-kafka/v1/kafka" "github.com/confluentinc/confluent-kafka-go/kafka" ) diff --git a/_examples/sarama/cmd/consumer/main.go b/_examples/sarama/cmd/consumer/main.go index 85a877c..c4c6256 100644 --- a/_examples/sarama/cmd/consumer/main.go +++ b/_examples/sarama/cmd/consumer/main.go @@ -9,15 +9,15 @@ import ( "syscall" "github.com/Shopify/sarama" - kafkatransport "github.com/alebabai/go-kit-kafka/kafka/transport" + kafkatransport "github.com/alebabai/go-kit-kafka/v1/kafka/transport" "github.com/go-kit/kit/transport" "github.com/go-kit/log" "github.com/go-kit/log/level" - "github.com/alebabai/go-kit-kafka/examples/common/consumer" - "github.com/alebabai/go-kit-kafka/examples/common/domain" + "github.com/alebabai/go-kit-kafka/v1/examples/common/consumer" + "github.com/alebabai/go-kit-kafka/v1/examples/common/domain" - "github.com/alebabai/go-kit-kafka/examples/sarama/pkg/consumer/kafka/adapter" + "github.com/alebabai/go-kit-kafka/v1/examples/sarama/pkg/consumer/kafka/adapter" ) func fatal(logger log.Logger, err error) { diff --git a/_examples/sarama/cmd/producer/main.go b/_examples/sarama/cmd/producer/main.go index c4cdd4d..328f566 100644 --- a/_examples/sarama/cmd/producer/main.go +++ b/_examples/sarama/cmd/producer/main.go @@ -14,10 +14,10 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" - "github.com/alebabai/go-kit-kafka/examples/common/domain" - "github.com/alebabai/go-kit-kafka/examples/common/producer" + "github.com/alebabai/go-kit-kafka/v1/examples/common/domain" + "github.com/alebabai/go-kit-kafka/v1/examples/common/producer" - "github.com/alebabai/go-kit-kafka/examples/sarama/pkg/producer/kafka/adapter" + "github.com/alebabai/go-kit-kafka/v1/examples/sarama/pkg/producer/kafka/adapter" ) func fatal(logger log.Logger, err error) { diff --git a/_examples/sarama/go.mod b/_examples/sarama/go.mod index 7d4c70c..9ce8b75 100644 --- a/_examples/sarama/go.mod +++ b/_examples/sarama/go.mod @@ -1,15 +1,15 @@ -module github.com/alebabai/go-kit-kafka/examples/sarama +module github.com/alebabai/go-kit-kafka/v1/examples/sarama go 1.16 require ( github.com/Shopify/sarama v1.32.0 - github.com/alebabai/go-kit-kafka v0.0.0 - github.com/alebabai/go-kit-kafka/examples/common v0.0.0 + github.com/alebabai/go-kit-kafka/v1 v0.0.0 + github.com/alebabai/go-kit-kafka/v1/examples/common v0.0.0 github.com/go-kit/kit v0.13.0 github.com/go-kit/log v0.2.1 ) -replace github.com/alebabai/go-kit-kafka => ../.. +replace github.com/alebabai/go-kit-kafka/v1 => ../.. -replace github.com/alebabai/go-kit-kafka/examples/common => ../common +replace github.com/alebabai/go-kit-kafka/v1/examples/common => ../common diff --git a/_examples/sarama/pkg/consumer/kafka/adapter/consumer_group_handler.go b/_examples/sarama/pkg/consumer/kafka/adapter/consumer_group_handler.go index e01bb66..e848361 100644 --- a/_examples/sarama/pkg/consumer/kafka/adapter/consumer_group_handler.go +++ b/_examples/sarama/pkg/consumer/kafka/adapter/consumer_group_handler.go @@ -6,7 +6,7 @@ import ( "fmt" "github.com/Shopify/sarama" - "github.com/alebabai/go-kit-kafka/kafka" + "github.com/alebabai/go-kit-kafka/v1/kafka" "github.com/go-kit/kit/transport" ) diff --git a/_examples/sarama/pkg/consumer/kafka/adapter/message.go b/_examples/sarama/pkg/consumer/kafka/adapter/message.go index dbc1b62..5cebe1c 100644 --- a/_examples/sarama/pkg/consumer/kafka/adapter/message.go +++ b/_examples/sarama/pkg/consumer/kafka/adapter/message.go @@ -2,7 +2,7 @@ package adapter import ( "github.com/Shopify/sarama" - "github.com/alebabai/go-kit-kafka/kafka" + "github.com/alebabai/go-kit-kafka/v1/kafka" ) func TransformMessage(msg *sarama.ConsumerMessage) *kafka.Message { diff --git a/_examples/sarama/pkg/producer/kafka/adapter/message.go b/_examples/sarama/pkg/producer/kafka/adapter/message.go index 38169fd..ffae7ff 100644 --- a/_examples/sarama/pkg/producer/kafka/adapter/message.go +++ b/_examples/sarama/pkg/producer/kafka/adapter/message.go @@ -2,7 +2,7 @@ package adapter import ( "github.com/Shopify/sarama" - "github.com/alebabai/go-kit-kafka/kafka" + "github.com/alebabai/go-kit-kafka/v1/kafka" ) func TransformMessage(msg *kafka.Message) *sarama.ProducerMessage { diff --git a/_examples/sarama/pkg/producer/kafka/adapter/producer.go b/_examples/sarama/pkg/producer/kafka/adapter/producer.go index d57ee62..3418854 100644 --- a/_examples/sarama/pkg/producer/kafka/adapter/producer.go +++ b/_examples/sarama/pkg/producer/kafka/adapter/producer.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/Shopify/sarama" - "github.com/alebabai/go-kit-kafka/kafka" + "github.com/alebabai/go-kit-kafka/v1/kafka" ) type Producer struct { diff --git a/go.mod b/go.mod index 7aa37b3..8b5a5a2 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/alebabai/go-kit-kafka +module github.com/alebabai/go-kit-kafka/v1 go 1.16 diff --git a/kafka/tracing/context.go b/kafka/tracing/context.go index 0d927ef..8df2bd3 100644 --- a/kafka/tracing/context.go +++ b/kafka/tracing/context.go @@ -3,7 +3,7 @@ package tracing import ( "context" - "github.com/alebabai/go-kit-kafka/kafka" + "github.com/alebabai/go-kit-kafka/v1/kafka" ) type KafkaContextKey string diff --git a/kafka/tracing/opentracing/propagation.go b/kafka/tracing/opentracing/propagation.go index 056059b..45caea0 100644 --- a/kafka/tracing/opentracing/propagation.go +++ b/kafka/tracing/opentracing/propagation.go @@ -9,8 +9,8 @@ import ( "github.com/go-kit/log" - "github.com/alebabai/go-kit-kafka/kafka" - "github.com/alebabai/go-kit-kafka/kafka/transport" + "github.com/alebabai/go-kit-kafka/v1/kafka" + "github.com/alebabai/go-kit-kafka/v1/kafka/transport" ) // KafkaHeadersCarrier satisfies both [opentracing.TextMapWriter] and [opentracing.TextMapReader]. diff --git a/kafka/transport/consumer.go b/kafka/transport/consumer.go index a167c61..4c7a742 100644 --- a/kafka/transport/consumer.go +++ b/kafka/transport/consumer.go @@ -6,7 +6,7 @@ import ( "github.com/go-kit/kit/endpoint" "github.com/go-kit/kit/transport" - "github.com/alebabai/go-kit-kafka/kafka" + "github.com/alebabai/go-kit-kafka/v1/kafka" ) // Consumer wraps an endpoint and implements [kafka.Handler]. diff --git a/kafka/transport/encode_decode.go b/kafka/transport/encode_decode.go index 584df37..190787b 100644 --- a/kafka/transport/encode_decode.go +++ b/kafka/transport/encode_decode.go @@ -3,7 +3,7 @@ package transport import ( "context" - "github.com/alebabai/go-kit-kafka/kafka" + "github.com/alebabai/go-kit-kafka/v1/kafka" ) // DecodeRequestFunc extracts a user-domain request object from diff --git a/kafka/transport/producer.go b/kafka/transport/producer.go index 1cf70f2..5730008 100644 --- a/kafka/transport/producer.go +++ b/kafka/transport/producer.go @@ -6,7 +6,7 @@ import ( "github.com/go-kit/kit/endpoint" - "github.com/alebabai/go-kit-kafka/kafka" + "github.com/alebabai/go-kit-kafka/v1/kafka" ) // Producer wraps single Kafka topic for message producing diff --git a/kafka/transport/request_response_funcs.go b/kafka/transport/request_response_funcs.go index 4b6d727..bf39af1 100644 --- a/kafka/transport/request_response_funcs.go +++ b/kafka/transport/request_response_funcs.go @@ -3,7 +3,7 @@ package transport import ( "context" - "github.com/alebabai/go-kit-kafka/kafka" + "github.com/alebabai/go-kit-kafka/v1/kafka" ) // RequestFunc may take information from a Kafka message and put it into a diff --git a/kafka/transport/router.go b/kafka/transport/router.go index 79ee75c..5dc759b 100644 --- a/kafka/transport/router.go +++ b/kafka/transport/router.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/alebabai/go-kit-kafka/kafka" + "github.com/alebabai/go-kit-kafka/v1/kafka" ) // Router represents mapping topic -> []kafka.Handler