ignore blank between bracket and service tag (#154)
* rebase upstream
* rebase
* trim no need line
* trim no need line
* trim no need line
* update doc
* remove update
* remove no need
* remove no need
* goctl add jwt support
* goctl add jwt support
* goctl add jwt support
* goctl support import
* goctl support import
* support return ()
* revert
* refactor and rename folder to group
* remove no need
* add anonymous annotation
* optimized
* rename
* rename
* update test
* api add middleware support: usage:
@server(
middleware: M1, M2
)
* api add middleware support: usage:
@server(
middleware: M1, M2
)
* simple logic
* optimized
* optimized generator formatted code
* optimized generator formatted code
* add more test
* ignore black between bracket and service tag
* use join instead
* format
Co-authored-by: kingxt <dream4kingxt@163.com>
This commit is contained in:
@@ -133,7 +133,7 @@ func isTypeBeginLine(line string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func isServiceBeginLine(line string) bool {
|
func isServiceBeginLine(line string) bool {
|
||||||
return strings.HasPrefix(line, "@server(") || (strings.HasPrefix(line, "service") && strings.HasSuffix(line, "{"))
|
return strings.HasPrefix(line, "@server") || (strings.HasPrefix(line, "service") && strings.HasSuffix(line, "{"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func lineBeginOfService(api string) int {
|
func lineBeginOfService(api string) int {
|
||||||
|
|||||||
@@ -42,12 +42,14 @@ func GenConfigCommand(c *cli.Context) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("abs failed: " + c.String("path"))
|
return errors.New("abs failed: " + c.String("path"))
|
||||||
}
|
}
|
||||||
|
|
||||||
goModPath, hasFound := util.FindGoModPath(path)
|
goModPath, hasFound := util.FindGoModPath(path)
|
||||||
if !hasFound {
|
if !hasFound {
|
||||||
return errors.New("go mod not initial")
|
return errors.New("go mod not initial")
|
||||||
}
|
}
|
||||||
|
|
||||||
path = strings.TrimSuffix(path, "/config.go")
|
path = strings.TrimSuffix(path, "/config.go")
|
||||||
location := path + "/tmp"
|
location := filepath.Join(path, "tmp")
|
||||||
err = os.MkdirAll(location, os.ModePerm)
|
err = os.MkdirAll(location, os.ModePerm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -76,10 +78,12 @@ func GenConfigCommand(c *cli.Context) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
path, err = os.Getwd()
|
path, err = os.Getwd()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = os.Rename(filepath.Dir(goPath)+"/config.yaml", path+"/config.yaml")
|
err = os.Rename(filepath.Dir(goPath)+"/config.yaml", path+"/config.yaml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user