Showing how to use OpenFeature in Golang API
Reference docs:
- https://openfeature.dev/docs/reference/intro
- https://openfeature.dev/docs/tutorials/getting-started/go
- Some where to run containers (Docker, docker desktop https://docs.docker.com/get-docker, Podman https://podman.io, etc)
- Golang 1.2x (https://go.dev/)
- Visual Studio Code (for debugging)
- open a terminal and go to this repo root
docker compose up
(Ctrl+c
to abort)- open a browser and go to http://localhost:7357/hello
- open file
flagd/flags.flagd.json
- change flags.welcome-message.defaultVariant to "
on
"
- change flags.welcome-message.defaultVariant to "
- refresh site on http://localhost:7357/hello
- the text should be different 😊
- open a terminal and go to this repo root
code .
- VS Code should start 😎
- in the previous terminal or a new terminal in VS Code, run
go get ./...
- new terminal, run
docker compose up flagd
(Ctrl+x
to abort) - in VS Code, go to the "Run and Debug" section (windows press
Ctrl+Shift+d
), and press▶️ the play button (orF5
) - View the "Debug Console" to see output