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:
parent
e4da373b41
commit
a958e91b06
1 changed files with 7 additions and 11 deletions
|
@ -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")
|
||||
|
|
Loading…
Add table
Reference in a new issue