MCPcopy
hub / github.com/grpc/grpc-go / StringWithAllowedValues

Function StringWithAllowedValues

benchmark/flags/flags.go:45–49  ·  view source on GitHub ↗

StringWithAllowedValues returns a flag variable of type stringFlagWithAllowedValues configured with the provided parameters. 'allowed` is the set of values that this flag can be set to.

(name, defaultVal, usage string, allowed []string)

Source from the content-addressed store, hash-verified

43// stringFlagWithAllowedValues configured with the provided parameters.
44// 'allowed` is the set of values that this flag can be set to.
45func StringWithAllowedValues(name, defaultVal, usage string, allowed []string) *string {
46 as := &stringFlagWithAllowedValues{defaultVal, allowed}
47 flag.CommandLine.Var(as, name, usage)
48 return &as.val
49}
50
51// String implements the flag.Value interface.
52func (as *stringFlagWithAllowedValues) String() string {

Callers 2

main.goFile · 0.92

Calls

no outgoing calls

Tested by 1