Skip to content

Commit

Permalink
Fix syntax error
Browse files Browse the repository at this point in the history
  • Loading branch information
achew22 authored and loderunner committed Jan 4, 2018
1 parent 9a086e4 commit 7f3eee2
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions runtime/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ func Uint32(val string) (uint32, error) {
return uint32(i), nil
}

// Bytes converts the given string representation of a byte sequence into a slice of bytes
// A bytes sequence is encoded in URL-safe base64 without padding
func Bytes(val string) ([]byte, error) {
b, err := base64.RawURLEncoding.DecodeString(val)
if err != nil {
return nil, err
}
return b, nil
}

// Timestamp converts the given RFC3339 formatted string into a timestamp.Timestamp.
func Timestamp(val string) (*timestamp.Timestamp, error) {
var r *timestamp.Timestamp
Expand All @@ -75,13 +85,3 @@ func Duration(val string) (*duration.Duration, error) {
err := jsonpb.UnmarshalString(val, r)
return r, err
}

// Bytes converts the given string representation of a byte sequence into a slice of bytes
// A bytes sequence is encoded in URL-safe base64 without padding
func Bytes(val string) ([]byte, error) {
b, err := base64.RawURLEncoding.DecodeString(val)
if err != nil {
return nil, err
}
return b, nil
}

0 comments on commit 7f3eee2

Please sign in to comment.