mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-17 07:39:22 +00:00
Merge pull request #82742 from whypro/flagparse
Move flag.Parse() from init() to TestMain()
This commit is contained in:
commit
895642f9c3
@ -69,7 +69,7 @@ func handleFlags() {
|
||||
flag.Parse()
|
||||
}
|
||||
|
||||
func init() {
|
||||
func TestMain(m *testing.M) {
|
||||
// Register test flags, then parse flags.
|
||||
handleFlags()
|
||||
|
||||
@ -105,9 +105,6 @@ func init() {
|
||||
AssetNames: generated.AssetNames,
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
@ -45,11 +45,11 @@ func init() {
|
||||
// Set this to false to undo util/logs.go settings it to true. Prevents cadvisor log spam.
|
||||
// Remove this once util/logs.go stops setting the flag to true.
|
||||
flag.Set("logtostderr", "false")
|
||||
flag.Parse()
|
||||
}
|
||||
|
||||
// TODO: Should we write an e2e test for this?
|
||||
func main() {
|
||||
flag.Parse()
|
||||
o := strings.Split(*checkFlag, ",")
|
||||
errs := check(o...)
|
||||
if len(errs) > 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user