Add Goland Standard "cmd" Pattern for Beacon-Chain Binaries (#8540)

* beacon chain cmd pattern

* imports spacing

* more import fix

* edit build file

* e2e viz

* amend e2e
This commit is contained in:
Raul Jordan
2021-03-02 13:36:03 -06:00
committed by GitHub
parent cdea2debc9
commit 090fbbf18c
50 changed files with 218 additions and 182 deletions

View File

@@ -0,0 +1,44 @@
package main
import (
"testing"
"github.com/prysmaticlabs/prysm/shared/featureconfig"
"github.com/urfave/cli/v2"
)
func TestAllFlagsExistInHelp(t *testing.T) {
// If this test is failing, it is because you've recently added/removed a
// flag in beacon chain main.go, but did not add/remove it to the usage.go
// flag grouping (appHelpFlagGroups).
var helpFlags []cli.Flag
for _, group := range appHelpFlagGroups {
helpFlags = append(helpFlags, group.Flags...)
}
helpFlags = featureconfig.ActiveFlags(helpFlags)
appFlags = featureconfig.ActiveFlags(appFlags)
for _, flag := range appFlags {
if !doesFlagExist(flag, helpFlags) {
t.Errorf("Flag %s does not exist in help/usage flags.", flag.Names()[0])
}
}
for _, flag := range helpFlags {
if !doesFlagExist(flag, appFlags) {
t.Errorf("Flag %s does not exist in main.go, "+
"but exists in help flags", flag.Names()[0])
}
}
}
func doesFlagExist(flag cli.Flag, flags []cli.Flag) bool {
for _, f := range flags {
if f.String() == flag.String() {
return true
}
}
return false
}