Skip to content

Commit

Permalink
updated dependency visitation
Browse files Browse the repository at this point in the history
  • Loading branch information
johnabass committed Mar 13, 2023
1 parent 29c14c9 commit abe71c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions arrangehttp/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,13 @@ func (c *Client) unmarshal(u arrange.Unmarshaler) (cf ClientFactory, err error)

// configure applies the dependencies (if any) and the options and middleware supplied
// on this instance to the given *http.Client
func (c *Client) configure(in ClientIn, client *http.Client, deps []reflect.Value) (err error) {
func (c *Client) configure(in ClientIn, client *http.Client, deps ...reflect.Value) (err error) {
var (
middleware roundtrip.Chain
options arrange.Invoke
)

arrange.VisitDependencies(
arrange.VisitDependencyValues(
func(d arrange.Dependency) bool {
if d.Injected() {
arrange.TryConvert(
Expand Down Expand Up @@ -277,7 +277,7 @@ func (c *Client) provide(deps []reflect.Value) (client *http.Client, err error)
return
}

err = c.configure(in, client, deps[1:])
err = c.configure(in, client, deps[1:]...)
if err != nil {
return
}
Expand Down
6 changes: 3 additions & 3 deletions arrangehttp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,13 @@ func (s *Server) unmarshal(u arrange.Unmarshaler) (sf ServerFactory, err error)
// on this instance to the give *http.Server and supporting objects.
//
//nolint:funlen // this function is necessarily longer than normal given the try cases
func (s *Server) configure(in ServerIn, server *http.Server, deps []reflect.Value) (lc ListenerChain, err error) {
func (s *Server) configure(in ServerIn, server *http.Server, deps ...reflect.Value) (lc ListenerChain, err error) {
var (
middleware alice.Chain
options arrange.Invoke
)

arrange.VisitDependencies(
arrange.VisitDependencyValues(
func(d arrange.Dependency) bool {
if d.Injected() {
arrange.TryConvert(
Expand Down Expand Up @@ -320,7 +320,7 @@ func (s *Server) provide(deps []reflect.Value) (router *mux.Router, err error) {
}

var lc ListenerChain
lc, err = s.configure(in, server, deps[1:])
lc, err = s.configure(in, server, deps[1:]...)
if err != nil {
return
}
Expand Down

0 comments on commit abe71c0

Please sign in to comment.