Browse Source

move go vet out of scripts and fixing warning (#12552)

yogy rahmawan 7 năm trước cách đây
mục cha
commit
8b32dc5847

+ 3 - 0
.circleci/config.yml

@@ -88,6 +88,9 @@ jobs:
       - run:
       - run:
           name: run linters
           name: run linters
           command: 'gometalinter.v2 --enable-gc --vendor --deadline 10m --disable-all --enable=deadcode --enable=ineffassign --enable=structcheck --enable=unconvert --enable=varcheck ./...'
           command: 'gometalinter.v2 --enable-gc --vendor --deadline 10m --disable-all --enable=deadcode --enable=ineffassign --enable=structcheck --enable=unconvert --enable=varcheck ./...'
+      - run:
+          name: run go vet 
+          command: 'go vet ./pkg/...'
 
 
   test-frontend:
   test-frontend:
     docker:
     docker:

+ 0 - 2
pkg/services/notifications/notifications.go

@@ -98,8 +98,6 @@ func (ns *NotificationService) Run(ctx context.Context) error {
 			return ctx.Err()
 			return ctx.Err()
 		}
 		}
 	}
 	}
-
-	return nil
 }
 }
 
 
 func (ns *NotificationService) SendWebhookSync(ctx context.Context, cmd *m.SendWebhookSync) error {
 func (ns *NotificationService) SendWebhookSync(ctx context.Context, cmd *m.SendWebhookSync) error {

+ 3 - 1
pkg/services/rendering/phantomjs.go

@@ -58,7 +58,9 @@ func (rs *RenderingService) renderViaPhantomJS(ctx context.Context, opts Opts) (
 		cmdArgs = append([]string{fmt.Sprintf("--output-encoding=%s", opts.Encoding)}, cmdArgs...)
 		cmdArgs = append([]string{fmt.Sprintf("--output-encoding=%s", opts.Encoding)}, cmdArgs...)
 	}
 	}
 
 
-	commandCtx, _ := context.WithTimeout(ctx, opts.Timeout+time.Second*2)
+	commandCtx, cancel := context.WithTimeout(ctx, opts.Timeout+time.Second*2)
+	defer cancel()
+
 	cmd := exec.CommandContext(commandCtx, binPath, cmdArgs...)
 	cmd := exec.CommandContext(commandCtx, binPath, cmdArgs...)
 	cmd.Stderr = cmd.Stdout
 	cmd.Stderr = cmd.Stdout
 
 

+ 1 - 1
pkg/tsdb/elasticsearch/client/client.go

@@ -218,7 +218,7 @@ func (c *baseClientImpl) ExecuteMultisearch(r *MultiSearchRequest) (*MultiSearch
 	elapsed := time.Now().Sub(start)
 	elapsed := time.Now().Sub(start)
 	clientLog.Debug("Decoded multisearch json response", "took", elapsed)
 	clientLog.Debug("Decoded multisearch json response", "took", elapsed)
 
 
-	msr.status = res.StatusCode
+	msr.Status = res.StatusCode
 
 
 	return &msr, nil
 	return &msr, nil
 }
 }

+ 1 - 1
pkg/tsdb/elasticsearch/client/models.go

@@ -74,7 +74,7 @@ type MultiSearchRequest struct {
 
 
 // MultiSearchResponse represents a multi search response
 // MultiSearchResponse represents a multi search response
 type MultiSearchResponse struct {
 type MultiSearchResponse struct {
-	status    int               `json:"status,omitempty"`
+	Status    int               `json:"status,omitempty"`
 	Responses []*SearchResponse `json:"responses"`
 	Responses []*SearchResponse `json:"responses"`
 }
 }
 
 

+ 0 - 3
scripts/circle-test-backend.sh

@@ -13,9 +13,6 @@ function exit_if_fail {
 echo "running go fmt"
 echo "running go fmt"
 exit_if_fail test -z "$(gofmt -s -l ./pkg | tee /dev/stderr)"
 exit_if_fail test -z "$(gofmt -s -l ./pkg | tee /dev/stderr)"
 
 
-echo "running go vet"
-exit_if_fail test -z "$(go vet ./pkg/... | tee /dev/stderr)"
-
 echo "building backend with install to cache pkgs"
 echo "building backend with install to cache pkgs"
 exit_if_fail time go install ./pkg/cmd/grafana-server
 exit_if_fail time go install ./pkg/cmd/grafana-server