bucketeer-go-server-sdk

module
Version: v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2021 License: Apache-2.0

README

Bucketeer Server-side SDK for Go

  • master branch, v1.X.X tag and later: It's the official implementation.
  • v0-dev branch and v0.X.X tag: It's the unofficial implementation based on the PR. We don't recommend using these versions.

Setup

Install the prerequisite tools.

Install the dependencies.

make deps

Development

SDK

Generate mocks.

make mockgen

Format.

make fmt

Lint.

make lint

Build.

make build

Run unit tests.

make test

Run unit tests to get a coverage.

make coverage

Run e2e tests.

make e2e API_KEY=<API_KEY> HOST=<HOST> PORT=<PORT>

# e.g.
make e2e API_KEY="xxxxxxxx" HOST="api-dev.bucketeer.jp" PORT=443
Example

First, you need to move to the example directory.

cd example

Build.

make build

Start the example server.

make start TAG=<TAG> API_KEY=<API_KEY> HOST=<HOST> PORT=<PORT> \
    ENABLE_DEBUG_LOG=<ENABLE_DEBUG_LOG> FEATURE_ID=<FEATURE_ID> GOAL_ID=<GOAL_ID>

# e.g.
make start TAG="go-server" API_KEY="xxxxxxxx" HOST="api-media.bucketeer.jp" PORT="443" \
    ENABLE_DEBUG_LOG="false" FEATURE_ID="go-example-1" GOAL_ID="go-example-goal-1"

Send requests to the example server.

# variation
# e.g.
curl --cookie "user_id=user-1" http://localhost:8080/variation

# track
# e.g.
curl -X POST --cookie "user_id=user-1" http://localhost:8080/track

If you want to use published SDK instead of local one, change go.mod in the example directory,

before:

require github.com/ca-dp/bucketeer-go-server-sdk v0.0.0-00010101000000-000000000000

replace github.com/ca-dp/bucketeer-go-server-sdk => ../

after (check SDK versions here):

require github.com/ca-dp/bucketeer-go-server-sdk vX.Y.Z

then build and start the example server.

Contributing

CONTRIBUTING.md

SDK User Docs

Directories

Path Synopsis
pkg
proto
test
mock/api
Package api is a generated GoMock package.
Package api is a generated GoMock package.
mock/event
Package event is a generated GoMock package.
Package event is a generated GoMock package.
mock/log
Package log is a generated GoMock package.
Package log is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL