<commit_before>package grpchelper

import (
    "google.golang.org/grpc"
    "google.golang.org/grpc/credentials"
    "google.golang.org/grpc/naming"

    balancer "github.com/servicekit/servicekit-go/balancer/consul"
    "github.com/servicekit/servicekit-go/coordinator"
)

func BalanceDial(credPath string, c coordinator.Coordinator, service string, tag string, log *logger.Logger) (*grpc.ClientConn, error) {
    creds, err := credentials.NewClientTLSFromFile(credPath, service)
    if err != nil {
        return nil, err
    }

    resolver, err := balancer.GetResolver(c, service, tag, log)
    if err != nil {
        return nil, err
    }

    conn, err := grpc.Dial(
        "",
        grpc.WithTransportCredentials(creds),
        grpc.WithBalancer(grpc.RoundRobin(resolver)))
    if err != nil {
        return nil, err
    }

    return conn, nil
}<commit_msg>added shortcut func for grpc<commit_after>package grpchelper

import (
    "google.golang.org/grpc"
    "google.golang.org/grpc/credentials"

    balancer "github.com/servicekit/servicekit-go/balancer/consul"
    "github.com/servicekit/servicekit-go/coordinator"
    "github.com/servicekit/servicekit-go/logger"
)

func BalanceDial(credPath string, c coordinator.Coordinator, service string, tag string, log *logger.Logger) (*grpc.ClientConn, error) {
    creds, err := credentials.NewClientTLSFromFile(credPath, service)
    if err != nil {
        return nil, err
    }

    resolver, err := balancer.GetResolver(c, service, tag, log)
    if err != nil {
        return nil, err
    }

    conn, err := grpc.Dial(
        "",
        grpc.WithTransportCredentials(creds),
        grpc.WithBalancer(grpc.RoundRobin(resolver)))
    if err != nil {
        return nil, err
    }

    return conn, nil
}
{'fraction_non_alphanumeric': 0.11781285231116122, 'fraction_numerical': 0.0, 'mean_word_length': 2.9977477477477477, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2596147', 'n_tokens_mistral': 590, 'n_tokens_neox': 578, 'n_words': 120}