Skip to content

Commit

Permalink
[chore][receiver/chronyreceiver] use errors.Join instead of go.uber.o…
Browse files Browse the repository at this point in the history
…rg/multierr (#32979)

chronyreceiver: use errors.Join instead of go.uber.org/multierr

**Link to tracking Issue:** 

[#25121](#25121)
  • Loading branch information
acha1os authored May 14, 2024
1 parent f1bf85b commit 3c608d0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion receiver/chronyreceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ require (
go.opentelemetry.io/otel/metric v1.26.0
go.opentelemetry.io/otel/trace v1.26.0
go.uber.org/goleak v1.3.0
go.uber.org/multierr v1.11.0
go.uber.org/zap v1.27.0
)

Expand Down Expand Up @@ -49,6 +48,7 @@ require (
go.opentelemetry.io/otel/exporters/prometheus v0.48.0 // indirect
go.opentelemetry.io/otel/sdk v1.26.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.26.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
Expand Down
5 changes: 2 additions & 3 deletions receiver/chronyreceiver/internal/chrony/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (

"github.com/facebook/time/ntp/chrony"
"github.com/tilinna/clock"
"go.uber.org/multierr"
)

var (
Expand Down Expand Up @@ -80,11 +79,11 @@ func (c *client) GetTrackingData(ctx context.Context) (*Tracking, error) {
packet.SetSequence(uint32(clock.Now(ctx).UnixNano()))

if err := binary.Write(sock, binary.BigEndian, packet); err != nil {
return nil, multierr.Combine(err, sock.Close())
return nil, errors.Join(err, sock.Close())
}
data := make([]uint8, 1024)
if _, err := sock.Read(data); err != nil {
return nil, multierr.Combine(err, sock.Close())
return nil, errors.Join(err, sock.Close())
}

if err := sock.Close(); err != nil {
Expand Down
4 changes: 1 addition & 3 deletions receiver/chronyreceiver/internal/chrony/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import (
"net"
"os"
"strings"

"go.uber.org/multierr"
)

var (
Expand All @@ -30,7 +28,7 @@ func SplitNetworkEndpoint(addr string) (network, endpoint string, err error) {
case "udp":
host, _, err := net.SplitHostPort(endpoint)
if err != nil {
return "", "", fmt.Errorf("issue parsing endpoint: %w", multierr.Combine(ErrInvalidNetwork, err))
return "", "", fmt.Errorf("issue parsing endpoint: %w", errors.Join(ErrInvalidNetwork, err))
}
if host == "" {
return "", "", fmt.Errorf("missing hostname: %w", ErrInvalidNetwork)
Expand Down

0 comments on commit 3c608d0

Please sign in to comment.