Skip to content

Why is the service config passed as a JSON-String just to get converterted to a struct anyway? #7275

Closed
@truearken

Description

@truearken

I am using the grpc retry policy for some of my services. I don't want to use a raw JSON string in my code and therefore made a struct with JSON tags which I later Marshal into the json string that I pass to the dialOption grpc.WithDefaultServiceConfig.
I looked into the code just to realize there already exists a struct for the service config which justs get's filled by the JSON string anyway?
Why is the method signature for grpc.WithDefaultServiceConfig not

func WithDefaultServiceConfig(sc *ServiceConfig) DialOption {
	return newFuncDialOption(func(o *dialOptions) {
		o.defaultServiceConfig = sc
	})
}

?
Thank you in advance.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions