MCPcopy
hub / github.com/spf13/pflag / ParseSkippedFlags

Function ParseSkippedFlags

golangflag.go:152–160  ·  view source on GitHub ↗

ParseSkippedFlags explicitly Parses go test flags (i.e. the one starting with '-test.') with goflag.Parse(), since by default those are skipped by pflag.Parse(). Typical usage example: `ParseGoTestFlags(os.Args[1:], goflag.CommandLine)`

(osArgs []string, goFlagSet *goflag.FlagSet)

Source from the content-addressed store, hash-verified

150// since by default those are skipped by pflag.Parse().
151// Typical usage example: `ParseGoTestFlags(os.Args[1:], goflag.CommandLine)`
152func ParseSkippedFlags(osArgs []string, goFlagSet *goflag.FlagSet) error {
153 var skippedFlags []string
154 for _, f := range osArgs {
155 if isGotestFlag(f) {
156 skippedFlags = append(skippedFlags, f)
157 }
158 }
159 return goFlagSet.Parse(skippedFlags)
160}
161

Callers 1

TestGoflagsFunction · 0.85

Calls 2

isGotestFlagFunction · 0.85
ParseMethod · 0.65

Tested by 1

TestGoflagsFunction · 0.68