Fix vet issues (#3396)

* internal/wrr: fix copying lock

* internal/transport: don't use unkeyed fields

* xds/internal/balancer/edsbalancer: don't use unkeyed fields

* profiling/cmd: don't discard cancel
This commit is contained in:
Egon Elbre
2020-02-25 20:56:49 +02:00
committed by GitHub
parent a43f3ee96c
commit b1a5073a2c
4 changed files with 7 additions and 5 deletions

View File

@ -338,7 +338,7 @@ func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream), trace
Addr: ht.RemoteAddr(),
}
if req.TLS != nil {
pr.AuthInfo = credentials.TLSInfo{State: *req.TLS, CommonAuthInfo: credentials.CommonAuthInfo{credentials.PrivacyAndIntegrity}}
pr.AuthInfo = credentials.TLSInfo{State: *req.TLS, CommonAuthInfo: credentials.CommonAuthInfo{SecurityLevel: credentials.PrivacyAndIntegrity}}
}
ctx = metadata.NewIncomingContext(ctx, ht.headerMD)
s.ctx = peer.NewContext(ctx, pr)

View File

@ -61,7 +61,7 @@ func (pq *edfPriorityQueue) Pop() interface{} {
}
// Current time in EDF scheduler.
func (edf edfWrr) currentTime() float64 {
func (edf *edfWrr) currentTime() float64 {
if len(edf.items) == 0 {
return 0.0
}

View File

@ -73,7 +73,9 @@ func retrieveSnapshot(ctx context.Context, c ppb.ProfilingClient, f string) erro
func remoteCommand() error {
ctx := context.Background()
if *flagTimeout > 0 {
ctx, _ = context.WithTimeout(context.Background(), time.Duration(*flagTimeout)*time.Second)
var cancel func()
ctx, cancel = context.WithTimeout(context.Background(), time.Duration(*flagTimeout)*time.Second)
defer cancel()
}
grpclog.Infof("dialing %s", *flagAddress)

View File

@ -557,9 +557,9 @@ func buildPickerAndState(m map[internal.Locality]*pickerState) balancer.State {
aggregatedState = connectivity.TransientFailure
}
if aggregatedState == connectivity.TransientFailure {
return balancer.State{aggregatedState, base.NewErrPickerV2(balancer.ErrTransientFailure)}
return balancer.State{ConnectivityState: aggregatedState, Picker: base.NewErrPickerV2(balancer.ErrTransientFailure)}
}
return balancer.State{aggregatedState, newPickerGroup(readyPickerWithWeights)}
return balancer.State{ConnectivityState: aggregatedState, Picker: newPickerGroup(readyPickerWithWeights)}
}
// RandomWRR constructor, to be modified in tests.