Browse Source

address some golint suggestions

Marty Schoch 3 years ago
parent
commit
c36eb74ead

+ 1 - 2
registry/analyzer.go

@@ -66,9 +66,8 @@ func (c *AnalyzerCache) DefineAnalyzer(name string, typ string, config map[strin
 	if err != nil {
 		if err == ErrAlreadyDefined {
 			return nil, fmt.Errorf("analyzer named '%s' already defined", name)
-		} else {
-			return nil, err
 		}
+		return nil, err
 	}
 	return item.(*analysis.Analyzer), nil
 }

+ 1 - 2
registry/char_filter.go

@@ -66,9 +66,8 @@ func (c *CharFilterCache) DefineCharFilter(name string, typ string, config map[s
 	if err != nil {
 		if err == ErrAlreadyDefined {
 			return nil, fmt.Errorf("char filter named '%s' already defined", name)
-		} else {
-			return nil, err
 		}
+		return nil, err
 	}
 	return item.(analysis.CharFilter), nil
 }

+ 1 - 2
registry/datetime_parser.go

@@ -66,9 +66,8 @@ func (c *DateTimeParserCache) DefineDateTimeParser(name string, typ string, conf
 	if err != nil {
 		if err == ErrAlreadyDefined {
 			return nil, fmt.Errorf("date time parser named '%s' already defined", name)
-		} else {
-			return nil, err
 		}
+		return nil, err
 	}
 	return item.(analysis.DateTimeParser), nil
 }

+ 1 - 2
registry/fragment_formatter.go

@@ -66,9 +66,8 @@ func (c *FragmentFormatterCache) DefineFragmentFormatter(name string, typ string
 	if err != nil {
 		if err == ErrAlreadyDefined {
 			return nil, fmt.Errorf("fragment formatter named '%s' already defined", name)
-		} else {
-			return nil, err
 		}
+		return nil, err
 	}
 	return item.(highlight.FragmentFormatter), nil
 }

+ 1 - 2
registry/fragmenter.go

@@ -66,9 +66,8 @@ func (c *FragmenterCache) DefineFragmenter(name string, typ string, config map[s
 	if err != nil {
 		if err == ErrAlreadyDefined {
 			return nil, fmt.Errorf("fragmenter named '%s' already defined", name)
-		} else {
-			return nil, err
 		}
+		return nil, err
 	}
 	return item.(highlight.Fragmenter), nil
 }

+ 1 - 2
registry/highlighter.go

@@ -66,9 +66,8 @@ func (c *HighlighterCache) DefineHighlighter(name string, typ string, config map
 	if err != nil {
 		if err == ErrAlreadyDefined {
 			return nil, fmt.Errorf("highlighter named '%s' already defined", name)
-		} else {
-			return nil, err
 		}
+		return nil, err
 	}
 	return item.(highlight.Highlighter), nil
 }

+ 1 - 2
registry/token_filter.go

@@ -66,9 +66,8 @@ func (c *TokenFilterCache) DefineTokenFilter(name string, typ string, config map
 	if err != nil {
 		if err == ErrAlreadyDefined {
 			return nil, fmt.Errorf("token filter named '%s' already defined", name)
-		} else {
-			return nil, err
 		}
+		return nil, err
 	}
 	return item.(analysis.TokenFilter), nil
 }

+ 1 - 2
registry/token_maps.go

@@ -66,9 +66,8 @@ func (c *TokenMapCache) DefineTokenMap(name string, typ string, config map[strin
 	if err != nil {
 		if err == ErrAlreadyDefined {
 			return nil, fmt.Errorf("token map named '%s' already defined", name)
-		} else {
-			return nil, err
 		}
+		return nil, err
 	}
 	return item.(analysis.TokenMap), nil
 }

+ 1 - 2
registry/tokenizer.go

@@ -66,9 +66,8 @@ func (c *TokenizerCache) DefineTokenizer(name string, typ string, config map[str
 	if err != nil {
 		if err == ErrAlreadyDefined {
 			return nil, fmt.Errorf("tokenizer named '%s' already defined", name)
-		} else {
-			return nil, err
 		}
+		return nil, err
 	}
 	return item.(analysis.Tokenizer), nil
 }