A small application showing how to use the Featurevisor Go SDK.
Learn more about Featurevisor here.
It fetches a production datafile, creates a Featurevisor instance with customer context, then evaluates:
- the
commerce_platformfeature as a flag; - the
checkout_experiencevariation; - integer and array variables from
checkout_experience; - the
serviceEndpointsglobal object variable into a Go struct; - the
supportContactglobal string variable.
The datafile comes from the Featurevisor Cloudflare example.
- Go 1.21 or newer
- internet access for downloading the SDK and example datafile
Install the dependencies:
go mod downloadRun the application:
go run .Expected output:
Commerce platform enabled: true
Checkout variation: express
Maximum checkout items: 25
Payment methods: [card wallet]
Service endpoint: https://api.eu.example.com (timeout: 1200 ms, retries: 4)
Support contact: support-nl@example.com
The evaluations use this context:
featurevisor.Context{
"userId": "customer-123",
"country": "nl",
"locale": "nl-NL",
"accountPlan": "pro",
}Change these values to see how Featurevisor selects different rules, variations, and global variable overrides.
Learn more in the Featurevisor documentation.