Skip to content

Instantly share code, notes, and snippets.

type Client interface {
GetValue(ctx context.Context, name Key, defaultValue interface{}) (interface{}, error)
GetIntValue(ctx context.Context, name Key, defaultValue int) (int, error)
GetIntArrayValue(ctx context.Context, name Key, defaultValue []int) ([]int, error)
GetBoolValue(ctx context.Context, name Key, defaultValue bool) (bool, error)
GetStringValue(ctx context.Context, name Key, defaultValue string) (string, error)
}
...
showFeature, _ := ldClient.BoolVariation(flagName, lduser.User{}, defaultValue)
...
import (
"gopkg.in/launchdarkly/go-sdk-common.v2/lduser"
)
flagName := "some-flag-name"
user := lduser.NewUser("some-user-key")
defaultValue := false
showFeature, _ := ldClient.BoolVariation(flagName, user, defaultValue)
if showFeature {
// application code to show the feature
package main
import (
"bytes"
"encoding/json"
"flag"
"io/ioutil"
"log"
"net/http"
"net/http/httputil"
import (
"fmt"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
)
type K8sObject interface {
GetAnnotations() map[string]string
type Plugin struct {
ID string `json:"id"`
Label string `json:"label"`
Description string `json:"description,omitempty"`
Interfaces []string `json:"interfaces"`
APIVersion int `json:"api_version,omitempty"`
Report WeaveReport
// This is a concurrently accessed data structure
package main
import (
"fmt"
"log"
"net"
"net/http"
"os"
"os/signal"
"path/filepath"
@sidneyw
sidneyw / weave-scope-report.json
Last active April 2, 2018 17:05
A sample of the weave scope report
{
"Plugins": [
{
"id": "sample-plugin",
"label": "Sample Weave Plugin",
"description": "Adds links to deployments",
"interfaces": [
"reporter"
],
"api_version": 1