Unleash / unleash-client-go

Unleash client SDK for Go
https://docs.getunleash.io
Apache License 2.0
138 stars 55 forks source link

Why is not options passed when calling GetVariant? #92

Closed erichall closed 3 years ago

erichall commented 3 years ago

Hi

I've encountered an issue when trying to use variants.

When calling GetVariant I do it like this:

 unleash.GetVariant("feature-name", ucontext.Context{
        UserId: "user-id"
        Properties: map[string]string{
            "foo": "bar",
        },
    })

So then, inside the unleash sdk, client.go, this line is executed

func (uc *Client) GetVariant(feature string, options ...VariantOption) *api.Variant {
    defaultVariant := api.GetDefaultVariant()

    if !uc.isEnabled(feature) {
        return defaultVariant;
    }

When calling uc.isEnabled(feature) no options are passed. This causes my own defined Properties foo be lost and ultimately I only get the disabled variant back.

My question: Why are not the options passed to isEnabled?

Version of Unleash: github.com/Unleash/unleash-client-go/v3 v3.2.3

ivarconr commented 3 years ago

It looks like bug.

/cc @FredrikOseberg