{"modulePath":"github.com/dockerstack/kubernetes","version":"v0.20.1-0.20150627061651-1c0b765df6da","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package util\n\nPackage util implements various utility functions used in both testing and implementation of Kubernetes. Package util may not depend on any other package in the Kubernetes package tree.\n\n## Constants\n\n```go\nconst CIdentifierFmt string = \"[A-Za-z_][A-Za-z0-9_]*\"\n```\n\n```go\nconst DNS1123LabelFmt string = \"[a-z0-9]([-a-z0-9]*[a-z0-9])?\"\n```\n\n```go\nconst DNS1123LabelMaxLength int = 63\n```\n\n```go\nconst DNS1123SubdomainFmt string = DNS1123LabelFmt + \"(\\\\.\" + DNS1123LabelFmt + \")*\"\n```\n\n```go\nconst DNS1123SubdomainMaxLength int = 253\n```\n\n```go\nconst DNS952LabelFmt string = \"[a-z]([-a-z0-9]*[a-z0-9])?\"\n```\n\n```go\nconst DNS952LabelMaxLength int = 24\n```\n\n```go\nconst IdentifierNoHyphensBeginEndFmt string = \"[a-z0-9]([a-z0-9-]*[a-z0-9])*\"\n```\n\n```go\nconst LabelValueFmt string = \"(\" + QualifiedNameFmt + \")?\"\n```\n\n```go\nconst LabelValueMaxLength int = 63\n```\n\n```go\nconst QualifiedNameFmt string = \"(\" + qnameCharFmt + qnameExtCharFmt + \"*)?\" + qnameCharFmt\n```\n\n```go\nconst QualifiedNameMaxLength int = 63\n```\n\n## Variables\n\n```go\nvar ErrorHandlers = []func(error){logError}\n```\nErrorHandlers is a list of functions which will be invoked when an unreturnable error occurs.\n\n```go\nvar NeverStop \u003c-chan struct{} = make(chan struct{})\n```\nNeverStop may be passed to Until to make it never stop.\n\n```go\nvar PanicHandlers = []func(interface{}){logPanic}\n```\nPanicHandlers is a list of functions which will be invoked when a panic happens.\n\n```go\nvar ReallyCrash bool\n```\nFor testing, bypass HandleCrash.\n\n## Functions\n\n```go\nfunc AddAllFlagsToPFlags()\n```\nAddAllFlagsToPFlags adds all of the top level 'flag' package flags to the top level 'pflag' flags.\n\n```go\nfunc AddFlagSetToPFlagSet(fsIn *flag.FlagSet, fsOut *pflag.FlagSet)\n```\nAddFlagSetToPFlagSet adds all of the flags in a 'flag.FlagSet' package flags to a 'pflag.FlagSet'.\n\n```go\nfunc AddPFlagSetToPFlagSet(fsFrom *pflag.FlagSet, fsTo *pflag.FlagSet)\n```\nAddPFlagSetToPFlagSet merges the flags of fsFrom into fsTo.\n\n```go\nfunc AllPtrFieldsNil(obj interface{}) bool\n```\nTests whether all pointer fields in a struct are nil.  This is useful when, for example, an API struct is handled by plugins which need to distinguish \"no plugin accepted this spec\" from \"this spec is empty\".\n\nThis function is only valid for structs and pointers to structs.  Any other type will cause a panic.  Passing a typed nil pointer will return true.\n\n```go\nfunc ApplyOomScoreAdj(pid int, value int) error\n```\nWrites 'value' to /proc/\\\u003cpid\u003e/oom\\_score\\_adj. PID = 0 means self\n\n```go\nfunc CertPoolFromFile(filename string) (*x509.CertPool, error)\n```\nCertPoolFromFile returns an x509.CertPool containing the certificates in the given PEM-encoded file. Returns an error if the file could not be read, a certificate could not be parsed, or if the file does not contain any certificates\n\n```go\nfunc CertsFromPEM(pemCerts []byte) ([]*x509.Certificate, error)\n```\nCertsFromPEM returns the x509.Certificates contained in the given PEM-encoded byte array Returns an error if a certificate could not be parsed, or if the data does not contain any certificates\n\n```go\nfunc ChooseHostInterface() (net.IP, error)\n```\nChooseHostInterface is a method used fetch an IP for a daemon. It uses data from /proc/net/route file. For a node with no internet connection ,it returns error For a multi n/w interface node it returns the IP of the interface with gateway on it.\n\n```go\nfunc CompileRegexps(regexpStrings []string) ([]*regexp.Regexp, error)\n```\nTakes a list of strings and compiles them into a list of regular expressions\n\n```go\nfunc DeepHashObject(hasher hash.Hash, objectToWrite interface{})\n```\nDeepHashObject writes specified object to hash using the spew library which follows pointers and prints actual values of the nested objects ensuring the hash does not change when a pointer changes.\n\n```go\nfunc EncodePrivateKey(private *rsa.PrivateKey) []byte\n```\n\n```go\nfunc EncodePublicKey(public *rsa.PublicKey) ([]byte, error)\n```\n\n```go\nfunc EncodeSSHKey(public *rsa.PublicKey) ([]byte, error)\n```\n\n```go\nfunc EscapeQualifiedNameForDisk(in string) string\n```\nEscapeQualifiedNameForDisk converts a plugin name, which might contain a / into a string that is safe to use on-disk.  This assumes that the input has already been validates as a qualified name.  we use \"~\" rather than \":\" here in case we ever use a filesystem that doesn't allow \":\".\n\n```go\nfunc ExecuteTemplate(w io.Writer, templateText string, data interface{}) error\n```\nExecuteTemplate executes templateText with data and output written to w.\n\n```go\nfunc ExecuteTemplateToString(templateText string, data interface{}) (string, error)\n```\n\n```go\nfunc FileExists(filename string) (bool, error)\n```\n\n```go\nfunc FlushLogs()\n```\nFlushLogs flushes logs immediately.\n\n```go\nfunc Forever(f func(), period time.Duration)\n```\nForever loops forever running f every period.  Catches any panics, and keeps going. Deprecated. Please use Until and pass NeverStop as the stopCh.\n\n```go\nfunc GenerateKey(bits int) (*rsa.PrivateKey, *rsa.PublicKey, error)\n```\n\n```go\nfunc GenerateSelfSignedCert(host, certPath, keyPath string) error\n```\nGenerateSelfSignedCert creates a self-signed certificate and key for the given host. Host may be an IP or a DNS name The certificate will be created with file mode 0644. The key will be created with file mode 0600. If the certificate or key files already exist, they will be overwritten. Any parent directories of the certPath or keyPath will be created as needed with file mode 0755.\n\n```go\nfunc GetClient(req *http.Request) string\n```\n\n```go\nfunc HandleCrash()\n```\nHandleCrash simply catches a crash and logs an error. Meant to be called via defer.\n\n```go\nfunc HandleError(err error)\n```\nHandlerError is a method to invoke when a non-user facing piece of code cannot return an error and needs to indicate it has been ignored. Invoking this method is preferable to logging the error - the default behavior is to log but the errors may be sent to a remote server for analysis.\n\n```go\nfunc InitFlags()\n```\nInitFlags normalizes and parses the command line flags\n\n```go\nfunc InitLogs()\n```\nInitLogs initializes logs the way we want for kubernetes.\n\n```go\nfunc IsCIdentifier(value string) bool\n```\nIsCIdentifier tests for a string that conforms the definition of an identifier in C. This checks the format, but not the length.\n\n```go\nfunc IsDNS1123Label(value string) bool\n```\nIsDNS1123Label tests for a string that conforms to the definition of a label in DNS (RFC 1123).\n\n```go\nfunc IsDNS1123Subdomain(value string) bool\n```\nIsDNS1123Subdomain tests for a string that conforms to the definition of a subdomain in DNS (RFC 1123).\n\n```go\nfunc IsDNS952Label(value string) bool\n```\nIsDNS952Label tests for a string that conforms to the definition of a label in DNS (RFC 952).\n\n```go\nfunc IsProbableEOF(err error) bool\n```\nIsProbableEOF returns true if the given error resembles a connection termination scenario that would justify assuming that the watch is empty. These errors are what the Go http stack returns back to us which are general connection closure errors (strongly correlated) and callers that need to differentiate probable errors in connection behavior between normal \"this is disconnected\" should use the method.\n\n```go\nfunc IsQualifiedName(value string) bool\n```\n\n```go\nfunc IsValidIPv4(value string) bool\n```\nIsValidIPv4 tests that the argument is a valid IPv4 address.\n\n```go\nfunc IsValidLabelValue(value string) bool\n```\n\n```go\nfunc IsValidPortName(port string) bool\n```\nIsValidPortName check that the argument is valid syntax. It must be non empty and no more than 15 characters long It must contains at least one letter \\[a-z] and it must contains only \\[a-z0-9-]. Hypens ('-') cannot be leading or trailing character of the string and cannot be adjacent to other hyphens. Although RFC 6335 allows upper and lower case characters but case is ignored for comparison purposes: (HTTP and http denote the same service).\n\n```go\nfunc IsValidPortNum(port int) bool\n```\nIsValidPortNum tests that the argument is a valid, non-zero port number.\n\n```go\nfunc JoinQualifiedName(namespace, name string) string\n```\nJoins 'namespace' and 'name' and returns a fully qualified name Assumes that the input is valid.\n\n```go\nfunc MakePrivateKeySignerFromBytes(buffer []byte) (ssh.Signer, error)\n```\n\n```go\nfunc MakePrivateKeySignerFromFile(key string) (ssh.Signer, error)\n```\n\n```go\nfunc NewLogger(prefix string) *log.Logger\n```\nNewLogger creates a new log.Logger which sends logs to glog.Info.\n\n```go\nfunc NewUUID() types.UID\n```\n\\*\n\n  - The UUID package is naive and can generate identical UUIDs if the time interval is quick enough.\n  - Block subsequent UUIDs for 200 Nanoseconds, the UUID uses 100 ns increments, we block for 200 to be safe\n  - Blocks in a go routine, so that the caller doesn't have to wait.\n  - TODO: save old unused UUIDs so that no one has to block.\n\n```go\nfunc ObjectDiff(a, b interface{}) string\n```\nObjectDiff writes the two objects out as JSON and prints out the identical part of the objects followed by the remaining part of 'a' and finally the remaining part of 'b'. For debugging tests.\n\n```go\nfunc ObjectGoPrintDiff(a, b interface{}) string\n```\nObjectGoPrintDiff is like ObjectDiff, but uses go-spew to print the objects, which shows absolutely everything by recursing into every single pointer (go's %#v formatters OTOH stop at a certain point). This is needed when you can't figure out why reflect.DeepEqual is returning false and nothing is showing you differences. This will.\n\n```go\nfunc ObjectGoPrintSideBySide(a, b interface{}) string\n```\nObjectGoPrintSideBySide prints a and b as textual dumps side by side, enabling easy visual scanning for mismatches.\n\n```go\nfunc ParsePublicKeyFromFile(keyFile string) (*rsa.PublicKey, error)\n```\n\n```go\nfunc RunInResourceContainer(containerName string) error\n```\nCreates resource-only containerName if it does not already exist and moves the current process to it.\n\ncontainerName must be an absolute container name.\n\n```go\nfunc RunSSHCommand(cmd, user, host string, signer ssh.Signer) (string, string, int, error)\n```\nRunSSHCommand returns the stdout, stderr, and exit code from running cmd on host as specific user, along with any SSH-level error. If user==\"\", it will default (like SSH) to os.Getenv(\"USER\")\n\n```go\nfunc ShortenString(str string, n int) string\n```\n\n```go\nfunc SplitPort(id string) (name, port string, valid bool)\n```\nTakes a string of the form \"name:port\" or \"name\".\n\n  - If id is of the form \"name\" or \"name:\", then return (name, \"\", true)\n  - If id is of the form \"name:port\", then return (name, port, true)\n  - Otherwise, return (\"\", \"\", false)\n\nAdditionally, name must be non-empty or valid will be returned false.\n\nPort is returned as a string, and it is not required to be numeric (could be used for a named port, for example).\n\n```go\nfunc SplitQualifiedName(str string) (string, string)\n```\nSplits a fully qualified name and returns its namespace and name. Assumes that the input 'str' has been validated.\n\n```go\nfunc StringDiff(a, b string) string\n```\nStringDiff diffs a and b and returns a human readable diff.\n\n```go\nfunc UnescapeQualifiedNameForDisk(in string) string\n```\nUnescapeQualifiedNameForDisk converts an escaped plugin name (as per EscapeQualifiedNameForDisk) back to its normal form.  This assumes that the input has already been validates as a qualified name.\n\n```go\nfunc Until(f func(), period time.Duration, stopCh \u003c-chan struct{})\n```\nUntil loops until stop channel is closed, running f every period. Catches any panics, and keeps going. f may not be invoked if stop channel is already closed.\n\n```go\nfunc UsingSystemdInitSystem() bool\n```\nDetects if using systemd as the init system Please note that simply reading /proc/1/cmdline can be misleading because some installation of various init programs can automatically make /sbin/init a symlink or even a renamed version of their main program. TODO(dchen1107): realiably detects the init system using on the system: systemd, upstart, initd, etc.\n\n```go\nfunc WarnWordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName\n```\nWarnWordSepNormalizeFunc changes and warns for flags that contain \"\\_\" separators\n\n```go\nfunc WordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName\n```\nWordSepNormalizeFunc changes all flags that contain \"\\_\" separators\n\n## Types\n\n```go\ntype AtomicValue struct {\n\t// contains filtered or unexported fields\n}\n```\nTODO(ArtfulCoder) sync/atomic/Value was added in golang 1.4 Once support is dropped for go 1.3, this type must be deprecated in favor of sync/atomic/Value. The functions are named Load/Store to match sync/atomic/Value function names.\n\n```go\nfunc (at *AtomicValue) Load() interface{}\n```\n\n```go\nfunc (at *AtomicValue) Store(val interface{})\n```\n\n```go\ntype BoolFlag struct {\n\t// contains filtered or unexported fields\n}\n```\nBoolFlag is a boolean flag compatible with flags and pflags that keeps track of whether it had a value supplied or not. Beware!  If you use this type, you must actually specify --flag-name=true, you cannot leave it as --flag-name and still have the value set\n\n```go\nfunc (f *BoolFlag) Default(value bool)\n```\n\n```go\nfunc (f BoolFlag) Provided() bool\n```\n\n```go\nfunc (f *BoolFlag) Set(value string) error\n```\n\n```go\nfunc (f BoolFlag) String() string\n```\n\n```go\nfunc (f *BoolFlag) Type() string\n```\n\n```go\nfunc (f BoolFlag) Value() bool\n```\n\n```go\ntype Cache []*cacheShard\n```\n\n```go\nfunc NewCache(maxSize int) Cache\n```\n\n```go\nfunc (c *Cache) Add(index uint64, obj interface{}) bool\n```\nReturns true if object already existed, false otherwise.\n\n```go\nfunc (c *Cache) Get(index uint64) (obj interface{}, found bool)\n```\n\n```go\ntype Clock interface {\n\tNow() time.Time\n\tSince(time.Time) time.Duration\n}\n```\nClock allows for injecting fake or real clocks into code that needs to do arbitrary things based on time.\n\n```go\ntype ConfigurationMap map[string]string\n```\n\n```go\nfunc (m *ConfigurationMap) Set(value string) error\n```\n\n```go\nfunc (m *ConfigurationMap) String() string\n```\n\n```go\nfunc (*ConfigurationMap) Type() string\n```\n\n```go\ntype FakeClock struct {\n\tTime time.Time\n}\n```\nFakeClock implements Clock, but returns an arbitrary time.\n\n```go\nfunc (f *FakeClock) Now() time.Time\n```\nNow returns f's time.\n\n```go\nfunc (f *FakeClock) Since(ts time.Time) time.Duration\n```\nSince returns time since the time in f.\n\n```go\ntype FakeHandler struct {\n\tRequestReceived *http.Request\n\tRequestBody     string\n\tStatusCode      int\n\tResponseBody    string\n\t// For logging - you can use a *testing.T\n\t// This will keep log messages associated with the test.\n\tT LogInterface\n\t// contains filtered or unexported fields\n}\n```\nFakeHandler is to assist in testing HTTP requests. Notice that FakeHandler is not thread safe and you must not direct traffic to except for the request you want to test. You can do this by hiding it in an http.ServeMux.\n\n```go\nfunc (f *FakeHandler) ServeHTTP(response http.ResponseWriter, request *http.Request)\n```\n\n```go\nfunc (f *FakeHandler) ValidateRequest(t TestInterface, expectedPath, expectedMethod string, body *string)\n```\nValidateRequest verifies that FakeHandler received a request with expected path, method, and body.\n\n```go\nfunc (f *FakeHandler) ValidateRequestCount(t TestInterface, count int) bool\n```\n\n```go\ntype GlogWriter struct{}\n```\nGlogWriter serves as a bridge between the standard log package and the glog package.\n\n```go\nfunc (writer GlogWriter) Write(data []byte) (n int, err error)\n```\nWrite implements the io.Writer interface.\n\n```go\ntype IP net.IP\n```\nIP adapts net.IP for use as a flag.\n\n```go\nfunc (ip *IP) Set(value string) error\n```\n\n```go\nfunc (ip IP) String() string\n```\n\n```go\nfunc (*IP) Type() string\n```\n\n```go\ntype IPNet net.IPNet\n```\nIPNet adapts net.IPNet for use as a flag.\n\n```go\nfunc (ipnet *IPNet) Set(value string) error\n```\n\n```go\nfunc (ipnet IPNet) String() string\n```\n\n```go\nfunc (*IPNet) Type() string\n```\n\n```go\ntype IntOrString struct {\n\tKind   IntstrKind\n\tIntVal int\n\tStrVal string\n}\n```\nIntOrString is a type that can hold an int or a string.  When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type.  This allows you to have, for example, a JSON field that can accept a name or number.\n\n```go\nfunc NewIntOrStringFromInt(val int) IntOrString\n```\nNewIntOrStringFromInt creates an IntOrString object with an int value.\n\n```go\nfunc NewIntOrStringFromString(val string) IntOrString\n```\nNewIntOrStringFromString creates an IntOrString object with a string value.\n\n```go\nfunc (intstr *IntOrString) Fuzz(c fuzz.Continue)\n```\n\n```go\nfunc (intstr IntOrString) MarshalJSON() ([]byte, error)\n```\nMarshalJSON implements the json.Marshaller interface.\n\n```go\nfunc (intstr *IntOrString) String() string\n```\nString returns the string value, or Itoa's the int value.\n\n```go\nfunc (intstr *IntOrString) UnmarshalJSON(value []byte) error\n```\nUnmarshalJSON implements the json.Unmarshaller interface.\n\n```go\ntype IntstrKind int\n```\nIntstrKind represents the stored type of IntOrString.\n\n```go\nconst (\n\tIntstrInt    IntstrKind = iota // The IntOrString holds an int.\n\tIntstrString                   // The IntOrString holds a string.\n)\n```\n\n```go\ntype LogInterface interface {\n\tLogf(format string, args ...interface{})\n}\n```\nLogInterface is a simple interface to allow injection of Logf to report serving errors.\n\n```go\ntype PortRange struct {\n\tBase int\n\tSize int\n}\n```\nPortRange represents a range of TCP/UDP ports.  To represent a single port, set Size to 1.\n\n```go\nfunc ParsePortRange(value string) (*PortRange, error)\n```\nParsePortRange parses a string of the form \"min-max\", inclusive at both ends, and initializs a new PortRange from it.\n\n```go\nfunc (pr *PortRange) Contains(p int) bool\n```\nContains tests whether a given port falls within the PortRange.\n\n```go\nfunc (pr *PortRange) Set(value string) error\n```\nSet parses a string of the form \"min-max\", inclusive at both ends, and sets the PortRange from it.  This is part of the flag.Value and pflag.Value interfaces.\n\n```go\nfunc (pr PortRange) String() string\n```\nString converts the PortRange to a string representation, which can be parsed by PortRange.Set or ParsePortRange.\n\n```go\nfunc (*PortRange) Type() string\n```\nType returns a descriptive string about this type.  This is part of the pflag.Value interface.\n\n```go\ntype RateLimiter interface {\n\t// CanAccept returns true if the rate is below the limit, false otherwise\n\tCanAccept() bool\n\t// Accept returns once a token becomes available.\n\tAccept()\n\t// Stop stops the rate limiter, subsequent calls to CanAccept will return false\n\tStop()\n}\n```\n\n```go\nfunc NewFakeRateLimiter() RateLimiter\n```\n\n```go\nfunc NewTokenBucketRateLimiter(qps float32, burst int) RateLimiter\n```\nNewTokenBucketRateLimiter creates a rate limiter which implements a token bucket approach. The rate limiter allows bursts of up to 'burst' to exceed the QPS, while still maintaining a smoothed qps rate of 'qps'. The bucket is initially filled with 'burst' tokens, the rate limiter spawns a go routine which refills the bucket with one token at a rate of 'qps'.  The maximum number of tokens in the bucket is capped at 'burst'. When done with the limiter, Stop() must be called to halt the associated goroutine.\n\n```go\ntype RealClock struct{}\n```\nRealClock really calls time.Now()\n\n```go\nfunc (r RealClock) Now() time.Time\n```\nNow returns the current time.\n\n```go\nfunc (r RealClock) Since(ts time.Time) time.Duration\n```\nSince returns time since the specified timestamp.\n\n```go\ntype Route struct {\n\tInterface   string\n\tDestination net.IP\n\tGateway     net.IP\n}\n```\n\n```go\ntype Runner struct {\n\t// contains filtered or unexported fields\n}\n```\nRunner is an abstraction to make it easy to start and stop groups of things that can be described by a single function which waits on a channel close to exit.\n\n```go\nfunc NewRunner(f ...func(stop chan struct{})) *Runner\n```\nNewRunner makes a runner for the given function(s). The function(s) should loop until the channel is closed.\n\n```go\nfunc (r *Runner) Start()\n```\nStart begins running.\n\n```go\nfunc (r *Runner) Stop()\n```\nStop stops running.\n\n```go\ntype SSHTunnel struct {\n\tConfig  *ssh.ClientConfig\n\tHost    string\n\tSSHPort string\n\t// contains filtered or unexported fields\n}\n```\nTODO: Unit tests for this code, we can spin up a test SSH server with instructions here: [https://godoc.org/golang.org/x/crypto/ssh#ServerConn](https://godoc.org/golang.org/x/crypto/ssh#ServerConn)\n\n```go\nfunc NewSSHTunnel(user, keyfile, host string) (*SSHTunnel, error)\n```\n\n```go\nfunc NewSSHTunnelFromBytes(user string, privateKey []byte, host string) (*SSHTunnel, error)\n```\n\n```go\nfunc (s *SSHTunnel) Close() error\n```\n\n```go\nfunc (s *SSHTunnel) Dial(network, address string) (net.Conn, error)\n```\n\n```go\nfunc (s *SSHTunnel) Open() error\n```\n\n```go\ntype SSHTunnelEntry struct {\n\tAddress string\n\tTunnel  *SSHTunnel\n}\n```\nShould be thread safe.\n\n```go\ntype SSHTunnelList struct {\n\t// contains filtered or unexported fields\n}\n```\nNot thread safe!\n\n```go\nfunc MakeSSHTunnels(user, keyfile string, addresses []string) *SSHTunnelList\n```\n\n```go\nfunc (l *SSHTunnelList) Close()\n```\nClose asynchronously closes all tunnels in the list after waiting for 1 minute. Tunnels will still be open upon this function's return, but should no longer be used.\n\n```go\nfunc (l *SSHTunnelList) Has(addr string) bool\n```\n\n```go\nfunc (l *SSHTunnelList) Len() int\n```\n\n```go\nfunc (l *SSHTunnelList) Open() error\n```\nOpen attempts to open all tunnels in the list, and removes any tunnels that failed to open.\n\n```go\nfunc (l *SSHTunnelList) PickRandomTunnel() (SSHTunnelEntry, error)\n```\nReturns a random tunnel, xor an error if there are none.\n\n```go\ntype StringFlag struct {\n\t// contains filtered or unexported fields\n}\n```\nStringFlag is a string flag compatible with flags and pflags that keeps track of whether it had a value supplied or not.\n\n```go\nfunc NewStringFlag(defaultVal string) StringFlag\n```\n\n```go\nfunc (f *StringFlag) Default(value string)\n```\n\n```go\nfunc (f StringFlag) Provided() bool\n```\n\n```go\nfunc (f *StringFlag) Set(value string) error\n```\n\n```go\nfunc (f StringFlag) String() string\n```\n\n```go\nfunc (f *StringFlag) Type() string\n```\n\n```go\nfunc (f StringFlag) Value() string\n```\n\n```go\ntype StringList []string\n```\n\n```go\nfunc (sl *StringList) Set(value string) error\n```\n\n```go\nfunc (sl *StringList) String() string\n```\n\n```go\nfunc (*StringList) Type() string\n```\n\n```go\ntype StringSet map[string]empty\n```\nStringSet is a set of strings, implemented via map\\[string]struct{} for minimal memory consumption.\n\n```go\nfunc KeySet(theMap reflect.Value) StringSet\n```\nKeySet creates a StringSet from a keys of a map\\[string](? extends interface{}).  Since you can't describe that map type in the Go type system the reflected value is required.\n\n```go\nfunc NewStringSet(items ...string) StringSet\n```\nNewStringSet creates a StringSet from a list of values.\n\n```go\nfunc (s StringSet) Delete(items ...string)\n```\nDelete removes all items from the set.\n\n```go\nfunc (s StringSet) Difference(s2 StringSet) StringSet\n```\nDifference returns a set of objects that are not in s2 For example: s1 = {1, 2, 3} s2 = {1, 2, 4, 5} s1.Difference(s2) = {3} s2.Difference(s1) = {4, 5}\n\n```go\nfunc (s StringSet) Has(item string) bool\n```\nHas returns true iff item is contained in the set.\n\n```go\nfunc (s StringSet) HasAll(items ...string) bool\n```\nHasAll returns true iff all items are contained in the set.\n\n```go\nfunc (s StringSet) HasAny(items ...string) bool\n```\nHasAny returns true if any items are contained in the set.\n\n```go\nfunc (s StringSet) Insert(items ...string)\n```\nInsert adds items to the set.\n\n```go\nfunc (s1 StringSet) IsSuperset(s2 StringSet) bool\n```\nIsSuperset returns true iff s1 is a superset of s2.\n\n```go\nfunc (s StringSet) Len() int\n```\nLen returns the size of the set.\n\n```go\nfunc (s StringSet) List() []string\n```\nList returns the contents as a sorted string slice.\n\n```go\nfunc (s StringSet) PopAny() (string, bool)\n```\nReturns a single element from the set.\n\n```go\nfunc (s1 StringSet) Union(s2 StringSet) StringSet\n```\nUnion returns a new set which includes items in either s1 or s2. vof objects that are not in s2 For example: s1 = {1, 2} s2 = {3, 4} s1.Union(s2) = {1, 2, 3, 4} s2.Union(s1) = {1, 2, 3, 4}\n\n```go\ntype TestInterface interface {\n\tErrorf(format string, args ...interface{})\n\tLogf(format string, args ...interface{})\n}\n```\nTestInterface is a simple interface providing Errorf, to make injection for testing easier (insert 'yo dawg' meme here).\n\n```go\ntype Time struct {\n\ttime.Time\n}\n```\nTime is a wrapper around time.Time which supports correct marshaling to YAML and JSON.  Wrappers are provided for many of the factory methods that the time package offers.\n\n```go\nfunc Date(year int, month time.Month, day, hour, min, sec, nsec int, loc *time.Location) Time\n```\nDate returns the Time corresponding to the supplied parameters by wrapping time.Date.\n\n```go\nfunc NewTime(time time.Time) Time\n```\nNewTime returns a wrapped instance of the provided time\n\n```go\nfunc Now() Time\n```\nNow returns the current local time.\n\n```go\nfunc Unix(sec int64, nsec int64) Time\n```\nUnix returns the local time corresponding to the given Unix time by wrapping time.Unix.\n\n```go\nfunc (t Time) Before(u Time) bool\n```\nBefore reports whether the time instant t is before u.\n\n```go\nfunc (t *Time) Fuzz(c fuzz.Continue)\n```\nFuzz satisfies fuzz.Interface.\n\n```go\nfunc (t *Time) IsZero() bool\n```\nIsZero returns true if the value is nil or time is zero.\n\n```go\nfunc (t Time) MarshalJSON() ([]byte, error)\n```\nMarshalJSON implements the json.Marshaler interface.\n\n```go\nfunc (t Time) Rfc3339Copy() Time\n```\nRfc3339Copy returns a copy of the Time at second-level precision.\n\n```go\nfunc (t *Time) UnmarshalJSON(b []byte) error\n```\nUnmarshalJSON implements the json.Unmarshaller interface.\n\n```go\ntype Trace struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewTrace(name string) *Trace\n```\n\n```go\nfunc (t *Trace) Log()\n```\n\n```go\nfunc (t *Trace) LogIfLong(threshold time.Duration)\n```\n\n```go\nfunc (t *Trace) Step(msg string)\n```\n\n```go\nfunc (t *Trace) TotalTime() time.Duration\n```\n\n","path":"github.com/dockerstack/kubernetes/pkg/util","name":"util","synopsis":"Package util implements various utility functions used in both testing and implementation of Kubernetes.","isRedistributable":true}
