mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 16:24:19 -04:00
middleware/metrics: fix crash on startup (#318)
Make the methods that handle Metrics all use pointer receivers to fix sync.Once not being initialized. Finish the setup_test to test for failures. And make the check for the address more strict and return an error when it does not have a port number. Add a toplevel test that starts a CoreDNS server with metrics enabled so we catch these errors in the future.
This commit is contained in:
@@ -32,7 +32,7 @@ type Metrics struct {
|
||||
Addr string
|
||||
ln net.Listener
|
||||
mux *http.ServeMux
|
||||
Once *sync.Once
|
||||
Once sync.Once
|
||||
ZoneNames []string
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user