1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2025-03-16 00:00:05 +01:00

replaced if with switch

Notice I care about style :)
This commit is contained in:
Chapuis Bertil 2015-08-07 11:37:14 +02:00
parent e4da373b41
commit a958e91b06

View file

@ -18,22 +18,18 @@ const (
)
func ParseType(s string) (Type, error) {
if s == string(Data) {
switch s {
case string(Data):
return Data, nil
}
if s == string(Key) {
case string(Key):
return Key, nil
}
if s == string(Lock) {
case string(Lock):
return Lock, nil
}
if s == string(Snapshot) {
case string(Snapshot):
return Snapshot, nil
}
if s == string(Index) {
case string(Index):
return Index, nil
}
if s == string(Config) {
case string(Config):
return Config, nil
}
return "", errors.New("invalid type")