chore(all): return concrete types, accept interfaces

- Remove exported interfaces unused locally
- Define interfaces to accept arguments
- Return concrete types, not interfaces
This commit is contained in:
Quentin McGaw
2022-06-11 01:34:30 +00:00
parent 0378fe4a7b
commit 578ef768ab
132 changed files with 594 additions and 935 deletions

View File

@@ -2,30 +2,11 @@
package httpserver
import (
"context"
"fmt"
"net/http"
"time"
)
var _ Interface = (*Server)(nil)
// Interface is the HTTP server composite interface.
type Interface interface {
Runner
AddressGetter
}
// Runner is the interface for an HTTP server with a Run method.
type Runner interface {
Run(ctx context.Context, ready chan<- struct{}, done chan<- struct{})
}
// AddressGetter obtains the address the HTTP server is listening on.
type AddressGetter interface {
GetAddress() (address string)
}
// Server is an HTTP server implementation, which uses
// the HTTP handler provided.
type Server struct {