Goctl rpc patch (#117)

* remove mock generation

* add: proto project import

* update document

* remove mock generation

* add: proto project import

* update document

* remove NL

* update document

* optimize code

* add test

* add test
This commit is contained in:
Keson
2020-10-10 16:19:46 +08:00
committed by GitHub
parent c32759d735
commit 0a9c427443
26 changed files with 1394 additions and 230 deletions

View File

@@ -11,9 +11,11 @@ type (
Console interface {
Success(format string, a ...interface{})
Info(format string, a ...interface{})
Debug(format string, a ...interface{})
Warning(format string, a ...interface{})
Error(format string, a ...interface{})
Fatalln(format string, a ...interface{})
MarkDone()
Must(err error)
}
colorConsole struct {
@@ -39,6 +41,11 @@ func (c *colorConsole) Info(format string, a ...interface{}) {
fmt.Println(msg)
}
func (c *colorConsole) Debug(format string, a ...interface{}) {
msg := fmt.Sprintf(format, a...)
fmt.Println(aurora.Blue(msg))
}
func (c *colorConsole) Success(format string, a ...interface{}) {
msg := fmt.Sprintf(format, a...)
fmt.Println(aurora.Green(msg))
@@ -59,6 +66,10 @@ func (c *colorConsole) Fatalln(format string, a ...interface{}) {
os.Exit(1)
}
func (c *colorConsole) MarkDone() {
c.Success("Done.")
}
func (c *colorConsole) Must(err error) {
if err != nil {
c.Fatalln("%+v", err)
@@ -74,6 +85,11 @@ func (i *ideaConsole) Info(format string, a ...interface{}) {
fmt.Println(msg)
}
func (i *ideaConsole) Debug(format string, a ...interface{}) {
msg := fmt.Sprintf(format, a...)
fmt.Println(aurora.Blue(msg))
}
func (i *ideaConsole) Success(format string, a ...interface{}) {
msg := fmt.Sprintf(format, a...)
fmt.Println("[SUCCESS]: ", msg)
@@ -94,6 +110,10 @@ func (i *ideaConsole) Fatalln(format string, a ...interface{}) {
os.Exit(1)
}
func (i *ideaConsole) MarkDone() {
i.Success("Done.")
}
func (i *ideaConsole) Must(err error) {
if err != nil {
i.Fatalln("%+v", err)