diff --git a/cmd/windows_exporter/main.go b/cmd/windows_exporter/main.go index 99e3fc63d..63a47d10c 100644 --- a/cmd/windows_exporter/main.go +++ b/cmd/windows_exporter/main.go @@ -20,6 +20,9 @@ package main //goland:noinspection GoUnsortedImport //nolint:gofumpt import ( + // Its important that we do these first so that we can register with the Windows service control ASAP to avoid timeouts. + "github.com/prometheus-community/windows_exporter/internal/windowsservice" + "context" "errors" "fmt" @@ -34,9 +37,6 @@ import ( "strings" "time" - // Its important that we do these first so that we can register with the Windows service control ASAP to avoid timeouts. - "github.com/prometheus-community/windows_exporter/internal/windowsservice" - "github.com/alecthomas/kingpin/v2" "github.com/prometheus-community/windows_exporter/internal/config" "github.com/prometheus-community/windows_exporter/internal/httphandler" diff --git a/pkg/collector/collection.go b/pkg/collector/collection.go index 8a47067ae..c79f36386 100644 --- a/pkg/collector/collection.go +++ b/pkg/collector/collection.go @@ -226,7 +226,7 @@ func (c *Collection) Build(logger *slog.Logger) error { close(errCh) - var errs []error + errs := make([]error, 0, len(c.collectors)) for err := range errCh { if errors.Is(err, perfdata.ErrNoData) ||