Fix golint errors for non-generated code
This commit is contained in:
Родитель
5a3d0652b6
Коммит
5700d19d0e
|
@ -137,7 +137,7 @@ func (s *testServer) FullDuplexCall(stream testpb.TestService_FullDuplexCallServ
|
|||
}
|
||||
|
||||
func (s *testServer) HalfDuplexCall(stream testpb.TestService_HalfDuplexCallServer) error {
|
||||
msgBuf := make([]*testpb.StreamingOutputCallRequest, 0)
|
||||
var msgBuf []*testpb.StreamingOutputCallRequest
|
||||
for {
|
||||
in, err := stream.Recv()
|
||||
if err == io.EOF {
|
||||
|
|
|
@ -6,8 +6,8 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
// Used for testing.
|
||||
TimeNow func() time.Time = time.Now
|
||||
// TimeNow is used for testing.
|
||||
TimeNow = time.Now
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -202,6 +202,7 @@ type TokenSource struct {
|
|||
oauth2.TokenSource
|
||||
}
|
||||
|
||||
// GetRequestMetadata gets the request metadata as a map from a TokenSource.
|
||||
func (ts TokenSource) GetRequestMetadata(ctx context.Context) (map[string]string, error) {
|
||||
token, err := ts.Token()
|
||||
if err != nil {
|
||||
|
|
|
@ -47,8 +47,8 @@ import (
|
|||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/credentials"
|
||||
"google.golang.org/grpc/metadata"
|
||||
testpb "google.golang.org/grpc/interop/grpc_testing"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -268,7 +268,7 @@ func doComputeEngineCreds(tc testpb.TestServiceClient) {
|
|||
log.Println("ComputeEngineCreds done")
|
||||
}
|
||||
|
||||
func getServiceAccountJsonKey() []byte {
|
||||
func getServiceAccountJSONKey() []byte {
|
||||
jsonKey, err := ioutil.ReadFile(*serviceAccountKeyFile)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to read the service account key file: %v", err)
|
||||
|
@ -289,7 +289,7 @@ func doServiceAccountCreds(tc testpb.TestServiceClient) {
|
|||
if err != nil {
|
||||
log.Fatal("/TestService/UnaryCall RPC failed: ", err)
|
||||
}
|
||||
jsonKey := getServiceAccountJsonKey()
|
||||
jsonKey := getServiceAccountJSONKey()
|
||||
user := reply.GetUsername()
|
||||
scope := reply.GetOauthScope()
|
||||
if !strings.Contains(string(jsonKey), user) {
|
||||
|
|
|
@ -156,7 +156,7 @@ func (s *testServer) FullDuplexCall(stream testpb.TestService_FullDuplexCallServ
|
|||
}
|
||||
|
||||
func (s *testServer) HalfDuplexCall(stream testpb.TestService_HalfDuplexCallServer) error {
|
||||
msgBuf := make([]*testpb.StreamingOutputCallRequest, 0)
|
||||
var msgBuf []*testpb.StreamingOutputCallRequest
|
||||
for {
|
||||
in, err := stream.Recv()
|
||||
if err == io.EOF {
|
||||
|
|
|
@ -438,7 +438,7 @@ func TestServerWithMisbehavedClient(t *testing.T) {
|
|||
time.Sleep(time.Millisecond)
|
||||
continue
|
||||
}
|
||||
for k, _ := range server.conns {
|
||||
for k := range server.conns {
|
||||
var ok bool
|
||||
sc, ok = k.(*http2Server)
|
||||
if !ok {
|
||||
|
@ -493,7 +493,7 @@ func TestServerWithMisbehavedClient(t *testing.T) {
|
|||
t.Fatalf("Failed to write data: %v", err)
|
||||
}
|
||||
cc.writableChan <- 0
|
||||
sent += 1
|
||||
sent++
|
||||
}
|
||||
// Server sent a resetStream for s already.
|
||||
code := http2RSTErrConvTab[http2.ErrCodeFlowControl]
|
||||
|
|
Загрузка…
Ссылка в новой задаче