diff --git a/.github/workflows/samples-go.yaml b/.github/workflows/samples-go.yaml index d279fb568d0f..4c6ea3e11dcd 100644 --- a/.github/workflows/samples-go.yaml +++ b/.github/workflows/samples-go.yaml @@ -5,12 +5,12 @@ on: paths: - 'samples/server/petstore/go-echo-server/**' - 'samples/server/petstore/go-api-server/**' - #- 'samples/server/petstore/go-chi-server/**' + - 'samples/server/petstore/go-chi-server/**' pull_request: paths: - 'samples/server/petstore/go-echo-server/**' - 'samples/server/petstore/go-api-server/**' - #- 'samples/server/petstore/go-chi-server/**' + - 'samples/server/petstore/go-chi-server/**' jobs: build: @@ -22,7 +22,7 @@ jobs: sample: - samples/server/petstore/go-echo-server/ - samples/server/petstore/go-api-server/ - #- samples/server/petstore/go-chi-server/ + - samples/server/petstore/go-chi-server/ steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v4 diff --git a/modules/openapi-generator/src/main/resources/go-server/routers.mustache b/modules/openapi-generator/src/main/resources/go-server/routers.mustache index a15e821667e4..58fd30827e7e 100644 --- a/modules/openapi-generator/src/main/resources/go-server/routers.mustache +++ b/modules/openapi-generator/src/main/resources/go-server/routers.mustache @@ -59,7 +59,7 @@ func NewRouter(routers ...Router) {{#routers}}{{#mux}}*mux.Router{{/mux}}{{#chi} {{/chi}} {{/routers}} for _, api := range routers { - for name, route := range api.Routes() { + for {{#routers}}{{#mux}}name{{/mux}}{{#chi}}_{{/chi}}{{/routers}}, route := range api.Routes() { var handler http.Handler handler = route.HandlerFunc {{#routers}} diff --git a/samples/server/petstore/go-chi-server/go/routers.go b/samples/server/petstore/go-chi-server/go/routers.go index fec814b0a9f0..3070d048e1b3 100644 --- a/samples/server/petstore/go-chi-server/go/routers.go +++ b/samples/server/petstore/go-chi-server/go/routers.go @@ -44,7 +44,7 @@ func NewRouter(routers ...Router) chi.Router { router := chi.NewRouter() router.Use(middleware.Logger) for _, api := range routers { - for name, route := range api.Routes() { + for _, route := range api.Routes() { var handler http.Handler handler = route.HandlerFunc router.Method(route.Method, route.Pattern, handler) diff --git a/samples/server/petstore/go-server-required/go/routers.go b/samples/server/petstore/go-server-required/go/routers.go index fec814b0a9f0..3070d048e1b3 100644 --- a/samples/server/petstore/go-server-required/go/routers.go +++ b/samples/server/petstore/go-server-required/go/routers.go @@ -44,7 +44,7 @@ func NewRouter(routers ...Router) chi.Router { router := chi.NewRouter() router.Use(middleware.Logger) for _, api := range routers { - for name, route := range api.Routes() { + for _, route := range api.Routes() { var handler http.Handler handler = route.HandlerFunc router.Method(route.Method, route.Pattern, handler)