@@ -65,11 +65,11 @@ func (t *{{.ServiceStructName}}) GetDescription(method string) (string, error) {
6565 switch method {
6666 {{range .Methods}}case "{{.Name}}":
6767 {
68- return & {{.Description}}{} , nil
68+ return " {{.Description}}" , nil
6969 }
7070 {{end}}default:
7171 {
72- return nil , errors.New("method not found")
72+ return "" , errors.New("method not found")
7373 }
7474 }
7575}
@@ -379,7 +379,7 @@ func parseDir(serviceFolder string) ([]MethodInfo, []string, error) {
379379 }
380380 // Only process Go files that are not test files
381381 if strings .HasSuffix (info .Name (), ".go" ) && ! strings .HasSuffix (info .Name (), "_test.go" ) {
382- node , err := parser .ParseFile (fset , path , nil , parser .AllErrors )
382+ node , err := parser .ParseFile (fset , path , nil , parser .ParseComments )
383383 if err != nil {
384384 return err
385385 }
@@ -407,7 +407,13 @@ func parseDir(serviceFolder string) ([]MethodInfo, []string, error) {
407407
408408 // Extract the function name and input/output parameters
409409 methodName := strings .ToLower (fn .Name .Name ) // Normalize to lowercase
410- description := extractDescriptionFromComments (fn .Doc .List )
410+ var description string
411+
412+ if fn .Doc == nil || len (fn .Doc .List ) == 0 {
413+ description = ""
414+ } else {
415+ description = extractDescriptionFromComments (fn .Doc .List )
416+ }
411417 inputType , isInputPointer , isInputPrimitive := extractType (fn .Type .Params .List [1 ].Type )
412418 outputType , isOutputPointer , isOutputPrimitive := extractType (fn .Type .Results .List [0 ].Type )
413419
0 commit comments