open-feature / open-feature/go-sdk

[FEATURE] Generics for v2 release of go-sdk

Open
#158 2 comments 10 reactions 0 assignees View on GitHub
contribfest enhancement Needs Triage v2
Dominant language
Go
Stars
250
Forks
62
Avg merge
2d 3h
Merged PRs (30d)
25

Description

### Requirements

Now the go-sdk has been upgraded to go 1.18 it can make use of generics.

The obvious candidates where leveraging generics would reduce bloat:

- [Evaluation types](https://github.com/open-feature/go-sdk/blob/main/pkg/openfeature/client.go#L137) are effectively the same structure with different `Value` types
- [Resolution types](https://github.com/open-feature/go-sdk/blob/main/pkg/openfeature/provider.go#L76), as above, are effectively the same structure with different `Value` types

Pros:
- Less types to maintain
- Less duplicated code
- Less type inference
- Less chance of accidental inconsistent behaviour across types

Cons:
- Breaking change
- Breaks contract between providers and sdk

Perhaps this undertaking isn't worth the effort but it's at least worth raising.

Contributor guide

Open the contributing guide

Research direction

Start by reading the evaluation types in pkg/openfeature/client.go around line 137 and the resolution types in pkg/openfeature/provider.go around line 76. Determine whether replacing these duplicated value-specific types with generics is appropriate for the v2 release, including the provider-to-SDK contract. The issue does not define further acceptance criteria.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.