From 3c7cba1494f4bf13c8e4a34e688a27d2c7f8f273 Mon Sep 17 00:00:00 2001 From: erwinvaneyk Date: Thu, 14 Dec 2017 15:37:13 -0800 Subject: [PATCH 1/2] Add govet check --- .travis.yml | 3 ++- hack/verify-govet.sh | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100755 hack/verify-govet.sh diff --git a/.travis.yml b/.travis.yml index b61cfb80..57b6cba8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,10 +7,11 @@ install: - go get github.com/Masterminds/glide - go get github.com/nats-io/nats-streaming-server script: +- hack/verify-gofmt.sh +- hack/verify-govet.sh - cd ${TRAVIS_BUILD_DIR} - glide install - ./build/build-linux.sh -- hack/verify-gofmt.sh - test/runtests.sh notifications: slack: diff --git a/hack/verify-govet.sh b/hack/verify-govet.sh new file mode 100755 index 00000000..aa354584 --- /dev/null +++ b/hack/verify-govet.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +find_files() { + find . -not \( \ + \( \ + -wholename '*/vendor/*' \ + \) -prune \ + \) -name '*.go' +} + +find_files | grep -v '.glide/cache' | xargs -I@ bash -c "go tool vet @" \ No newline at end of file From a953b935edaa4fa9f0c127957278f6cfa0854906 Mon Sep 17 00:00:00 2001 From: erwinvaneyk Date: Thu, 14 Dec 2017 15:42:25 -0800 Subject: [PATCH 2/2] Fix open go vet issues --- cmd/fission-workflows-bundle/bundle/bundle.go | 8 ++++---- pkg/fes/eventstore/nats/client.go | 2 +- pkg/util/util.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/fission-workflows-bundle/bundle/bundle.go b/cmd/fission-workflows-bundle/bundle/bundle.go index 16723404..47b73961 100644 --- a/cmd/fission-workflows-bundle/bundle/bundle.go +++ b/cmd/fission-workflows-bundle/bundle/bundle.go @@ -131,7 +131,7 @@ func Run(ctx context.Context, opts *Options) error { // Http servers if opts.Fission != nil { - proxySrv := http.Server{Addr: FISSION_PROXY_ADDRESS} + proxySrv := &http.Server{Addr: FISSION_PROXY_ADDRESS} defer proxySrv.Shutdown(ctx) runFissionEnvironmentProxy(proxySrv, es, wfiCache(), wfCache(), resolvers) } @@ -159,7 +159,7 @@ func Run(ctx context.Context, opts *Options) error { } if opts.ApiHttp { - apiSrv := http.Server{Addr: API_GATEWAY_ADDRESS} + apiSrv := &http.Server{Addr: API_GATEWAY_ADDRESS} defer apiSrv.Shutdown(ctx) var admin, wf, wfi string if opts.ApiAdmin { @@ -292,7 +292,7 @@ func runWorkflowInvocationApiServer(s *grpc.Server, es fes.EventStore, wfiCache log.Infof("Serving workflow invocation gRPC API at %s.", GRPC_ADDRESS) } -func runHttpGateway(ctx context.Context, gwSrv http.Server, adminApiAddr string, wfApiAddr string, wfiApiAddr string) { +func runHttpGateway(ctx context.Context, gwSrv *http.Server, adminApiAddr string, wfApiAddr string, wfiApiAddr string) { mux := grpcruntime.NewServeMux() grpcOpts := []grpc.DialOption{grpc.WithInsecure()} if adminApiAddr != "" { @@ -325,7 +325,7 @@ func runHttpGateway(ctx context.Context, gwSrv http.Server, adminApiAddr string, log.Info("Serving HTTP API gateway at: ", gwSrv.Addr) } -func runFissionEnvironmentProxy(proxySrv http.Server, es fes.EventStore, wfiCache fes.CacheReader, +func runFissionEnvironmentProxy(proxySrv *http.Server, es fes.EventStore, wfiCache fes.CacheReader, wfCache fes.CacheReader, resolvers map[string]function.Resolver) { workflowParser := parse.NewResolver(resolvers) diff --git a/pkg/fes/eventstore/nats/client.go b/pkg/fes/eventstore/nats/client.go index ac78bed7..2139ecd2 100644 --- a/pkg/fes/eventstore/nats/client.go +++ b/pkg/fes/eventstore/nats/client.go @@ -140,6 +140,6 @@ func toEvent(msg *stan.Msg) (*fes.Event, error) { return nil, err } - e.Id = fmt.Sprintf("%s", msg.Sequence) + e.Id = fmt.Sprintf("%d", msg.Sequence) return e, nil } diff --git a/pkg/util/util.go b/pkg/util/util.go index dcd6032b..0b4cc2c8 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -27,7 +27,7 @@ func CreateScopeId(parentId string, taskId string) string { } // Wait is a sync.WaitGroup.Wait() implementation that supports timeouts -func Wait(wg sync.WaitGroup, timeout time.Duration) bool { +func Wait(wg *sync.WaitGroup, timeout time.Duration) bool { wgDone := make(chan bool) defer close(wgDone) go func() {