Update info module to start first, improve sanity checking

This commit is contained in:
Daniel 2019-10-09 16:19:54 +02:00
parent 2fb83cecb8
commit 09616a0c25

View file

@ -15,7 +15,7 @@ var (
)
func init() {
modules.Register("info", prep, nil, nil, "base")
modules.Register("info", prep, nil, nil)
flag.BoolVar(&showVersion, "version", false, "show version and exit")
}
@ -35,8 +35,10 @@ func prep() error {
// CheckVersion checks if the metadata is ok.
func CheckVersion() error {
if !strings.HasSuffix(os.Args[0], ".test") {
if name == "[NAME]" ||
version == "[version unknown]" ||
if name == "[NAME]" {
return errors.New("must call SetInfo() before calling CheckVersion()")
}
if version == "[version unknown]" ||
commit == "[commit unknown]" ||
license == "[license unknown]" ||
buildOptions == "[options unknown]" ||