1
0
mirror of https://github.com/oauth2-proxy/oauth2-proxy.git synced 2026-04-26 20:42:38 +02:00
Files
renovate[bot] 854a74793b chore(deps): update dependency golangci/golangci-lint to v2.7.2 (#3254)
* chore(deps): update dependency golangci/golangci-lint to v2.7.2

* chore(linter): fix gocritic deprecation message issue

Signed-off-by: Jan Larwig <jan@larwig.com>

* chore(lint): fix var-naming: avoid package names that conflict with Go standard library package names (revive)

Signed-off-by: Jan Larwig <jan@larwig.com>

---------

Signed-off-by: Jan Larwig <jan@larwig.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jan Larwig <jan@larwig.com>
2026-01-04 10:23:26 +01:00

36 lines
680 B
Go

package proxyhttp
import (
"context"
"golang.org/x/sync/errgroup"
)
// NewServerGroup creates a new Server to start and gracefully stop a collection
// of Servers.
func NewServerGroup(servers ...Server) Server {
return &serverGroup{
servers: servers,
}
}
// serverGroup manages the starting and graceful shutdown of a collection of
// servers.
type serverGroup struct {
servers []Server
}
// Start runs the servers in the server group.
func (s *serverGroup) Start(ctx context.Context) error {
g, groupCtx := errgroup.WithContext(ctx)
for _, server := range s.servers {
srv := server
g.Go(func() error {
return srv.Start(groupCtx)
})
}
return g.Wait()
}