From a202afd5e358b857c95d048fc47432759db0d9bd Mon Sep 17 00:00:00 2001 From: Victor Vrantchan Date: Fri, 17 Mar 2017 15:07:06 -0400 Subject: [PATCH] update server to go-kit 0.4.0 --- cmd/scepserver/scepserver.go | 8 ++++---- glide.lock | 16 +++++++++++----- glide.yaml | 2 +- server/transport.go | 3 +-- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/cmd/scepserver/scepserver.go b/cmd/scepserver/scepserver.go index f26c62a..9f29070 100644 --- a/cmd/scepserver/scepserver.go +++ b/cmd/scepserver/scepserver.go @@ -76,8 +76,8 @@ func main() { var logger log.Logger { logger = log.NewLogfmtLogger(os.Stderr) - logger = log.NewContext(logger).With("ts", log.DefaultTimestampUTC) - logger = log.NewContext(logger).With("caller", log.DefaultCaller) + logger = log.With(logger, "ts", log.DefaultTimestampUTC) + logger = log.With(logger, "caller", log.DefaultCaller) } var err error @@ -112,12 +112,12 @@ func main() { logger.Log("err", err) os.Exit(1) } - svc = scepserver.NewLoggingService(log.NewContext(logger).With("component", "service"), svc) + svc = scepserver.NewLoggingService(log.With(logger, "component", "service"), svc) } var h http.Handler // http handler { - h = scepserver.ServiceHandler(ctx, svc, log.NewContext(logger).With("component", "http")) + h = scepserver.ServiceHandler(ctx, svc, log.With(logger, "component", "http")) } // start http server diff --git a/glide.lock b/glide.lock index 4c6ab5b..7910756 100644 --- a/glide.lock +++ b/glide.lock @@ -1,21 +1,27 @@ -hash: 16f973415fd1764dbff6c7a52c94861f25145139a5752c5180f8756f6391028d -updated: 2016-11-11T09:56:01.599837376-05:00 +hash: 2b26616db64c62da0b477bc295912993993361a7fc9c1c5c5163dc5f57512e83 +updated: 2017-03-17T15:02:37.198666981-04:00 imports: +- name: github.com/boltdb/bolt + version: 583e8937c61f1af6513608ccc75c97b6abdf4ff9 - name: github.com/go-kit/kit - version: 6fb874ce59bb45b2f60ee3d289829db02142ecc6 + version: fadad6fffe0466b19df9efd9acde5c9a52df5fa4 subpackages: - endpoint - log - transport/http - name: github.com/go-logfmt/logfmt - version: d4327190ff838312623b09bfeb50d7c93c8d9c1d + version: 390ab7935ee28ec6b286364bba9b4dd6410cb3d5 - name: github.com/go-stack/stack version: 100eb0c0a9c5b306ca2fb4f165df21d80ada4b82 - name: github.com/kr/logfmt version: b84e30acd515aadc4b783ad4ff83aff3299bdfe0 - name: golang.org/x/net - version: 07b51741c1d6423d4a6abab1c49940ec09cb1aaf + version: 4d38db76854b199960801a1734443fd02870d7e1 subpackages: - context - context/ctxhttp +- name: golang.org/x/sys + version: a646d33e2ee3172a661fc09bca23bb4889a41bc8 + subpackages: + - unix testImports: [] diff --git a/glide.yaml b/glide.yaml index 82343c9..8e780fa 100644 --- a/glide.yaml +++ b/glide.yaml @@ -1,7 +1,7 @@ package: github.com/micromdm/scep import: - package: github.com/go-kit/kit - version: ^0.2.0 + version: ^0.4.0 subpackages: - endpoint - log diff --git a/server/transport.go b/server/transport.go index a2fb664..ad2b3d7 100644 --- a/server/transport.go +++ b/server/transport.go @@ -2,6 +2,7 @@ package scepserver import ( "bytes" + "context" "errors" "fmt" "io/ioutil" @@ -10,7 +11,6 @@ import ( "github.com/go-kit/kit/endpoint" kitlog "github.com/go-kit/kit/log" kithttp "github.com/go-kit/kit/transport/http" - "golang.org/x/net/context" ) // ServiceHandler is an HTTP Handler for a SCEP endpoint. @@ -21,7 +21,6 @@ func ServiceHandler(ctx context.Context, svc Service, logger kitlog.Logger) http } scepHandler := kithttp.NewServer( - ctx, makeSCEPEndpoint(svc), decodeSCEPRequest, encodeSCEPResponse,