diff --git a/tools/goctl/api/gogen/gen_test.go b/tools/goctl/api/gogen/gen_test.go index 8330ea14..5d595f2e 100644 --- a/tools/goctl/api/gogen/gen_test.go +++ b/tools/goctl/api/gogen/gen_test.go @@ -22,10 +22,14 @@ info( version: 1.0 ) -type Request struct { +// TODO: test +// { +type Request struct { // TODO: test + // TOOD Name string ` + "`" + `path:"name,options=you|me"` + "`" + ` // } -} +} // TODO: test +// TODO: test type Response struct { Message string ` + "`" + `json:"message"` + "`" + ` } diff --git a/tools/goctl/api/parser/apifileparser.go b/tools/goctl/api/parser/apifileparser.go index 5b916692..8e13cb7d 100644 --- a/tools/goctl/api/parser/apifileparser.go +++ b/tools/goctl/api/parser/apifileparser.go @@ -139,6 +139,7 @@ func (s *apiImportState) process(api *ApiStruct, token string) (apiFileState, er } line = token + line + line = removeComment(line) if len(strings.Fields(line)) != 2 { return nil, errors.New("import syntax error: " + line) } @@ -159,6 +160,8 @@ func (s *apiTypeState) process(api *ApiStruct, token string) (apiFileState, erro token = "" line = strings.TrimSpace(line) line = removeComment(line) + line = strings.TrimSpace(line) + if strings.HasSuffix(line, leftBrace) { blockCount++ } @@ -191,6 +194,8 @@ func (s *apiServiceState) process(api *ApiStruct, token string) (apiFileState, e api.Service += "\n" + line line = strings.TrimSpace(line) line = removeComment(line) + line = strings.TrimSpace(line) + if strings.HasSuffix(line, leftBrace) { blockCount++ }