From 2660a0d94d66d5d777776d2edd236a0dbfa27964 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Tue, 20 Apr 2021 12:53:29 +0300 Subject: [PATCH] update for latest micro Signed-off-by: Vasiliy Tolstov --- go.mod | 4 +--- go.sum | 4 ++-- http.go | 19 +++++++------------ 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/go.mod b/go.mod index 8ff851d..f020e1a 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,6 @@ module github.com/unistack-org/micro-server-http/v3 go 1.16 require ( - github.com/unistack-org/micro/v3 v3.3.15 + github.com/unistack-org/micro/v3 v3.3.16 golang.org/x/net v0.0.0-20210415231046-e915ea6b2b7d ) - -//replace github.com/unistack-org/micro/v3 => ../../micro diff --git a/go.sum b/go.sum index c1bc414..3ac0dab 100644 --- a/go.sum +++ b/go.sum @@ -6,8 +6,8 @@ github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= github.com/silas/dag v0.0.0-20210121180416-41cf55125c34/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I= -github.com/unistack-org/micro/v3 v3.3.15 h1:rj+spzhezCg4gmj1nuF0FRGixC51/7xFACOchB/23/E= -github.com/unistack-org/micro/v3 v3.3.15/go.mod h1:ETGcQQUcjxGaD44LUMX+0fgo8Loh7ExldfIPLvfUmDo= +github.com/unistack-org/micro/v3 v3.3.16 h1:v0h/oC0TO2n1djQJeOjD2jNEqKkiykwI6cpflEVTlQE= +github.com/unistack-org/micro/v3 v3.3.16/go.mod h1:ETGcQQUcjxGaD44LUMX+0fgo8Loh7ExldfIPLvfUmDo= golang.org/x/net v0.0.0-20210415231046-e915ea6b2b7d h1:BgJvlyh+UqCUaPlscHJ+PN8GcpfrFdr7NHjd1JL0+Gs= golang.org/x/net v0.0.0-20210415231046-e915ea6b2b7d/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/http.go b/http.go index 4617907..0bb7d96 100644 --- a/http.go +++ b/http.go @@ -147,15 +147,12 @@ func (h *httpServer) Handle(handler server.Handler) error { func (h *httpServer) NewHandler(handler interface{}, opts ...server.HandlerOption) server.Handler { options := server.NewHandlerOptions(opts...) - var eps []*register.Endpoint - - if !options.Internal { - for name, metadata := range options.Metadata { - eps = append(eps, ®ister.Endpoint{ - Name: name, - Metadata: metadata, - }) - } + eps := make([]*register.Endpoint, 0, len(options.Metadata)) + for name, metadata := range options.Metadata { + eps = append(eps, ®ister.Endpoint{ + Name: name, + Metadata: metadata, + }) } hdlr := &httpHandler{ @@ -287,9 +284,7 @@ func (h *httpServer) Register() error { var subscriberList []*httpSubscriber for e := range h.subscribers { // Only advertise non internal subscribers - if !e.Options().Internal { - subscriberList = append(subscriberList, e) - } + subscriberList = append(subscriberList, e) } sort.Slice(subscriberList, func(i, j int) bool { return subscriberList[i].topic > subscriberList[j].topic