Merge pull request #50 from safing/fix/windows-tests

Check for windows test executable when checking version information
This commit is contained in:
Patrick Pacher 2020-05-28 12:48:59 +02:00 committed by GitHub
commit 07501148ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -85,7 +85,13 @@ func FullVersion() string {
// CheckVersion checks if the metadata is ok. // CheckVersion checks if the metadata is ok.
func CheckVersion() error { func CheckVersion() error {
if !strings.HasSuffix(os.Args[0], ".test") { switch {
case strings.HasSuffix(os.Args[0], ".test"):
return nil // testing on linux/darwin
case strings.HasSuffix(os.Args[0], ".test.exe"):
return nil // testing on windows
default:
// check version information
if name == "[NAME]" { if name == "[NAME]" {
return errors.New("must call SetInfo() before calling CheckVersion()") return errors.New("must call SetInfo() before calling CheckVersion()")
} }
@ -100,5 +106,6 @@ func CheckVersion() error {
return errors.New("please build using the supplied build script.\n$ ./build {main.go|...}") return errors.New("please build using the supplied build script.\n$ ./build {main.go|...}")
} }
} }
return nil return nil
} }