Skip to content

Commit

Permalink
refactor: refactor API routing and optimize import usage
Browse files Browse the repository at this point in the history
- Removed the `"slices"` import in `container.go`
- Changed the `RouteAPI` method to use `append` instead of `slices.Concat`

Signed-off-by: Jqs7 <[email protected]>
  • Loading branch information
jqs7 committed Apr 27, 2024
1 parent dc40949 commit 2438d01
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions container.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"net/http/httptest"
"os"
"reflect"
"slices"

"github.com/emicklei/go-restful/v3"
"github.com/go-openapi/spec"
Expand Down Expand Up @@ -226,5 +225,5 @@ func (c *Container) NewWS() WS {
}

func (c *Container) RouteAPI(f any, opts ...opt.RouteAPIOpts) opt.RouteFunc {
return opt.RouteAPI(f, slices.Concat([]opt.RouteAPIOpts{opt.WithLogger(c.logger)}, opts)...)
return opt.RouteAPI(f, append([]opt.RouteAPIOpts{opt.WithLogger(c.logger)}, opts...)...)
}

0 comments on commit 2438d01

Please sign in to comment.