pkgsitegolang.org/x/pkgsite/internal/experiment Index | Files

package experiment

import "golang.org/x/pkgsite/internal/experiment"

Package experiment provides functionality for experiments.

Index

Functions

func IsActive

func IsActive(ctx context.Context, experiment string) bool

IsActive reports whether an experiment is active for this set.

func NewContext

func NewContext(ctx context.Context, experimentNames ...string) context.Context

NewContext stores a set constructed from the provided experiment names in the context.

Types

type Set

type Set struct {
	// contains filtered or unexported fields
}

Set is the set of experiments that are enabled for a request.

func FromContext

func FromContext(ctx context.Context) *Set

FromContext returns the set of experiments enabled for the context.

func NewSet

func NewSet(experimentNames ...string) *Set

NewSet creates a new experiment.Set with the data provided.

func (*Set) Active

func (s *Set) Active() []string

Active returns a list of all the active experiments in s.

func (*Set) IsActive

func (s *Set) IsActive(experiment string) bool

IsActive reports whether an experiment is active for this set.

Source Files

experiment.go

Version
v0.0.0-20250218150137-224a1368cf02 (latest)
Published
Feb 18, 2025
Platform
linux/amd64
Imports
1 packages
Last checked
2 months ago

Tools for package owners.