fix: panic when proto file not exist
This commit is contained in:
parent
c57b75721e
commit
323617361d
@ -1,7 +1,6 @@
|
||||
package bootstrap
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
@ -56,17 +55,16 @@ func AddServiceCommand() *cobra.Command {
|
||||
return
|
||||
}
|
||||
|
||||
err := gobuf.CreateFile(pbPath)
|
||||
if err != nil {
|
||||
logrus.Errorf("read proto file failed (when create new file): %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
buf, err := gobuf.NewParser(pbPath)
|
||||
if err != nil {
|
||||
if !errors.Is(err, os.ErrNotExist) {
|
||||
logrus.Errorf("read proto file failed: %v", err)
|
||||
return
|
||||
}
|
||||
err := buf.CreateFile(pbPath)
|
||||
if err != nil {
|
||||
logrus.Errorf("read proto file failed (when create new file): %v", err)
|
||||
return
|
||||
}
|
||||
logrus.Errorf("read proto file failed: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
if buf.ExistService(svcName) {
|
||||
|
Loading…
Reference in New Issue
Block a user