Skip to content

Commit

Permalink
return error if ParsedURL is nil in unix resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
easwars committed Sep 30, 2021
1 parent c5c4383 commit 5cff707
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions internal/resolver/unix/unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ func (b *builder) Build(target resolver.Target, cc resolver.ClientConn, _ resolv
// resolver implementations we ended up stripping the leading "/" from the
// endpoint. This obviously does not work for the "unix" scheme. Hence we
// end up using the parsed URL instead.
endpoint := target.Endpoint
if u := target.ParsedURL; u != nil {
endpoint = u.Path
if endpoint == "" {
endpoint = u.Opaque
}
if target.ParsedURL == nil {
return nil, fmt.Errorf("nil ParsedURL in received target: %+v", target)
}
endpoint := target.ParsedURL.Path
if endpoint == "" {
endpoint = target.ParsedURL.Opaque
}
addr := resolver.Address{Addr: endpoint}
if b.scheme == unixAbstractScheme {
Expand Down
2 changes: 1 addition & 1 deletion resolver/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ type Target struct {
Authority string
Endpoint string
// ParsedURL contains the parsed dial target with an optional default scheme
// added to it if the original dial target contained no scheme or containted
// added to it if the original dial target contained no scheme or contained
// an unregistered scheme. Any query params specified in the original dial
// target can be accessed from here.
ParsedURL *url.URL
Expand Down

0 comments on commit 5cff707

Please sign in to comment.