From a958e91b06827242f82cb880ad13772a187b4ce5 Mon Sep 17 00:00:00 2001 From: Chapuis Bertil Date: Fri, 7 Aug 2015 11:37:14 +0200 Subject: [PATCH] replaced if with switch Notice I care about style :) --- backend/interface.go | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/backend/interface.go b/backend/interface.go index 926fe5caf..9e53f63f9 100644 --- a/backend/interface.go +++ b/backend/interface.go @@ -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")