Do not rely on unspecified assignment order of return statement

See: https://github.com/golang/go/issues/58233
This commit is contained in:
Cuong Manh Le
2023-04-26 21:32:08 +07:00
committed by Cuong Manh Le
parent 68fe7e8406
commit 2326160f2f

5
doh.go
View File

@@ -85,7 +85,10 @@ func (r *dohResolver) Resolve(ctx context.Context, msg *dns.Msg) (*dns.Msg, erro
}
answer := new(dns.Msg)
return answer, answer.Unpack(buf)
if err := answer.Unpack(buf); err != nil {
return nil, fmt.Errorf("answer.Unpack: %w", err)
}
return answer, nil
}
func addHeader(ctx context.Context, req *http.Request, sendClientInfo bool) {