Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

os.Args should remove test flag value also. #25

Open
ijajmulani opened this issue Jan 26, 2022 · 0 comments
Open

os.Args should remove test flag value also. #25

ijajmulani opened this issue Jan 26, 2022 · 0 comments

Comments

@ijajmulani
Copy link

ijajmulani commented Jan 26, 2022

for _, arg := range os.Args {
if !strings.HasPrefix(arg, "-test.") && !strings.HasPrefix(arg, "-args-file") {
parsedArgs = append(parsedArgs, arg)
}
}
if len(*argsFilename) > 0 {
customArgs, err := parseCustomArgs()
if err != nil {
panic(err)
}
parsedArgs = append(parsedArgs, customArgs...)
}
os.Args = parsedArgs

Above code should remove test.* args value from os.Args.

e.g. if I run binary with below command
./mybinary.test -test.cpuprofile b.cov customargs

in the end OS.Args contains b.cov and customargs. Since b.cov is value -test.* argument it should not include in the end.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant