-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
When using generated flag accessors, at least in Go, the user no longer has access to the client. This has several implications:
- There is no way for the user to evaluate a flag using a client bound to a provider other than the default provider. Of course this can still be done by creating a new client and performing the evaluations without using the generated code, but that defeats the purpose of generating the code.
- A user cannot perform the usual actions on the client, such as setting an evaluation context or calling
client.Track.
https://github.com/open-feature/cli/blob/main/internal/generators/golang/golang.tmpl
Suggestions:
- Export the names of the generated flags as constants so that users can access the flag names if they need to.
- Maybe adjust the schema by adding an optional
domainfield to each flag that specifies which domain to use to evaluate that flag. - An alternative to point 2: maybe even go as far as to have users (in the flag manifest file) specify an optional array of domains for which they want to generate flags/clients. Then generate flag accessors and a client for every domain that was listed in the flag manifest file.
- Export the generated client(s) so that users can access them if needed in order to, for example, add hooks at the client level.
kriscoleman
Metadata
Metadata
Assignees
Labels
No labels