Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protoc: regenerate protos #7590

Merged
merged 12 commits into from
Sep 6, 2024
Merged
Next Next commit
Fixed linter issues for superfluous-else, increment-decrement, indent…
…-error-flow, var-declaration
  • Loading branch information
janardhanvissa committed Aug 14, 2024
commit ed434dc9f561741f355f745e753ec4fc2087339f
13 changes: 7 additions & 6 deletions cmd/protoc-gen-go-grpc/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,12 @@ func clientStreamInterface(g *protogen.GeneratedFile, method *protogen.Method) s
typeParam := g.QualifiedGoIdent(method.Input.GoIdent) + ", " + g.QualifiedGoIdent(method.Output.GoIdent)
if method.Desc.IsStreamingClient() && method.Desc.IsStreamingServer() {
return g.QualifiedGoIdent(grpcPackage.Ident("BidiStreamingClient")) + "[" + typeParam + "]"
} else if method.Desc.IsStreamingClient() {
}
if method.Desc.IsStreamingClient() {
return g.QualifiedGoIdent(grpcPackage.Ident("ClientStreamingClient")) + "[" + typeParam + "]"
} else { // i.e. if method.Desc.IsStreamingServer()
return g.QualifiedGoIdent(grpcPackage.Ident("ServerStreamingClient")) + "[" + g.QualifiedGoIdent(method.Output.GoIdent) + "]"
}
return g.QualifiedGoIdent(grpcPackage.Ident("ServerStreamingClient")) + "[" + g.QualifiedGoIdent(method.Output.GoIdent) + "]"

}

func genClientMethod(gen *protogen.Plugin, file *protogen.File, g *protogen.GeneratedFile, method *protogen.Method, index int) {
Expand Down Expand Up @@ -514,11 +515,11 @@ func serverStreamInterface(g *protogen.GeneratedFile, method *protogen.Method) s
typeParam := g.QualifiedGoIdent(method.Input.GoIdent) + ", " + g.QualifiedGoIdent(method.Output.GoIdent)
if method.Desc.IsStreamingClient() && method.Desc.IsStreamingServer() {
return g.QualifiedGoIdent(grpcPackage.Ident("BidiStreamingServer")) + "[" + typeParam + "]"
} else if method.Desc.IsStreamingClient() {
}
if method.Desc.IsStreamingClient() {
return g.QualifiedGoIdent(grpcPackage.Ident("ClientStreamingServer")) + "[" + typeParam + "]"
} else { // i.e. if method.Desc.IsStreamingServer()
return g.QualifiedGoIdent(grpcPackage.Ident("ServerStreamingServer")) + "[" + g.QualifiedGoIdent(method.Output.GoIdent) + "]"
}
return g.QualifiedGoIdent(grpcPackage.Ident("ServerStreamingServer")) + "[" + g.QualifiedGoIdent(method.Output.GoIdent) + "]"
}

