fix: create file when proto file not exist
This commit is contained in:
parent
c3800bcf99
commit
c57b75721e
@ -1,6 +1,7 @@
|
||||
package bootstrap
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
@ -57,9 +58,17 @@ func AddServiceCommand() *cobra.Command {
|
||||
|
||||
buf, err := gobuf.NewParser(pbPath)
|
||||
if err != nil {
|
||||
logrus.Errorf("read proto file failed: %v", err)
|
||||
return
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
if buf.ExistService(svcName) {
|
||||
logrus.Errorf("router group name exist")
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user