Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Commit

Permalink
fix drivers updater validation
Browse files Browse the repository at this point in the history
Signed-off-by: lwsanty <lwsanty@gmail.com>
  • Loading branch information
lwsanty authored and dennwc committed Sep 10, 2019
1 parent c7df662 commit a862f7d
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions cmd/bblfsh-drivers-updater/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,13 @@ func main() {

var scriptText string
scriptData, err := ioutil.ReadFile(*scriptPathPtr)

switch {
case err != nil && !os.IsNotExist(err):
if err != nil {
log.Errorf(err, "error")
os.Exit(1)
case os.IsNotExist(err):
log.Infof("script %v does not exist", *scriptPathPtr)
if strings.TrimSpace(*SDKVersionPtr) == "" {
log.Infof("both script and SDK version not found, exiting")
os.Exit(0)
}
fallthrough
case strings.TrimSpace(string(scriptData)) == "" && strings.TrimSpace(*SDKVersionPtr) == "":
}
scriptText = string(scriptData)
if strings.TrimSpace(scriptText) == "" && strings.TrimSpace(*SDKVersionPtr) == "" {
log.Infof("script and SDK version are empty, nothing to do here")
os.Exit(0)
default:
scriptText = string(scriptData)
}

log.Infof("getting the list of supported drivers")
Expand Down

0 comments on commit a862f7d

Please sign in to comment.