@@ -28,16 +28,16 @@ var ErrInvalidParameters = CodedError(codes.InvalidArgument, "RPC parameter was
2828// This file defines functions to translate between the protobuf types and the
2929// code types.
3030
31- func ProblemDetailsToPB (prob * probs.ProblemDetails ) ( * corepb.ProblemDetails , error ) {
31+ func ProblemDetailsToPB (prob * probs.ProblemDetails ) * corepb.ProblemDetails {
3232 if prob == nil {
3333 // nil problemDetails is valid
34- return nil , nil
34+ return nil
3535 }
3636 return & corepb.ProblemDetails {
3737 ProblemType : string (prob .Type ),
3838 Detail : prob .Detail ,
3939 HttpStatus : int32 (prob .HTTPStatus ), //nolint: gosec // HTTP status codes are guaranteed to be small, no risk of overflow.
40- }, nil
40+ }
4141}
4242
4343func PBToProblemDetails (in * corepb.ProblemDetails ) (* probs.ProblemDetails , error ) {
@@ -59,12 +59,10 @@ func PBToProblemDetails(in *corepb.ProblemDetails) (*probs.ProblemDetails, error
5959}
6060
6161func ChallengeToPB (challenge core.Challenge ) (* corepb.Challenge , error ) {
62- prob , err := ProblemDetailsToPB (challenge .Error )
63- if err != nil {
64- return nil , err
65- }
62+ prob := ProblemDetailsToPB (challenge .Error )
6663 recordAry := make ([]* corepb.ValidationRecord , len (challenge .ValidationRecord ))
6764 for i , v := range challenge .ValidationRecord {
65+ var err error
6866 recordAry [i ], err = ValidationRecordToPB (v )
6967 if err != nil {
7068 return nil , err
@@ -196,10 +194,7 @@ func ValidationResultToPB(records []core.ValidationRecord, prob *probs.ProblemDe
196194 return nil , err
197195 }
198196 }
199- marshalledProb , err := ProblemDetailsToPB (prob )
200- if err != nil {
201- return nil , err
202- }
197+ marshalledProb := ProblemDetailsToPB (prob )
203198 return & vapb.ValidationResult {
204199 Records : recordAry ,
205200 Problem : marshalledProb ,
@@ -228,10 +223,7 @@ func pbToValidationResult(in *vapb.ValidationResult) ([]core.ValidationRecord, *
228223}
229224
230225func CAAResultToPB (prob * probs.ProblemDetails , perspective , rir string ) (* vapb.IsCAAValidResponse , error ) {
231- marshalledProb , err := ProblemDetailsToPB (prob )
232- if err != nil {
233- return nil , err
234- }
226+ marshalledProb := ProblemDetailsToPB (prob )
235227 return & vapb.IsCAAValidResponse {
236228 Problem : marshalledProb ,
237229 Perspective : perspective ,
0 commit comments