Skip to content

Commit

Permalink
Merge pull request #41 from multiformats/fix-staticcheck
Browse files Browse the repository at this point in the history
fix staticcheck
  • Loading branch information
marten-seemann committed May 5, 2021
2 parents 95cb707 + daffaef commit f68598d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Encoder struct {
func NewEncoder(base Encoding) (Encoder, error) {
_, ok := EncodingToStr[base]
if !ok {
return Encoder{-1}, fmt.Errorf("Unsupported multibase encoding: %d", base)
return Encoder{-1}, fmt.Errorf("unsupported multibase encoding: %d", base)
}
return Encoder{base}, nil
}
Expand All @@ -33,17 +33,17 @@ func MustNewEncoder(base Encoding) Encoder {
// either be the multibase name or single character multibase prefix
func EncoderByName(str string) (Encoder, error) {
var base Encoding
ok := true
var ok bool
if len(str) == 0 {
return Encoder{-1}, fmt.Errorf("Empty multibase encoding")
return Encoder{-1}, fmt.Errorf("empty multibase encoding")
} else if len(str) == 1 {
base = Encoding(str[0])
_, ok = EncodingToStr[base]
} else {
base, ok = Encodings[str]
}
if !ok {
return Encoder{-1}, fmt.Errorf("Unsupported multibase encoding: %s", str)
return Encoder{-1}, fmt.Errorf("unsupported multibase encoding: %s", str)
}
return Encoder{base}, nil
}
Expand Down

0 comments on commit f68598d

Please sign in to comment.