From f7e4b5159d6b82b66fdbfa82f425e4d963cefa6b Mon Sep 17 00:00:00 2001 From: Anas Sulaiman Date: Tue, 17 Dec 2024 22:40:16 +0000 Subject: [PATCH] minor fixes for google3 import --- go/cmd/bazelcredswrapper/main.go | 2 -- go/pkg/client/client_test.go | 14 ++++++++------ go/pkg/moreflag/moreflag.go | 4 ++++ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/go/cmd/bazelcredswrapper/main.go b/go/cmd/bazelcredswrapper/main.go index 786b5b6c0..e8bb3ff8f 100644 --- a/go/cmd/bazelcredswrapper/main.go +++ b/go/cmd/bazelcredswrapper/main.go @@ -20,9 +20,7 @@ var ( ) func main() { - defer log.Flush() flag.Parse() - log.Flush() var err error if *credsPath == "" { log.Errorf("No credentials helper path provided.") diff --git a/go/pkg/client/client_test.go b/go/pkg/client/client_test.go index 46bef1e28..2e0f3768a 100644 --- a/go/pkg/client/client_test.go +++ b/go/pkg/client/client_test.go @@ -10,9 +10,11 @@ import ( "testing" "github.com/bazelbuild/remote-apis-sdks/go/pkg/digest" + regrpc "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2" repb "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2" svpb "github.com/bazelbuild/remote-apis/build/bazel/semver" "github.com/google/go-cmp/cmp" + bsgrpc "google.golang.org/genproto/googleapis/bytestream" bspb "google.golang.org/genproto/googleapis/bytestream" "google.golang.org/grpc" "google.golang.org/grpc/codes" @@ -301,8 +303,8 @@ func TestRemoteHeaders(t *testing.T) { defer listener.Close() server := grpc.NewServer() fake := &fakeByteStreamForRemoteHeaders{} - bspb.RegisterByteStreamServer(server, fake) - repb.RegisterCapabilitiesServer(server, &fakeCapabilitiesForRemoteHeaders{}) + bsgrpc.RegisterByteStreamServer(server, fake) + regrpc.RegisterCapabilitiesServer(server, &fakeCapabilitiesForRemoteHeaders{}) go server.Serve(listener) defer server.Stop() @@ -332,11 +334,11 @@ func TestRemoteHeaders(t *testing.T) { } type fakeByteStreamForRemoteHeaders struct { - bspb.UnimplementedByteStreamServer + bsgrpc.UnimplementedByteStreamServer readHeaders, writeHeaders metadata.MD } -func (bs *fakeByteStreamForRemoteHeaders) Read(req *bspb.ReadRequest, stream bspb.ByteStream_ReadServer) error { +func (bs *fakeByteStreamForRemoteHeaders) Read(req *bspb.ReadRequest, stream bsgrpc.ByteStream_ReadServer) error { md, ok := metadata.FromIncomingContext(stream.Context()) if !ok { return status.Error(codes.InvalidArgument, "metadata not found") @@ -346,7 +348,7 @@ func (bs *fakeByteStreamForRemoteHeaders) Read(req *bspb.ReadRequest, stream bsp return nil } -func (bs *fakeByteStreamForRemoteHeaders) Write(stream bspb.ByteStream_WriteServer) error { +func (bs *fakeByteStreamForRemoteHeaders) Write(stream bsgrpc.ByteStream_WriteServer) error { md, ok := metadata.FromIncomingContext(stream.Context()) if !ok { return status.Error(codes.InvalidArgument, "metadata not found") @@ -364,7 +366,7 @@ func (bs *fakeByteStreamForRemoteHeaders) Write(stream bspb.ByteStream_WriteServ } type fakeCapabilitiesForRemoteHeaders struct { - repb.UnimplementedCapabilitiesServer + regrpc.UnimplementedCapabilitiesServer } func (cap *fakeCapabilitiesForRemoteHeaders) GetCapabilities(ctx context.Context, req *repb.GetCapabilitiesRequest) (*repb.ServerCapabilities, error) { diff --git a/go/pkg/moreflag/moreflag.go b/go/pkg/moreflag/moreflag.go index bad965801..b2348ce13 100644 --- a/go/pkg/moreflag/moreflag.go +++ b/go/pkg/moreflag/moreflag.go @@ -141,6 +141,10 @@ func (m *StringListMapValue) Set(s string) error { return nil } +func (m *StringListMapValue) Get() interface{} { + return map[string][]string(*m) +} + // parsePairs parses a string of the form "key1=value1,key2=value2", returning // a slice with an even number of strings like "key1", "value1", "key2", // "value2". Pairs are separated by ','; keys and values are separated by '='.