diff --git a/tools/goctl/api/gogen/genroutes.go b/tools/goctl/api/gogen/genroutes.go index 8b273b8f..7c14d83b 100644 --- a/tools/goctl/api/gogen/genroutes.go +++ b/tools/goctl/api/gogen/genroutes.go @@ -207,10 +207,12 @@ func getRoutes(api *spec.ApiSpec) ([]group, error) { strings.Split(middleware, ",")...) } prefix := g.GetAnnotation(spec.RoutePrefixKey) - prefix = strings.TrimSpace(prefix) prefix = strings.ReplaceAll(prefix, `"`, "") - prefix = path.Join("/", prefix) - groupedRoutes.prefix = prefix + prefix = strings.TrimSpace(prefix) + if len(prefix) > 0 { + prefix = path.Join("/", prefix) + groupedRoutes.prefix = prefix + } routes = append(routes, groupedRoutes) }