Skip to content

Commit

Permalink
fixes #6; make arg public (Arg);
Browse files Browse the repository at this point in the history
  • Loading branch information
vany-egorov committed Feb 9, 2021
1 parent b859433 commit 0e889c2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions args.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ func (cfg *args) defaultize() {
cfg.ctx = context.TODO()
}

type arg func(*args)
type Arg func(*args)

func FnShutdownTimeout(v func() time.Duration) arg {
func FnShutdownTimeout(v func() time.Duration) Arg {
return func(cfg *args) { cfg.fnShutdownTimeout = v }
}

func FnLog(v log.FnT) arg {
func FnLog(v log.FnT) Arg {
return func(cfg *args) { cfg.fnLog = v }
}

func Context(v context.Context) arg {
func Context(v context.Context) Arg {
return func(cfg *args) { cfg.ctx = v }
}
4 changes: 2 additions & 2 deletions listen-serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type ServerListener struct {

func (sl *ServerListener) Addr() string { return sl.Server.Addr() }

func (it iterator) Listen(fnArgs ...arg) (ss Servers, errs []error) {
func (it iterator) Listen(fnArgs ...Arg) (ss Servers, errs []error) {
cfg := args{}
cfg.defaultize()

Expand Down Expand Up @@ -102,7 +102,7 @@ func (it iterator) Listen(fnArgs ...arg) (ss Servers, errs []error) {
return ss, errs
}

func (it iterator) ServeHTTP(handler http.Handler, fnArgs ...arg) (chan struct{}, chan error) {
func (it iterator) ServeHTTP(handler http.Handler, fnArgs ...Arg) (chan struct{}, chan error) {
it = it.FilterListener()

cfg := args{}
Expand Down
4 changes: 2 additions & 2 deletions servers.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,11 @@ func (ss *Servers) SetPortToFirstINET(port int) {
setPort(port)
}

func (ss *Servers) Listen(fnArgs ...arg) (Servers, []error) {
func (ss *Servers) Listen(fnArgs ...Arg) (Servers, []error) {
return ss.IntoIter().Listen(fnArgs...)
}

func (ss *Servers) ServeHTTP(handler http.Handler, fnArgs ...arg) (chan struct{}, chan error) {
func (ss *Servers) ServeHTTP(handler http.Handler, fnArgs ...Arg) (chan struct{}, chan error) {
return ss.IntoIter().ServeHTTP(handler, fnArgs...)
}

Expand Down

0 comments on commit 0e889c2

Please sign in to comment.