diff options
author | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2020-10-23 13:15:34 +0200 |
---|---|---|
committer | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2020-10-23 13:15:34 +0200 |
commit | 10046171a4205667adddf90211fe4c7eb61b90b3 (patch) | |
tree | fd4876fed157193e6d11df704ffc7b65e618fb77 /type.go | |
parent | 04393e4e38586854ac2846b97ef61941e6d4a39a (diff) |
refactored add-entry code path
Diffstat (limited to 'type.go')
-rw-r--r-- | type.go | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -121,18 +121,18 @@ func (i InclusionProofV1) String() string { } // StItemFromB64 creates an StItem from a serialized and base64-encoded string -func StItemFromB64(s string) (*StItem, error) { +func StItemFromB64(s string) (StItem, error) { b, err := base64.StdEncoding.DecodeString(s) if err != nil { - return nil, fmt.Errorf("base64 decoding failed: %v", err) + return StItem{}, fmt.Errorf("base64 decoding failed: %v", err) } var item StItem extra, err := tls.Unmarshal(b, &item) if err != nil { - return nil, fmt.Errorf("tls unmarshal failed: %v", err) + return StItem{}, fmt.Errorf("tls unmarshal failed: %v", err) } else if len(extra) > 0 { - return nil, fmt.Errorf("tls unmarshal found extra data: %v", extra) + return StItem{}, fmt.Errorf("tls unmarshal found extra data: %v", extra) } - return &item, nil + return item, nil } |