Skip to content

Commit

Permalink
Fix go vet and races detected
Browse files Browse the repository at this point in the history
  • Loading branch information
evankanderson committed Sep 8, 2020
1 parent 3ee4008 commit 263b86c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ require (
google.golang.org/api v0.31.0
google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d
google.golang.org/grpc v1.31.1
google.golang.org/protobuf v1.25.0
gopkg.in/yaml.v2 v2.3.0
gopkg.in/yaml.v3 v3.0.0-20190709130402-674ba3eaed22
k8s.io/api v0.18.7-rc.0
Expand Down
9 changes: 5 additions & 4 deletions metrics/resource_view_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import (
metricpb "google.golang.org/genproto/googleapis/api/metric"
stackdriverpb "google.golang.org/genproto/googleapis/monitoring/v3"
"google.golang.org/grpc"
proto "google.golang.org/protobuf/proto"

logtesting "knative.dev/pkg/logging/testing"
"knative.dev/pkg/metrics/metricskey"
Expand Down Expand Up @@ -438,7 +439,6 @@ testComponent_testing_value{project="p1",revision="r2"} 1
func TestStackDriverExports(t *testing.T) {
TestOverrideBundleCount = 1
t.Cleanup(func() { TestOverrideBundleCount = 0 })
sdFake := stackDriverFake{t: t}
eo := ExporterOptions{
Domain: servingDomain,
Component: "autoscaler",
Expand Down Expand Up @@ -548,6 +548,7 @@ func TestStackDriverExports(t *testing.T) {
Aggregation: view.LastValue(),
}

sdFake := stackDriverFake{t: t}
if err := initSdFake(&sdFake); err != nil {
t.Errorf("Init stackdriver failed %s", err)
}
Expand Down Expand Up @@ -628,15 +629,15 @@ type openCensusFake struct {
srv *grpc.Server
exports sync.WaitGroup
wg sync.WaitGroup
published chan ocmetrics.ExportMetricsServiceRequest
published chan *ocmetrics.ExportMetricsServiceRequest
}

func (oc *openCensusFake) start(expectedStreams int) error {
ln, err := net.Listen("tcp", oc.address)
if err != nil {
return err
}
oc.published = make(chan ocmetrics.ExportMetricsServiceRequest, 100)
oc.published = make(chan *ocmetrics.ExportMetricsServiceRequest, 100)
oc.srv = grpc.NewServer()
ocmetrics.RegisterMetricsServiceServer(oc.srv, oc)
// Run the server in the background.
Expand Down Expand Up @@ -678,7 +679,7 @@ func (oc *openCensusFake) Export(stream ocmetrics.MetricsService_ExportServer) e
if in.Resource == nil {
in.Resource = streamResource
}
oc.published <- *in
oc.published <- proto.Clone(in).(*ocmetrics.ExportMetricsServiceRequest)
if !metricSeen {
oc.exports.Done()
metricSeen = true
Expand Down
1 change: 1 addition & 0 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ google.golang.org/grpc/stats
google.golang.org/grpc/status
google.golang.org/grpc/tap
# google.golang.org/protobuf v1.25.0
## explicit
google.golang.org/protobuf/cmd/protoc-gen-go/internal_gengo
google.golang.org/protobuf/compiler/protogen
google.golang.org/protobuf/encoding/protojson
Expand Down

0 comments on commit 263b86c

Please sign in to comment.