From 2af17dc56efd84bb6b4ffddb3e78e4aa07af9223 Mon Sep 17 00:00:00 2001 From: hackerman <3372410+aeneasr@users.noreply.github.com> Date: Thu, 25 Oct 2018 15:47:59 +0200 Subject: [PATCH] ci: Check vet and fix vet errors (#1122) Closes #1090 Signed-off-by: arekkas --- .circleci/config.yml | 8 +++++++- cmd/server/handler_oauth2_factory.go | 2 +- cmd/token_user.go | 3 ++- config/config.go | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bcd7d7063fb..184fef2da47 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,9 +17,15 @@ jobs: # echo 'export GO111MODULE=on' >> $BASH_ENV # source $BASH_ENV - checkout + - run: + name: Enable go1.11 modules + command: | + echo 'export GO111MODULE=on' >> $BASH_ENV + source $BASH_ENV - run: curl -L https://git.io/vp6lP | sh - run: mv ./bin/* $GOPATH/bin - - run: gometalinter --disable-all --enable=gofmt --vendor ./... + - run: go mod download + - run: gometalinter --disable-all --enable=gofmt --enable=vet --vendor ./... test: docker: diff --git a/cmd/server/handler_oauth2_factory.go b/cmd/server/handler_oauth2_factory.go index 457632e64ff..7c975f3b0d0 100644 --- a/cmd/server/handler_oauth2_factory.go +++ b/cmd/server/handler_oauth2_factory.go @@ -118,7 +118,7 @@ func newOAuth2Provider(c *config.Config) fosite.OAuth2Provider { } if tracer, err := c.GetTracer(); err == nil && tracer.IsLoaded() { - hasher = &tracing.TracedBCrypt{fc.HashCost} + hasher = &tracing.TracedBCrypt{WorkFactor: fc.HashCost} } return compose.Compose( diff --git a/cmd/token_user.go b/cmd/token_user.go index 76a8db80f61..2273f55e191 100644 --- a/cmd/token_user.go +++ b/cmd/token_user.go @@ -120,7 +120,8 @@ var tokenUserCmd = &cobra.Command{ server := &http.Server{Addr: fmt.Sprintf(":%d", port), Handler: r} var shutdown = func() { time.Sleep(time.Second * 1) - ctx, _ := context.WithTimeout(context.Background(), time.Second*5) + ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) + defer cancel() server.Shutdown(ctx) } diff --git a/config/config.go b/config/config.go index 24d8a3c0383..f42ee767131 100644 --- a/config/config.go +++ b/config/config.go @@ -330,7 +330,7 @@ func (c *Config) Context() *Context { } if tracer, err := c.GetTracer(); err == nil && tracer.IsLoaded() { - hasher = &tracing.TracedBCrypt{c.BCryptWorkFactor} + hasher = &tracing.TracedBCrypt{WorkFactor: c.BCryptWorkFactor} } c.context = &Context{