You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: register.go
    path of file: ./repos/kubeedge/staging/src/github.com/kubeedge/mapper-framework/pkg/grpcclient
    
    the code of the file until where you have to start completion: package grpcclient

import (
	"context"
	"fmt"
	"net"
	"time"

	"google.golang.org/grp
    
func RegisterMapper(withData bool) ([]*dmiapi.Device, []*dmiapi.DeviceModel, error) {
	cfg := config.Cfg()

	// connect grpc server
	conn, err := grpc.Dial(cfg.Common.EdgeCoreSock,
		grpc.WithInsecure(),
		grpc.WithBlock(),
		grpc.WithContextDialer(
			func(ctx context.Context, s string) (net.Conn, error) {
				unixAddress, err := net.ResolveUnixAddr("unix", cfg.Common.EdgeCoreSock)
				if err != nil {
					return nil, err
				}
				return net.DialUnix("unix", nil, unixAddress)
			},
		),
	)
	if err != nil {
		return nil, nil, fmt.Errorf("did not connect: %v", err)
	}
	defer conn.Close()

	// init Greeter client
	c := dmiapi.NewDeviceManagerServiceClient(conn)

	// init ctxï¼Œset timeout
	ctx, cancel := context.WithTimeout(context.Background(), time.Second)
	defer cancel()

	resp, err := c.MapperRegister(ctx, &dmiapi.MapperRegisterRequest{
		WithData: withData,
		Mapper: &dmiapi.MapperInfo{
			Name:       cfg.Common.Name,
			Version:    cfg.Common.Version,
			ApiVersion: cfg.Common.APIVersion,
			Protocol:   cfg.Common.Protocol,
			Address:    []byte(cfg.GrpcServer.SocketPath),
			State:      common.DEVSTOK,
		},
	})
	if err != nil {
		return nil, nil, err
	}

	return resp.DeviceList, resp.ModelList, err
}