func genServerMethod(gen *protogen.Plugin, file *protogen.File, g *protogen.GeneratedFile, method *protogen.Method, hnameFuncNameFormatter func(string) string) string {
Expand Down
2 changes: 1 addition & 1 deletion examples/features/flow_control/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (

var addr = flag.String("addr", "localhost:50052", "the address to connect to")

var payload string = string(make([]byte, 8*1024)) // 8KB
var payload = string(make([]byte, 8*1024)) // 8KB

func main() {
flag.Parse()
Expand Down
2 changes: 1 addition & 1 deletion examples/features/flow_control/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (

var port = flag.Int("port", 50052, "port number")

var payload string = string(make([]byte, 8*1024)) // 8KB
var payload = string(make([]byte, 8*1024)) // 8KB

// server is used to implement EchoServer.
type server struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/channelz/funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var (
// outside this package except by tests.
IDGen IDGenerator

db *channelMap = newChannelMap()
db = newChannelMap()
// EntriesPerPage defines the number of channelz entries to be shown on a web page.
EntriesPerPage = 50
curState int32
Expand Down
4 changes: 2 additions & 2 deletions internal/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ var (

// GRPCResolverSchemeExtraMetadata determines when gRPC will add extra
// metadata to RPCs.
GRPCResolverSchemeExtraMetadata string = "xds"
GRPCResolverSchemeExtraMetadata = "xds"

// EnterIdleModeForTesting gets the ClientConn to enter IDLE mode.
EnterIdleModeForTesting any // func(*grpc.ClientConn)
Expand All @@ -203,7 +203,7 @@ var (

// UserSetDefaultScheme is set to true if the user has overridden the
// default resolver scheme.
UserSetDefaultScheme bool = false
UserSetDefaultScheme = false

// ShuffleAddressListForTesting pseudo-randomizes the order of addresses. n
// is the number of elements. swap swaps the elements with indexes i and j.
Expand Down
6 changes: 2 additions & 4 deletions internal/transport/http2_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1642,11 +1642,9 @@ func (t *http2Client) reader(errCh chan<- error) {
t.closeStream(s, status.Error(code, msg), true, http2.ErrCodeProtocol, status.New(code, msg), nil, false)
}
continue
} else {
// Transport error.
t.Close(connectionErrorf(true, err, "error reading from server: %v", err))
return
}
t.Close(connectionErrorf(true, err, "error reading from server: %v", err))
return
}
switch frame := frame.(type) {
case *http2.MetaHeadersFrame:
Expand Down
2 changes: 1 addition & 1 deletion internal/transport/http_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ type framer struct {
fr *http2.Framer
}

var writeBufferPoolMap map[int]*sync.Pool = make(map[int]*sync.Pool)
var writeBufferPoolMap = make(map[int]*sync.Pool)
var writeBufferMutex sync.Mutex

func newFramer(conn net.Conn, writeBufferSize, readBufferSize int, sharedWriteBuffer bool, maxHeaderListSize uint32) *framer {
Expand Down
6 changes: 3 additions & 3 deletions profiling/cmd/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ func remoteCommand() error {

if *flagEnableProfiling || *flagDisableProfiling {
return setEnabled(ctx, c, *flagEnableProfiling)
} else if *flagRetrieveSnapshot {
}
if *flagRetrieveSnapshot {
return retrieveSnapshot(ctx, c, *flagSnapshot)
} else {
return fmt.Errorf("what should I do with the remote target?")
}
return fmt.Errorf("what should I do with the remote target?")
}
4 changes: 2 additions & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func init() {
var statusOK = status.New(codes.OK, "")
var logger = grpclog.Component("core")

type methodHandler func(srv any, ctx context.Context, dec func(any) error, interceptor UnaryServerInterceptor) (any, error)
type methodHandler func(ctx context.Context, srv any, dec func(any) error, interceptor UnaryServerInterceptor) (any, error)

// MethodDesc represents an RPC service's method specification.
type MethodDesc struct {
Expand Down Expand Up @@ -1376,7 +1376,7 @@ func (s *Server) processUnaryRPC(ctx context.Context, t transport.ServerTranspor
return nil
}
ctx = NewContextWithServerTransportStream(ctx, stream)
reply, appErr := md.Handler(info.serviceImpl, ctx, df, s.opts.unaryInt)
reply, appErr := md.Handler(ctx, info.serviceImpl, df, s.opts.unaryInt)
if appErr != nil {
appStatus, ok := status.FromError(appErr)
if !ok {
Expand Down
4 changes: 2 additions & 2 deletions stats/opentelemetry/internal/testutils/testutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ func createBucketCounts(recordingPoints []float64, bounds []float64) []uint64 {
continue
}
for recordingPoints[recordingPointIndex] <= bound {
bucketCount += 1
recordingPointIndex += 1
bucketCount++
recordingPointIndex++
if recordingPointIndex >= len(recordingPoints) {
break
}
Expand Down