From 7a325e2c9e73307e097600af35af0ca0de161f49 Mon Sep 17 00:00:00 2001 From: pugnack Date: Wed, 15 Oct 2025 23:32:52 +0500 Subject: [PATCH] remove using global map for default codecs (#223) --- client/noop.go | 5 ----- client/options.go | 2 +- server/noop.go | 6 ------ 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/client/noop.go b/client/noop.go index 6623c70f..827c6730 100644 --- a/client/noop.go +++ b/client/noop.go @@ -15,11 +15,6 @@ import ( "go.unistack.org/micro/v4/tracer" ) -// DefaultCodecs will be used to encode/decode data -var DefaultCodecs = map[string]codec.Codec{ - "application/octet-stream": codec.NewCodec(), -} - type noopClient struct { funcCall FuncCall funcStream FuncStream diff --git a/client/options.go b/client/options.go index da6f1fc3..e35c7012 100644 --- a/client/options.go +++ b/client/options.go @@ -161,7 +161,7 @@ func NewOptions(opts ...Option) Options { options := Options{ Context: context.Background(), ContentType: DefaultContentType, - Codecs: DefaultCodecs, + Codecs: make(map[string]codec.Codec), CallOptions: CallOptions{ Context: context.Background(), Backoff: DefaultBackoff, diff --git a/server/noop.go b/server/noop.go index 1696bb89..b70e3c4c 100644 --- a/server/noop.go +++ b/server/noop.go @@ -6,7 +6,6 @@ import ( "sync" "time" - "go.unistack.org/micro/v4/codec" "go.unistack.org/micro/v4/logger" "go.unistack.org/micro/v4/register" maddr "go.unistack.org/micro/v4/util/addr" @@ -14,11 +13,6 @@ import ( "go.unistack.org/micro/v4/util/rand" ) -// DefaultCodecs will be used to encode/decode -var DefaultCodecs = map[string]codec.Codec{ - "application/octet-stream": codec.NewCodec(), -} - type rpcHandler struct { opts HandlerOptions handler interface{}