From f59cd825295dc94fceaf6de9f566cbb3057038d7 Mon Sep 17 00:00:00 2001 From: Fatih Arslan Date: Fri, 8 Aug 2014 13:45:04 +0300 Subject: [PATCH] tags: simplify parseTag, no need for len checking --- tags.go | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/tags.go b/tags.go index c370af0..103c824 100644 --- a/tags.go +++ b/tags.go @@ -20,21 +20,13 @@ func (t tagOptions) Has(opt string) bool { // which comes after a name. A tag is in the form of: "name,option1,option2". // The name can be neglectected. func parseTag(tag string) (string, tagOptions) { - res := strings.Split(tag, ",") - - // tag = "" - if len(res) == 0 { - return tag, res - } - - // tag = "name" - if len(res) == 1 { - return tag, res[1:] - } - // tag is one of followings: + // "" + // "name" // "name,opt" // "name,opt,opt2" // ",opt" + + res := strings.Split(tag, ",") return res[0], res[1:] }