Skip to content

Commit

Permalink
[chore] Updated unmarshalText func (#9838)
Browse files Browse the repository at this point in the history
Changed the switch statement in` UnmarshalText` function to an if
statement {configcompression}
Link to the issue:
#9458

---------

Co-authored-by: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com>
Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com>
  • Loading branch information
3 people committed Apr 2, 2024
1 parent 295251b commit b8e4fa7
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions config/configcompression/compressiontype.go
Expand Up @@ -25,17 +25,17 @@ func (ct *Type) IsCompressed() bool {
}

func (ct *Type) UnmarshalText(in []byte) error {
switch typ := Type(in); typ {
case TypeGzip,
TypeZlib,
TypeDeflate,
TypeSnappy,
TypeZstd,
typeNone,
typeEmpty:
typ := Type(in)
if typ == TypeGzip ||
typ == TypeZlib ||
typ == TypeDeflate ||
typ == TypeSnappy ||
typ == TypeZstd ||
typ == typeNone ||
typ == typeEmpty {
*ct = typ
return nil
default:
return fmt.Errorf("unsupported compression type %q", typ)
}
return fmt.Errorf("unsupported compression type %q", typ)

}

0 comments on commit b8e4fa7

Please sign in to comment.